Intenso TAB744/prep.sh


 * 1) for *bootimg, *ramdisk tools see e.g. xda-developers.com
 * 2) clone pctools/linux/mod_update (alternative), sunxi-tools for update* tools

Usage: ./prep.sh [ pack | unpack ] [ fw.img | fw.img.dump ]

IR=TWRP/image.repacker/imgrepacker
 * 1) !/bin/bash

function unpack { $IR "$1" cd "$1.dump"

mv -f home/imgrepacker/*. sed -i -e 's/home.imgrepacker.//' image.cfg sed -i -e 's/.home.imgrepacker.//' _*/*txt

rm Vdiskfs.fex for f in image.cfg _img.files/Filelist.txt do sed -i -e '/Vdiskfs.fex/d' $f done f=sys_partition.fex b=${f/.fex/.bin} sed -i -e '/diskfs.fex/,$ s/;\(verify *= *0\)/\1/' $f unix2dos $f ../mod_update/script $f # fex2bin $f $b ../mod_update/update_mbr $b 4

../simg2img/simg2img system.fex system.bin mkdir -p s sudo mount -o loop system.bin s

../mod_bootimg/umkbootimg boot.fex ../mod_bootimg/unpack_ramdisk initramfs.cpio.gz }

function pack { IMG="${1%/}" IMG="${IMG##*/}" IMG="${IMG%.dump}" cd $IMG.dump &>/dev/null

if -f zImage then -d ramdisk/ && ../mod_bootimg/repack_ramdisk ramdisk/ ../mod_bootimg/mkbootimg --kernel zImage --ramdisk \ new-ramdisk.cpio.gz --base 0x40000000 -o boot.fex \ && rm -rf ramdisk/ zImage *ram*cpio.gz fi

if -f system.bin then -d s/ && -f s/build.prop && sudo umount s    rm -rf system.fex s    ../make_ext4fs/ext2simg system.bin system.fex \ && rm -rf system.bin fi

../awtools/bins/FileAddSum boot.fex Vboot.fex ../awtools/bins/FileAddSum system.fex Vsystem.fex

../sunxi-tools/fex2bin sys_config.fex config.fex ../mod_update/update_fes1 fes1.fex config.fex ../mod_update/update_boot0 boot0_nand.fex config.fex NAND ../mod_update/update_boot0 boot0_sdcard.fex config.fex SDMMC_CARD ../mod_update/update_uboot u-boot.fex config.fex

cd .. rm "$IMG"

$IR $IMG.dump #rm -rvf $IMG.dump }

function remove { sudo umount $1/s rm -rvf ${1##/} }

$1 "$2"