From f2f50c90188187a7ecd66b8b94131c6dd3ddedf4 Mon Sep 17 00:00:00 2001 From: Shaka Huang Date: Tue, 14 Jul 2015 20:02:42 +0800 Subject: [PATCH] Add helper script Signed-off-by: Shaka Huang --- bin/extract_boot.sh | 4 ++++ bin/pack_boot.sh | 23 +++++++++++++++++++++++ 2 files changed, 27 insertions(+) create mode 100755 bin/extract_boot.sh create mode 100755 bin/pack_boot.sh diff --git a/bin/extract_boot.sh b/bin/extract_boot.sh new file mode 100755 index 0000000..4ae3abf --- /dev/null +++ b/bin/extract_boot.sh @@ -0,0 +1,4 @@ +#!/bin/bash + +./unpackbootimg -i boot.img -o boot + diff --git a/bin/pack_boot.sh b/bin/pack_boot.sh new file mode 100755 index 0000000..db7d12b --- /dev/null +++ b/bin/pack_boot.sh @@ -0,0 +1,23 @@ +#!/bin/bash + +if [ -f boot.img ]; then + rm boot.img +fi + +if [ -d boot/ramdisk ]; then + cd boot + rm -f ramdisk.* + find . -name "*~" -exec rm -f {} \; + + if [ "$(uname)" == "Darwin" ]; then + mkbootfs ramdisk | gzip > ramdisk.cpio.gz + else + cd ramdisk + find | fakeroot cpio -H newc -o 2>/dev/null >../ramdisk.cpio + cd .. + gzip -n -9 ramdisk.cpio + fi + cd .. +fi + +./mkbootimg --kernel boot/zImage --ramdisk boot/ramdisk.cpio.gz --second boot/second.bin --cmdline "$(cat boot/cmdline)" -o boot.img