From 6fedeb5dc4b34ca756ebc64b8bc82a4ef38ea5aa Mon Sep 17 00:00:00 2001 From: osm0sis Date: Sat, 22 Apr 2017 08:59:52 -0300 Subject: [PATCH] AK2: introduce cmdline patching function, misc cleanup - use proper variable for ramdisk in mkbootfs support patch_cmdline: - if match not present, appends to the end of the current commandline - if match is present, expands to full string (to allow for item=value entries), and optionally replaces with a second string, or just removes the entry, then cleans up doublespaces and trailing whitespace --- tools/ak2-core.sh | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/tools/ak2-core.sh b/tools/ak2-core.sh index 4e0dd27..cc8972c 100755 --- a/tools/ak2-core.sh +++ b/tools/ak2-core.sh @@ -116,7 +116,7 @@ write_boot() { dtb="--dt $split_img/$dtb"; fi; if [ -f "$bin/mkbootfs" ]; then - $bin/mkbootfs /tmp/anykernel/ramdisk | gzip > /tmp/anykernel/ramdisk-new.cpio.gz; + $bin/mkbootfs $ramdisk | gzip > /tmp/anykernel/ramdisk-new.cpio.gz; else cd $ramdisk; find . | cpio -H newc -o | gzip > /tmp/anykernel/ramdisk-new.cpio.gz; @@ -280,5 +280,17 @@ patch_fstab() { fi; } +# patch_cmdline [] +patch_cmdline() { + cmdfile=`ls $split_img/*-cmdline`; + if [ -z "$(grep "$1" $cmdfile)" ]; then + cmdtmp=`cat $cmdfile`; + echo "$cmdtmp $1" > $cmdfile; + else + match=$(grep -o "$1.*$" $cmdfile | cut -d\ -f1); + sed -i -e "s;${match};${2};" -e 's; ; ;' -e 's;[ \t]*$;;' $cmdfile; + fi; +} + ## end methods