1 |
commit: c13e972b79864db27742fd9cdbd96be27d4f3462 |
2 |
Author: Christoph Junghans <ottxor <AT> gentoo <DOT> org> |
3 |
AuthorDate: Sun Jan 18 00:57:55 2015 +0000 |
4 |
Commit: Christoph Junghans <ottxor <AT> gentoo <DOT> org> |
5 |
CommitDate: Sun Jan 18 16:57:18 2015 +0000 |
6 |
URL: http://sources.gentoo.org/gitweb/?p=proj/genkernel.git;a=commit;h=c13e972b |
7 |
|
8 |
Added --wrap-initrd option |
9 |
|
10 |
This is useful in combination the u-boot bootloader which can only |
11 |
load wrap initramfs. |
12 |
|
13 |
Signed-off-by: Christoph Junghans <ottxor <AT> gentoo.org> |
14 |
|
15 |
--- |
16 |
doc/genkernel.8.txt | 5 +++++ |
17 |
gen_cmdline.sh | 6 ++++++ |
18 |
gen_determineargs.sh | 1 + |
19 |
gen_initramfs.sh | 10 ++++++++++ |
20 |
genkernel.conf | 2 ++ |
21 |
5 files changed, 24 insertions(+) |
22 |
|
23 |
diff --git a/doc/genkernel.8.txt b/doc/genkernel.8.txt |
24 |
index b36b78d..f8d7a10 100644 |
25 |
--- a/doc/genkernel.8.txt |
26 |
+++ b/doc/genkernel.8.txt |
27 |
@@ -376,6 +376,11 @@ OUTPUT SETTINGS |
28 |
Builds or does not build the generated initramfs into the kernel instead |
29 |
of keeping it as a separate file. |
30 |
|
31 |
+*--*[*no-*]*wrap-initrd*:: |
32 |
+ Wrap initramfs using mkimage for u-boot boots. Please note that only |
33 |
+ certain compression types are supported by mkimage (see manpage). |
34 |
+ |
35 |
+ |
36 |
*--*[*no-*]*compress-initramfs*, *--*[*no-*]*compress-initrd*:: |
37 |
Compresses or does not compress the generated initramfs. |
38 |
|
39 |
|
40 |
diff --git a/gen_cmdline.sh b/gen_cmdline.sh |
41 |
index 6ef6ae0..baa58fa 100755 |
42 |
--- a/gen_cmdline.sh |
43 |
+++ b/gen_cmdline.sh |
44 |
@@ -158,6 +158,8 @@ longusage() { |
45 |
echo " --integrated-initramfs, --no-integrated-initramfs" |
46 |
echo " Include/exclude the generated initramfs in the kernel" |
47 |
echo " instead of keeping it as a separate file" |
48 |
+ echo " --wrap-initrd, --no-wrap-initrd" |
49 |
+ echo " Wrap initramfs using mkimage for u-boot boots" |
50 |
echo " --compress-initramfs, --no-compress-initramfs," |
51 |
echo " --compress-initrd, --no-compress-initrd" |
52 |
echo " Compress or do not compress the generated initramfs" |
53 |
@@ -575,6 +577,10 @@ parse_cmdline() { |
54 |
CMD_INTEGRATED_INITRAMFS=`parse_optbool "$*"` |
55 |
print_info 2 "CMD_INTEGRATED_INITRAMFS=${CMD_INTEGRATED_INITRAMFS}" |
56 |
;; |
57 |
+ --wrap-initrd|--no-wrap-initrd) |
58 |
+ CMD_WRAP_INITRD=`parse_optbool "$*"` |
59 |
+ print_info 2 "CMD_WRAP_INITRD=${CMD_WRAP_INITRD}" |
60 |
+ ;; |
61 |
--compress-initramfs|--no-compress-initramfs|--compress-initrd|--no-compress-initrd) |
62 |
CMD_COMPRESS_INITRD=`parse_optbool "$*"` |
63 |
print_info 2 "CMD_COMPRESS_INITRD=${CMD_COMPRESS_INITRD}" |
64 |
|
65 |
diff --git a/gen_determineargs.sh b/gen_determineargs.sh |
66 |
index dc6b2c4..59af78b 100755 |
67 |
--- a/gen_determineargs.sh |
68 |
+++ b/gen_determineargs.sh |
69 |
@@ -131,6 +131,7 @@ determine_real_args() { |
70 |
set_config_with_override STRING FIRMWARE_DIR CMD_FIRMWARE_DIR "/lib/firmware" |
71 |
set_config_with_override STRING FIRMWARE_FILES CMD_FIRMWARE_FILES |
72 |
set_config_with_override BOOL INTEGRATED_INITRAMFS CMD_INTEGRATED_INITRAMFS |
73 |
+ set_config_with_override BOOL WRAP_INITRD CMD_WRAP_INITRD |
74 |
set_config_with_override BOOL GENZIMAGE CMD_GENZIMAGE |
75 |
set_config_with_override BOOL KEYMAP CMD_KEYMAP "yes" |
76 |
set_config_with_override BOOL DOKEYMAPAUTO CMD_DOKEYMAPAUTO |
77 |
|
78 |
diff --git a/gen_initramfs.sh b/gen_initramfs.sh |
79 |
index b9ff518..254f21a 100755 |
80 |
--- a/gen_initramfs.sh |
81 |
+++ b/gen_initramfs.sh |
82 |
@@ -958,6 +958,16 @@ create_initramfs() { |
83 |
print_info 1 " >> Not compressing cpio data ..." |
84 |
fi |
85 |
fi |
86 |
+ if isTrue "${WRAP_INITRD}" |
87 |
+ then |
88 |
+ local mkimage_cmd=$(type -p mkimage) |
89 |
+ [[ -z ${mkimage_cmd} ]] && gen_die "mkimage is not available. Please install package 'dev-embedded/u-boot-tools'." |
90 |
+ local mkimage_args="-A ${ARCH} -O linux -T ramdisk -C ${compression:-none} -a 0x00000000 -e 0x00000000" |
91 |
+ print_info 1 " >> Wrapping initramfs using mkimage..." |
92 |
+ print_info 2 "${mkimage_cmd} ${mkimage_args} -n initramfs-${KV} -d ${CPIO} ${CPIO}.uboot" |
93 |
+ ${mkimage_cmd} ${mkimage_args} -n "initramfs-${KV}" -d "${CPIO}" "${CPIO}.uboot" >> ${LOGFILE} 2>&1 || gen_die "Wrapping initramfs using mkimage failed" |
94 |
+ mv -f "${CPIO}.uboot" "${CPIO}" || gen_die "Rename failed" |
95 |
+ fi |
96 |
fi |
97 |
|
98 |
if isTrue "${CMD_INSTALL}" |
99 |
|
100 |
diff --git a/genkernel.conf b/genkernel.conf |
101 |
index 0c3955c..7f42b05 100644 |
102 |
--- a/genkernel.conf |
103 |
+++ b/genkernel.conf |
104 |
@@ -296,6 +296,8 @@ DEFAULT_KERNEL_SOURCE="/usr/src/linux" |
105 |
# "fastest" selects the fastest available compression method |
106 |
#COMPRESS_INITRD_TYPE="best" |
107 |
|
108 |
+# wrap initramfs using mkimage for u-boot bootloader |
109 |
+# WRAP_INITRD=no |
110 |
|
111 |
# Create a self-contained env in the initramfs |
112 |
#NETBOOT="1" |