Razer Forge TV: Scripts to unpack and re-pack a boot.img file

raw

README.rst

See https://cweiske.de/tagebuch/forge-bootimg.htm

In comparison to other Android devices, cpio cannot be used to pack the files.

raw

howto.sh

1
2
3
4
5
6
7
8
9
10
11
12
mkdir m-144
cd m-144
unzip ../image-forge-m-144.zip
../unpack-boot.img.sh
 
# modify default.prop
../repack-boot.img.sh
 
# disconnect HDMI cable from Forge TV and connect power to get into fastboot mode
fastboot flash boot my-boot.img
# connect HDMI cable to Forge TV
fastboot reboot
raw

repack-boot.img.sh

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#!/bin/sh
# Generate a boot.img for the Razer Forge TV from an unpacked one
set -e
 
bootimgfile=${1:-my-boot.img}
outdir=${2:-mybootimg}
 
cd "$outdir/ramdisk"
find \
    | grep -v '^.$'\
    | sort\
    | pax -w -x sv4cpio -M mtime -M uidgid -s '#^./##' -d -f ../myinitrd.cpio
 
cd ..
cat myinitrd.cpio | gzip > myinitrd.img
 
cd ..
 
echo "Generating new boot image: $bootimgfile"
../mkbootimg.py\
    --kernel "$outdir/zImage"\
    --ramdisk "$outdir/myinitrd.img"\
    --cmdline "console=ttyHSL0,115200,n8 androidboot.console=ttyHSL0 androidboot.hardware=qcom user_debug=31 msm_rtb.filter=0x3b7 dwc3_msm.cpu_to_affin=1"\
    --pagesize 0x1000\
    --kernel_offset 0x8000\
    --ramdisk_offset 0x1000000\
    --tags_offset 0x100\
    -o "$bootimgfile"
 
raw

unpack-boot.img.sh

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#!/bin/sh
# Unpack a Razer Forge TV boot.img file so we can modify default.prop
set -e
 
bootimgfile=${1:-boot.img}
outdir=${2:-mybootimg}
 
if [ -d "$outdir" ]; then
    rm -rf "$outdir"
fi
 
echo "Unpacking $bootimgfile into $outdir"
mkdir "$outdir"
cd "$outdir"
abootimg -x "../$bootimgfile"
 
echo "Unpacking initrd.img into ramdisk/"
abootimg-unpack-initrd initrd.img ramdisk
 
Christian Weiske Christian Weiske
owner

History