commit: c13e972b79864db27742fd9cdbd96be27d4f3462
Author: Christoph Junghans <ottxor <AT> gentoo <DOT> org>
AuthorDate: Sun Jan 18 00:57:55 2015 +0000
Commit: Christoph Junghans <ottxor <AT> gentoo <DOT> org>
CommitDate: Sun Jan 18 16:57:18 2015 +0000
URL:
http://sources.gentoo.org/gitweb/?p=proj/genkernel.git;a=commit;h=c13e972b
Added --wrap-initrd option
This is useful in combination the u-boot bootloader which can only
load wrap initramfs.
Signed-off-by: Christoph Junghans <ottxor <AT> gentoo.org>
---
doc/genkernel.8.txt | 5 +++++
gen_cmdline.sh | 6 ++++++
gen_determineargs.sh | 1 +
gen_initramfs.sh | 10 ++++++++++
genkernel.conf | 2 ++
5 files changed, 24 insertions(+)
diff --git a/doc/genkernel.8.txt b/doc/genkernel.8.txt
index b36b78d..f8d7a10 100644
--- a/doc/genkernel.8.txt
+++ b/doc/genkernel.8.txt
@@ -376,6 +376,11 @@ OUTPUT SETTINGS
Builds or does not build the generated initramfs into the kernel instead
of keeping it as a separate file.
+*--*[*no-*]*wrap-initrd*::
+ Wrap initramfs using mkimage for u-boot boots. Please note that only
+ certain compression types are supported by mkimage (see manpage).
+
+
*--*[*no-*]*compress-initramfs*, *--*[*no-*]*compress-initrd*::
Compresses or does not compress the generated initramfs.
diff --git a/gen_cmdline.sh b/gen_cmdline.sh
index 6ef6ae0..baa58fa 100755
--- a/gen_cmdline.sh
+++ b/gen_cmdline.sh
@@ -158,6 +158,8 @@ longusage() {
echo " --integrated-initramfs, --no-integrated-initramfs"
echo " Include/exclude the generated initramfs
in the kernel"
echo " instead of keeping it as a separate
file"
+ echo " --wrap-initrd, --no-wrap-initrd"
+ echo " Wrap initramfs using mkimage for u-boot
boots"
echo " --compress-initramfs, --no-compress-initramfs,"
echo " --compress-initrd, --no-compress-initrd"
echo " Compress or do not compress the
generated initramfs"
@@ -575,6 +577,10 @@ parse_cmdline() {
CMD_INTEGRATED_INITRAMFS=`parse_optbool "$*"`
print_info 2
"CMD_INTEGRATED_INITRAMFS=${CMD_INTEGRATED_INITRAMFS}"
;;
+ --wrap-initrd|--no-wrap-initrd)
+ CMD_WRAP_INITRD=`parse_optbool "$*"`
+ print_info 2 "CMD_WRAP_INITRD=${CMD_WRAP_INITRD}"
+ ;;
--compress-initramfs|--no-compress-initramfs|--compress-initrd|--no-compress-initrd)
CMD_COMPRESS_INITRD=`parse_optbool "$*"`
print_info 2
"CMD_COMPRESS_INITRD=${CMD_COMPRESS_INITRD}"
diff --git a/gen_determineargs.sh b/gen_determineargs.sh
index dc6b2c4..59af78b 100755
--- a/gen_determineargs.sh
+++ b/gen_determineargs.sh
@@ -131,6 +131,7 @@ determine_real_args() {
set_config_with_override STRING FIRMWARE_DIR CMD_FIRMWARE_DIR
"/lib/firmware"
set_config_with_override STRING FIRMWARE_FILES CMD_FIRMWARE_FILES
set_config_with_override BOOL INTEGRATED_INITRAMFS
CMD_INTEGRATED_INITRAMFS
+ set_config_with_override BOOL WRAP_INITRD CMD_WRAP_INITRD
set_config_with_override BOOL GENZIMAGE CMD_GENZIMAGE
set_config_with_override BOOL KEYMAP CMD_KEYMAP
"yes"
set_config_with_override BOOL DOKEYMAPAUTO CMD_DOKEYMAPAUTO
diff --git a/gen_initramfs.sh b/gen_initramfs.sh
index b9ff518..254f21a 100755
--- a/gen_initramfs.sh
+++ b/gen_initramfs.sh
@@ -958,6 +958,16 @@ create_initramfs() {
print_info 1 " >> Not compressing cpio
data ..."
fi
fi
+ if isTrue "${WRAP_INITRD}"
+ then
+ local mkimage_cmd=$(type -p mkimage)
+ [[ -z ${mkimage_cmd} ]] && gen_die "mkimage is not
available. Please install package 'dev-embedded/u-boot-tools'."
+ local mkimage_args="-A ${ARCH} -O linux -T ramdisk -C
${compression:-none} -a 0x00000000 -e 0x00000000"
+ print_info 1 " >> Wrapping initramfs using
mkimage..."
+ print_info 2 "${mkimage_cmd} ${mkimage_args} -n
initramfs-${KV} -d ${CPIO} ${CPIO}.uboot"
+ ${mkimage_cmd} ${mkimage_args} -n "initramfs-${KV}" -d
"${CPIO}" "${CPIO}.uboot" >> ${LOGFILE} 2>&1 || gen_die "Wrapping initramfs
using mkimage failed"
+ mv -f "${CPIO}.uboot" "${CPIO}" || gen_die "Rename
failed"
+ fi
fi
if isTrue "${CMD_INSTALL}"
diff --git a/genkernel.conf b/genkernel.conf
index 0c3955c..7f42b05 100644
--- a/genkernel.conf
+++ b/genkernel.conf
@@ -296,6 +296,8 @@ DEFAULT_KERNEL_SOURCE="/usr/src/linux"
# "fastest" selects the fastest available compression method
#COMPRESS_INITRD_TYPE="best"
+# wrap initramfs using mkimage for u-boot bootloader
+# WRAP_INITRD=no
# Create a self-contained env in the initramfs
#NETBOOT="1"