diff options
author | osm0sis <osm0sis@outlook.com> | 2018-01-13 17:15:51 -0400 |
---|---|---|
committer | osm0sis <osm0sis@outlook.com> | 2018-01-13 17:15:51 -0400 |
commit | fb44ff18e1c2cc5cc0c77c0cb38dd50062086e3e (patch) | |
tree | 9a07d437dc4cff499b4c52db0ca73e28c440c0e1 /tools/ak2-core.sh | |
parent | 4e31cbd4617755ff896e3241c9e27f9883927c2b (diff) |
AK2: add support for repacking as Sony ELF
- add built-in support for elftool for older Sony devices which don't support AOSP boot.img repacks (see: #3, https://forum.xda-developers.com/xperia-j-e/development/arm-elftool-pack-unpack-boot-image-sony-t2146022)
Diffstat (limited to 'tools/ak2-core.sh')
-rwxr-xr-x | tools/ak2-core.sh | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/tools/ak2-core.sh b/tools/ak2-core.sh index 8bf392a..fba38d7 100755 --- a/tools/ak2-core.sh +++ b/tools/ak2-core.sh @@ -32,6 +32,11 @@ split_boot() { 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 + if [ -f "$bin/elftool" ]; then + mkdir $split_img/elftool_out; + $bin/elftool unpack -i /tmp/anykernel/boot.img -o $split_img/elftool_out; + cp -f $split_img/elftool_out/header $split_img/boot.img-header; + fi; $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; elif [ -f "$bin/dumpimage" ]; then @@ -197,12 +202,14 @@ flash_boot() { for i in dtb dt.img; do if [ -f /tmp/anykernel/$i ]; then dtb="--dt /tmp/anykernel/$i"; + rpm="/tmp/anykernel/$i,rpm"; break; fi; done; if [ ! "$dtb" -a -f *-dtb ]; then dtb=`ls *-dtb`; dtb="--dt $split_img/$dtb"; + rpm="$split_img/$dtb,rpm"; fi; cd /tmp/anykernel; if [ -f "$bin/mkmtkhdr" ]; then @@ -213,6 +220,8 @@ flash_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:$rd boot-new.img; + elif [ -f "$bin/elftool" ]; then + $bin/elftool pack -o boot-new.img header=$split_img/boot.img-header $kernel $rd,ramdisk $rpm $split_img/boot.img-cmdline@cmdline; elif [ -f "$bin/rkcrc" ]; then $bin/rkcrc -k $rd boot-new.img; elif [ -f "$bin/pxa-mkbootimg" ]; then |