ensure that the added kernel argument is passed to the boot image kernel as
[bootcd.git] / build.sh
index afe0190..0535962 100755 (executable)
--- a/build.sh
+++ b/build.sh
@@ -28,6 +28,7 @@ OUTPUT_BASE=
 DRY_RUN=""
 OUTPUT_NAME=""
 TYPES=""
+KARGS_STR=""
 
 # various globals
 BUILDTMP=""
@@ -40,6 +41,7 @@ console_dev=""
 console_baud=""
 console_spec=""
 console_serial_line=""
+kernel_args=""
 
 
 #################### compute all supported types
@@ -140,6 +142,7 @@ usage() {
     echo "    -o output-name   The full name of the generated file"
     echo "    -C custom-dir    Custom directory"
     echo "    -n               Dry run - mostly for debug/test purposes"
+    echo "    -k               Add additional parameters to the kargs.txt file"
     echo "    -h               This message"
     echo "All known types: $ALL_TYPES"
     exit 1
@@ -151,7 +154,7 @@ function parse_command_line () {
     # init
     TYPES=""
     # Get options
-    while getopts "f:t:as:SO:o:C:nh" opt ; do
+    while getopts "f:t:as:SO:o:C:k:nh" opt ; do
        case $opt in
            f) NODE_CONFIGURATION_FILE=$OPTARG ;;
            t) TYPES="$TYPES $OPTARG" ;;
@@ -161,6 +164,7 @@ function parse_command_line () {
            O) OUTPUT_BASE="$OPTARG" ;;
            o) OUTPUT_NAME="$OPTARG" ;;
            C) CUSTOM_DIR="$OPTARG" ;;
+           k) KARGS_STR="$OPTARG" ;;
            n) DRY_RUN=true ;;
            h|*) usage ;;
        esac
@@ -313,7 +317,12 @@ EOF
     fi
 
     if [ -n "$IS_SERIAL" ] ; then
-       echo "${console_spec}" > $OVERLAY/kargs.txt
+       KARGS_STR="$KARGS_STR ${console_spec}"
+    fi
+
+    if [ -n "$KARGS_STR" ] ; then
+       echo "$KARGS_STR" > $OVERLAY/kargs.txt
+       kernel_args=$KARGS_STR
     fi
 
     # Pack overlay files into a compressed archive
@@ -346,7 +355,7 @@ function build_iso() {
     cat >$ISOFS/isolinux.cfg <<EOF
 ${console_serial_line}
 DEFAULT kernel
-APPEND ramdisk_size=$ramdisk_size initrd=bootcd.img,overlay.img${custom:+,custom.img} root=/dev/ram0 rw ${console_spec}
+APPEND ramdisk_size=$ramdisk_size initrd=bootcd.img,overlay.img${custom:+,custom.img} root=/dev/ram0 rw ${kernel_args}
 DISPLAY pl_version
 PROMPT 0
 TIMEOUT 40
@@ -396,7 +405,7 @@ EOF
     cat >$tmp <<EOF
 ${console_serial_line}
 DEFAULT kernel
-APPEND ramdisk_size=$ramdisk_size initrd=bootcd.img,overlay.img${custom:+,custom.img} root=/dev/ram0 rw ${console_spec}
+APPEND ramdisk_size=$ramdisk_size initrd=bootcd.img,overlay.img${custom:+,custom.img} root=/dev/ram0 rw ${kernel_args}
 DISPLAY pl_version
 PROMPT 0
 TIMEOUT 40
@@ -429,7 +438,7 @@ function build_usb() {
     cat >$tmp <<EOF
 ${console_serial_line}
 DEFAULT kernel
-APPEND ramdisk_size=$ramdisk_size initrd=bootcd.img,overlay.img${custom:+,custom.img} root=/dev/ram0 rw ${console_spec}
+APPEND ramdisk_size=$ramdisk_size initrd=bootcd.img,overlay.img${custom:+,custom.img} root=/dev/ram0 rw ${kernel_args}
 DISPLAY pl_version
 PROMPT 0
 TIMEOUT 40
@@ -586,7 +595,7 @@ function build_iso_cramfs() {
     cat >$tmp/isolinux.cfg <<EOF
 ${console_serial_line}
 DEFAULT kernel
-APPEND ramdisk_size=$cramfs_size initrd=cramfs.img root=/dev/ram0 ro ${console_spec}
+APPEND ramdisk_size=$cramfs_size initrd=cramfs.img root=/dev/ram0 ro ${kernel_args}
 DISPLAY pl_version
 PROMPT 0
 TIMEOUT 40
@@ -624,7 +633,7 @@ function build_usb_cramfs() {
     cat >$tmp <<EOF
 ${console_serial_line}
 DEFAULT kernel
-APPEND ramdisk_size=$cramfs_size initrd=cramfs.img root=/dev/ram0 ro ${console_spec}
+APPEND ramdisk_size=$cramfs_size initrd=cramfs.img root=/dev/ram0 ro ${kernel_args}
 DISPLAY pl_version
 PROMPT 0
 TIMEOUT 40