diff options
author | osm0sis <osm0sis@outlook.com> | 2017-09-11 12:10:14 -0300 |
---|---|---|
committer | osm0sis <osm0sis@outlook.com> | 2017-09-11 12:10:14 -0300 |
commit | 66b221ef990558b4e4d8b088a842b229fd02842d (patch) | |
tree | ade1754653a3530fe7050b507f1f2bf53e7d5491 | |
parent | c867216f9178e36382760b37f70b730bdb0e26f8 (diff) |
AK2: add KRNL and NOOK signed image support
- add built-in support for rkcrc for Rockchip board devices signed ramdisk image (see: https://github.com/rockchip-linux/rkflashtool)
- add built-in detection and support for Barnes & Noble Nook 'Green Loader/Green Recovery' signature
-rwxr-xr-x | tools/ak2-core.sh | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/tools/ak2-core.sh b/tools/ak2-core.sh index 5c4cdd9..e6291b6 100755 --- a/tools/ak2-core.sh +++ b/tools/ak2-core.sh @@ -35,6 +35,11 @@ dump_boot() { else dd if=$block of=/tmp/anykernel/boot.img; fi; + if [ "$(strings /tmp/anykernel/boot.img | grep -E 'Green Loader|Green Recovery')" ]; then + mv -f /tmp/anykernel/boot.img /tmp/anykernel/boot-orig.img; + dd bs=1048576 count=1 conv=notrunc if=/tmp/anykernel/boot-orig.img of=$split_img/boot.img-master_boot.key; + dd bs=1048576 skip=1 conv=notrunc if=/tmp/anykernel/boot-orig.img of=/tmp/anykernel/boot.img; + fi; if [ -f "$bin/unpackelf" -a "$($bin/unpackelf -i /tmp/anykernel/boot.img -h -q 2>/dev/null; echo $?)" == 0 ]; then $bin/unpackelf -i /tmp/anykernel/boot.img -o $split_img; mv -f $split_img/boot.img-ramdisk.cpio.gz $split_img/boot.img-ramdisk.gz; @@ -55,6 +60,8 @@ dump_boot() { else dumpfail=1; fi; + elif [ -f "$bin/rkcrc" ]; then + dd bs=4096 skip=8 iflag=skip_bytes conv=notrunc if=/tmp/anykernel/boot.img of=$split_img/boot.img-ramdisk.gz; elif [ -f "$bin/pxa-unpackbootimg" ]; then $bin/pxa-unpackbootimg -i /tmp/anykernel/boot.img -o $split_img; else @@ -173,6 +180,8 @@ write_boot() { fi; if [ -f "$bin/mkimage" ]; then $bin/mkimage -A $arch -O $os -T $type -C $comp -a $addr -e $ep -n "$name" -d $kernel:$ramdisk boot-new.img; + elif [ -f "$bin/rkcrc" ]; then + $bin/rkcrc -k ramdisk-new.cpio.gz boot-new.img; elif [ -f "$bin/pxa-mkbootimg" ]; then $bin/pxa-mkbootimg --kernel $kernel --ramdisk ramdisk-new.cpio.gz $second --cmdline "$cmdline" --board "$board" --base $base --pagesize $pagesize --kernel_offset $kerneloff --ramdisk_offset $ramdiskoff $secondoff --tags_offset "$tagsoff" --unknown $unknown $dtb --output boot-new.img; else @@ -232,6 +241,10 @@ write_boot() { $bin/dhtbsign -i boot-new.img -o boot-new-signed.img; mv -f boot-new-signed.img boot-new.img; fi; + if [ -f "$split_img/boot.img-master_boot.key" ]; then + cat $split_img/boot.img-master_boot.key boot-new.img > boot-new-signed.img; + mv -f boot-new-signed.img boot-new.img; + fi; if [ -f "$bin/flash_erase" -a -f "$bin/nandwrite" ]; then $bin/flash_erase $block 0 0; $bin/nandwrite -p $block /tmp/anykernel/boot-new.img; |