public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Christoph Junghans" <ottxor@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/genkernel:master commit in: /, doc/
Date: Sun,  8 Feb 2015 21:39:57 +0000 (UTC)	[thread overview]
Message-ID: <1421600238.c13e972b79864db27742fd9cdbd96be27d4f3462.ottxor@gentoo> (raw)

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"


             reply	other threads:[~2015-02-08 21:40 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-02-08 21:39 Christoph Junghans [this message]
  -- strict thread matches above, loose matches on Subject: below --
2024-01-19 20:11 [gentoo-commits] proj/genkernel:master commit in: /, doc/ Ben Kohler
2021-09-13  5:08 Matt Turner
2021-03-15 20:02 Thomas Deutschmann
2020-05-24 22:27 Thomas Deutschmann
2019-12-05 23:52 Thomas Deutschmann
2019-07-29 20:10 Thomas Deutschmann
2019-07-29 20:10 Thomas Deutschmann
2019-07-23 19:47 Thomas Deutschmann
2017-11-15  3:08 Robin H. Johnson
2017-07-14 18:50 Robin H. Johnson
2016-10-12 13:52 Robin H. Johnson
2016-01-24  5:50 Robin H. Johnson
2012-10-16  0:01 Robin H. Johnson
2012-10-13 23:31 Robin H. Johnson
2012-09-30 19:28 Sebastian Pipping
2012-07-17 20:05 Richard Yao
2012-07-16  2:08 Robin H. Johnson
2012-02-06  9:42 Robin H. Johnson
2011-07-31  3:47 Sebastian Pipping
2011-06-07 19:14 Sebastian Pipping
2011-06-07  0:29 Sebastian Pipping
2011-05-31  1:48 Sebastian Pipping

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1421600238.c13e972b79864db27742fd9cdbd96be27d4f3462.ottxor@gentoo \
    --to=ottxor@gentoo.org \
    --cc=gentoo-commits@lists.gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox