Last active
August 14, 2024 02:56
-
-
Save shauninman/5093e881dbe026d19e19d4b559f99faf to your computer and use it in GitHub Desktop.
updating h700 device dtb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| HOST for me is macOS | |
| DOCKER for me a debian:bookworm-slim docker image with device-tree-compiler installed (among other things) | |
| these offsets and values are specific to the 40xxH | |
| /dev/rdisk4 was the (raw) SD mount point at time of testing | |
| double check DiskUtility.app and update path accordingly | |
| boot_package offsets from https://github.com/knulli-cfw/knulli.org/blob/main/docs/guides/h700-firmware-extract.md | |
HOST: extract the boot_package.img and dupe | |
sudo dd if=/dev/rdisk4 of=boot_package.img bs=1024 skip=16400 count=20464 | |
cp boot_package.img boot_package-mod.img | |
HOST: use binwalk to get the offset and size (there will be two, you want the second one) | |
binwalk boot_package.img | grep Flattened | |
1161216 0x11B800 Flattened device tree, size: 139999 bytes, version: 17 | |
HOST: use dd to extract | |
dd if=boot_package.img of=2.dtb bs=1 skip=1161216 count=139999 | |
DOCKER: decompile | |
dtc -I dtb -O dts -o 2.dts 2.dtb | |
HOST: edit the dts | |
try to change lcd_ht,lcd_vt from 770,522 (59.71Hz) to 768,521 (59.98Hz) | |
(lcd_dclk_freq*100000) / (lcd_ht * lcd_vt) = fps | |
then add the sum of the changes made to lcd_ht and lcd_vt to lcd_backlight (from 50 to 53) | |
(to preserve a presumed boot_package checksum, otherwise the device won't boot) | |
DOCKER: recompile and dupe the original for manual edits | |
dtc -I dts -O dtb -o 2-mod.dtb 2.dts | |
cp 2.dtb 2-man.dtb | |
I think stock might require this be an exact size so I ended up creating a 2-man.dtb | |
by copying and manually modifying by diffing 2.dtb and 2-mod.dtb in hexfiend | |
and just manually overwriting the three modified bytes | |
HOST: reinject with dd (copied boot_package.img to boot_package-mod.img first) | |
dd if=2-man.dtb of=boot_package-mod.img bs=1 seek=1161216 conv=notrunc | |
HOST: then flash to the existing sdcard with | |
diskutil unmountDisk /dev/disk4 | |
sudo dd if=boot_package-mod.img of=/dev/rdisk4 bs=1024 seek=16400 | |
--- | |
DEVICE: reading dtb values | |
cd /sys/firmware/devicetree/base/soc@03000000/lcd0@01c0c000 | |
xxd lcd_ht | |
xxd lcd_vt |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment