diff --git a/defaults/linuxrc b/defaults/linuxrc index 2f94eb46..b558450e 100644 --- a/defaults/linuxrc +++ b/defaults/linuxrc @@ -55,6 +55,7 @@ run busybox --install -s CMDLINE=$(cat /proc/cmdline 2>/dev/null) for x in ${CMDLINE} do + x=${x//\"/} case "${x}" in real_root=*) REAL_ROOT=${x#*=} diff --git a/gen_cmdline.sh b/gen_cmdline.sh index 0cba7d15..2e55523b 100755 --- a/gen_cmdline.sh +++ b/gen_cmdline.sh @@ -174,6 +174,9 @@ longusage() { echo " --bootloader=(grub|grub2)" echo " Add new kernel to GRUB (grub) or GRUB2 (grub2) bootloader" echo " --no-bootloader Skip bootloader update" + echo " --bootconfig=(|none)" + echo " Append a kernel bootconfig data to initramfs" + echo " --no-bootconfig No append the kernel bootconfig to initramfs" echo " --linuxrc= Specifies a user created linuxrc" echo " --busybox-config= Specifies a user created busybox config" echo " --genzimage Make and install kernelz image (PowerPC)" @@ -540,6 +543,16 @@ parse_cmdline() { CMD_BOOTLOADER="no" print_info 3 "CMD_BOOTLOADER: ${CMD_BOOTLOADER}" ;; + --bootconfig=*) + CMD_BOOTCONFIG="yes" + BOOTCONFIG_FILE="${*#*=}" + [ -z "${BOOTCONFIG_FILE}" ] && CMD_BOOTCONFIG="no" + print_info 3 "CMD_BOOTCONFIG: ${BOOTCONFIG_FILE}" + ;; + --no-bootconfig) + CMD_BOOTCONFIG="no" + print_info 3 "CMD_BOOTCONFIG=${CMD_BOOTCONFIG}" + ;; --iscsi|--no-iscsi) CMD_ISCSI=$(parse_optbool "$*") print_info 3 "CMD_ISCSI: ${CMD_ISCSI}" diff --git a/gen_determineargs.sh b/gen_determineargs.sh index ef69414e..9b63fa95 100755 --- a/gen_determineargs.sh +++ b/gen_determineargs.sh @@ -422,6 +422,7 @@ determine_real_args() { set_config_with_override BOOL HYPERV CMD_HYPERV "no" set_config_with_override STRING BOOTFONT CMD_BOOTFONT "none" set_config_with_override STRING BOOTLOADER CMD_BOOTLOADER "no" + set_config_with_override BOOL BOOTCONFIG CMD_BOOTCONFIG "no" set_config_with_override BOOL B2SUM CMD_B2SUM "no" set_config_with_override BOOL BUSYBOX CMD_BUSYBOX "yes" set_config_with_override STRING BUSYBOX_CONFIG CMD_BUSYBOX_CONFIG @@ -770,6 +771,18 @@ determine_real_args() { ;; esac + if isTrue "${BOOTCONFIG}" + then + BOOTCONFIG_FILE=$(expand_file "${BOOTCONFIG_FILE}") + if [ -z "${BOOTCONFIG_FILE}" ] + then + gen_die "--bootconfig value '${BOOTCONFIG_FILE}' failed to expand!" + elif [ ! -e "${BOOTCONFIG_FILE}" ] + then + gen_die "--bootconfig file '${BOOTCONFIG_FILE}' does not exist!" + fi + fi + if isTrue "${KERNEL_SOURCES}" then if [ ! -d "${KERNEL_DIR}" ] diff --git a/gen_initramfs.sh b/gen_initramfs.sh index 227badd5..a882f4f1 100755 --- a/gen_initramfs.sh +++ b/gen_initramfs.sh @@ -2311,6 +2311,16 @@ create_initramfs() { ${mkimage_cmd} ${mkimage_args} -n "${GK_FILENAME_TEMP_INITRAMFS}" -d "${CPIO_ARCHIVE}" "${CPIO_ARCHIVE}.uboot" >> ${LOGFILE} 2>&1 || gen_die "Wrapping initramfs using mkimage failed" mv -f "${CPIO_ARCHIVE}.uboot" "${CPIO_ARCHIVE}" || gen_die "Rename failed" fi + + if isTrue "${BOOTCONFIG}" + then + local bootconfig_cmd=$(type -p bootconfig) + [[ -z ${bootconfig_cmd} ]] && gen_die "bootconfig is not available. Please install package 'dev-util/bootconfig'." + local bootconfig_args="-a ${BOOTCONFIG_FILE}" + print_info 1 "$(get_indent 1)>> Appending bootconfig data ..." + print_info 2 "$(get_indent 1)${bootconfig_cmd} ${bootconfig_args} ${CPIO_ARCHIVE}" + ${bootconfig_cmd} ${bootconfig_args} "${CPIO_ARCHIVE}" >> ${LOGFILE} 2>&1 || gen_die "Appending bootconfig data failed" + fi fi if isTrue "${CMD_INSTALL}" diff --git a/genkernel.conf b/genkernel.conf index 7045e187..ff66c9c3 100644 --- a/genkernel.conf +++ b/genkernel.conf @@ -169,6 +169,9 @@ NOCOLOR="false" # Add boot splash using splashutils #SPLASH="no" +# Append a bootconfig to the initramfs +#BOOTCONFIG="no" + # Use this splash theme. If commented out - the "default" name theme is used. # Also, SPLASH="yes" needs to be enabled for this one to work. # This supersedes the "SPLASH_THEME" option in '/etc/conf.d/splash'.