Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys Added a new option for embedding a splash screen into ke...



details:   https://anonhg.NetBSD.org/src/rev/4c0cc69790f9
branches:  trunk
changeset: 337841:4c0cc69790f9
user:      nat <nat%NetBSD.org@localhost>
date:      Thu Apr 30 13:46:47 2015 +0000

description:
Added a new option for embedding a splash screen into kernel.
Add: options SPLASHSCREEN
     makeoptions SPLASHSCREEN_IMAGE="path/to/image"
to your config file.  So far it will work on amd64 and RPI/RPI2.

This commit was with ideas, help, and OK from jmcneill@.

diffstat:

 sys/arch/amd64/conf/Makefile.amd64 |   7 ++++++-
 sys/arch/arm/conf/Makefile.arm     |   7 ++++++-
 sys/dev/splash/splash.mk           |  26 ++++++++++++++++++++++++++
 sys/kern/init_main.c               |  19 +++++++++++++++++--
 4 files changed, 55 insertions(+), 4 deletions(-)

diffs (126 lines):

diff -r d6763c45434f -r 4c0cc69790f9 sys/arch/amd64/conf/Makefile.amd64
--- a/sys/arch/amd64/conf/Makefile.amd64        Thu Apr 30 10:00:04 2015 +0000
+++ b/sys/arch/amd64/conf/Makefile.amd64        Thu Apr 30 13:46:47 2015 +0000
@@ -1,4 +1,5 @@
-#      $NetBSD: Makefile.amd64,v 1.46 2014/11/15 12:42:56 uebayasi Exp $
+#      $NetBSD: Makefile.amd64,v 1.47 2015/04/30 13:46:47 nat Exp $
+
 
 # Makefile for NetBSD
 #
@@ -73,6 +74,10 @@
 spl.o: ${AMD64}/amd64/spl.S assym.h
        ${NORMAL_S}
 
+.if defined(SPLASHSCREEN_IMAGE)
+.include "$S/dev/splash/splash.mk"
+.endif
+
 ##
 ## (5) link settings
 ##
diff -r d6763c45434f -r 4c0cc69790f9 sys/arch/arm/conf/Makefile.arm
--- a/sys/arch/arm/conf/Makefile.arm    Thu Apr 30 10:00:04 2015 +0000
+++ b/sys/arch/arm/conf/Makefile.arm    Thu Apr 30 13:46:47 2015 +0000
@@ -1,4 +1,5 @@
-#      $NetBSD: Makefile.arm,v 1.45 2014/08/17 21:17:43 joerg Exp $
+#      $NetBSD: Makefile.arm,v 1.46 2015/04/30 13:46:47 nat Exp $
+
 
 # Makefile for NetBSD
 #
@@ -74,6 +75,10 @@
 locore.o: ${ARM}/arm32/locore.S assym.h
        ${NORMAL_S}
 
+.if defined(SPLASHSCREEN_IMAGE)
+.include "$S/dev/splash/splash.mk"
+.endif
+
 ##
 ## (5) link settings
 ##
diff -r d6763c45434f -r 4c0cc69790f9 sys/dev/splash/splash.mk
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/dev/splash/splash.mk  Thu Apr 30 13:46:47 2015 +0000
@@ -0,0 +1,26 @@
+# Makefile for embedding splash image into kernel.
+.include <bsd.endian.mk>
+
+MD_OBJS+=      splash_image.o
+CFLAGS+=       -DSPLASHSCREEN_IMAGE
+
+.if (${OBJECT_FMTS:Melf64})
+BFD_ELFTARGET=elf64
+.else
+BFD_ELFTARGET=elf32
+.endif
+
+BFD_ENDIANNESS=${TARGET_ENDIANNESS:S/1234/little/C/4321/big/}
+BFD_CPU=${MACHINE_CPU:S/_/-/}
+
+.if (${BFD_CPU:Maarch64} || ${BFD_CPU:Marm} || ${BFD_CPU:Mmips} || ${BFD_CPU:Mscore})
+BFD_TARGET=${BFD_ELFTARGET}-${BFD_ENDIANNESS}${BFD_CPU}
+.else
+BFD_TARGET=${BFD_ELFTARGET}-${BFD_CPU}
+.endif
+
+splash_image.o:        ${SPLASHSCREEN_IMAGE}
+       cp ${SPLASHSCREEN_IMAGE} splash.image
+       ${OBJCOPY} -I binary -B ${MACHINE_CPU:C/x86_64/i386/} \
+               -O ${BFD_TARGET} splash.image splash_image.o
+       rm splash.image
diff -r d6763c45434f -r 4c0cc69790f9 sys/kern/init_main.c
--- a/sys/kern/init_main.c      Thu Apr 30 10:00:04 2015 +0000
+++ b/sys/kern/init_main.c      Thu Apr 30 13:46:47 2015 +0000
@@ -1,4 +1,5 @@
-/*     $NetBSD: init_main.c,v 1.464 2015/04/27 07:51:28 pgoyette Exp $ */
+/*     $NetBSD: init_main.c,v 1.465 2015/04/30 13:46:47 nat Exp $      */
+
 
 /*-
  * Copyright (c) 2008, 2009 The NetBSD Foundation, Inc.
@@ -97,7 +98,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: init_main.c,v 1.464 2015/04/27 07:51:28 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: init_main.c,v 1.465 2015/04/30 13:46:47 nat Exp $");
 
 #include "opt_ddb.h"
 #include "opt_ipsec.h"
@@ -113,6 +114,12 @@
 #include "opt_wapbl.h"
 #include "opt_ptrace.h"
 #include "opt_rnd_printf.h"
+#include "opt_splash.h"
+
+#if defined(SPLASHSCREEN) && defined(SPLASHSCREEN_IMAGE)
+extern void *_binary_splash_image_start;
+extern void *_binary_splash_image_end;
+#endif
 
 #include "drvctl.h"
 #include "ksyms.h"
@@ -218,6 +225,7 @@
 #include <uvm/uvm.h>   /* extern struct uvm uvm */
 
 #include <dev/cons.h>
+#include <dev/splash/splash.h>
 
 #include <net/bpf.h>
 #include <net/if.h>
@@ -356,6 +364,13 @@
        /* Initialize the buffer cache */
        bufinit();
 
+
+#if defined(SPLASHSCREEN) && defined(SPLASHSCREEN_IMAGE)
+       size_t splash_size = (&_binary_splash_image_end -
+           &_binary_splash_image_start) * sizeof(void *);
+       splash_setimage(&_binary_splash_image_start, splash_size);
+#endif
+
        /* Initialize sockets. */
        soinit();
 



Home | Main Index | Thread Index | Old Index