Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

请教关于 九联UNT400G1(S905L3) 电视盒子提取原系统 dtb 后的适配问题 #1285

Closed
signigelchan opened this issue Apr 14, 2023 · 1 comment

Comments

@signigelchan
Copy link

Device Information | 设备信息

  • SOC: [S905L3]
  • Model [九联UNT400G1]

Armbian Version | 系统版本

  • Kernel Version: [5.15.106]
  • Release: [bullseye]

Describe the bug | 问题描述
前期自测试 UNT400G1 盒子刷入 Armbian 系统,可以正常写入 EMMC 及启动系统,详见 请求加入支持 九联UNT400G1(S905L3) 电视盒子

目前开始尝试研究原厂系统的 dtb 用于适配 armbian ,根据此教程已提取原系统 dtb 文件,现在遇到的问题是原系统的 dtb 无法直接使用,需要自行编写一个对应的 dtb 文件,如 12.11.3 说明:

根据 unifreq 的方法制作 u-boot 需要用到盒子的 acs.bin,dts 和 config 文件。其中安卓系统导出来的 dts 不能直接转换成 Armbian 的格式,需要自己编写一个对应的 dts 文件。根据自己设备具体硬件上的区别部分,比如开关、led、电源控制、tf卡、sdio wifi模块等,使用内核源码库中相似的 dts 文件进行修改制作。

查看 UNT400G1 可用的 meson-gxl-s905l2-x7-5g.dtb 反编译后的 dts 文件,发现有很多不同的地方,修改不是很方便,请教如何效率的进行转换适配。(原厂系统 dtb 见附件)
gxlx2_p291_1g-dtb.zip


附:提取原厂系统 dtb 相关信息:

## 分区情况
root@p201_iptv:/ # cat /proc/partitions
 253        0     512000 zram0
 179        0    7634944 mmcblk0
 179        1       4096 mmcblk0p1
 179        2      65536 mmcblk0p2
 179        3     524288 mmcblk0p3
 179        4       8192 mmcblk0p4
 179        5      32768 mmcblk0p5
 179        6      32768 mmcblk0p6
 179        7       8192 mmcblk0p7
 179        8       8192 mmcblk0p8
 179        9      32768 mmcblk0p9
 179       10      32768 mmcblk0p10
 179       11      32768 mmcblk0p11
 179       12    1048576 mmcblk0p12
 179       13      65536 mmcblk0p13
 179       14     524288 mmcblk0p14
 179       15    5074944 mmcblk0p15
 179       96       4096 mmcblk0rpmb
 179       64       4096 mmcblk0boot1
 179       32       4096 mmcblk0boot0

## 挂载情况
root@p201_iptv:/ # cat /proc/mounts
rootfs / rootfs rw 0 0
tmpfs /dev tmpfs rw,nosuid,relatime,mode=755 0 0
devpts /dev/pts devpts rw,relatime,mode=600 0 0
proc /proc proc rw,relatime 0 0
sysfs /sys sysfs rw,relatime 0 0
debugfs /sys/kernel/debug debugfs rw,relatime 0 0
configfs /sys/kernel/config configfs rw,relatime 0 0
none /acct cgroup rw,relatime,cpuacct 0 0
none /sys/fs/cgroup tmpfs rw,relatime,mode=750,gid=1000 0 0
tmpfs /mnt/asec tmpfs rw,relatime,mode=755,gid=1000 0 0
tmpfs /mnt/obb tmpfs rw,relatime,mode=755,gid=1000 0 0
none /dev/cpuctl cgroup rw,relatime,cpu 0 0
tmpfs /tmp tmpfs rw,relatime 0 0
tmpfs /tmp/playInfoLog tmpfs rw,relatime 0 0
tmpfs /tmp/capture tmpfs rw,relatime 0 0
tmpfs /tmp/begininfo tmpfs rw,relatime 0 0
tmpfs /tmp/collectinfo tmpfs rw,relatime 0 0
tmpfs /tmp/picinfo tmpfs rw,relatime 0 0
tmpfs /storage/external_storage tmpfs rw,relatime,mode=775,uid=1000,gid=1023 0 0
/dev/block/system /system ext4 ro,nosuid,nodev,noatime,nodiratime,noauto_da_alloc,data=ordered 0 0
/dev/block/cache /cache ext4 rw,nosuid,nodev,noatime,nodiratime,nodelalloc,noauto_da_alloc,data=ordered 0 0
/dev/block/data /data ext4 rw,nosuid,nodev,noatime,nodiratime,discard,nodelalloc,noauto_da_alloc,data=ordered 0 0
/dev/block/params /params ext4 rw,nosuid,nodev,noatime,nodiratime,nodelalloc,noauto_da_alloc,data=ordered 0 0
/dev/block/bootfiles /bootfiles ext4 rw,nosuid,nodev,noatime,nodiratime,nodelalloc,noauto_da_alloc,data=ordered 0 0
/dev/fuse /mnt/shell/emulated fuse rw,nosuid,nodev,relatime,user_id=1023,group_id=1023,default_permissions,allow_other 0 0
/dev/block/zram0 /swap_zram0 ext2 rw,relatime,errors=continue 0 0
adb /dev/usb-ffs/adb functionfs rw,relatime 0 0

## dtb 查看 (应该是当前使用的 dtb)
root@p201_iptv:/ # cat /proc/device-tree/amlogic-dt-id
gxlx2_p291_1g

root@p201_iptv:/ # cat /proc/ntd
dev:    size   erasesize  name
inand01:    400000     80000 "bootloader"
inand02:   4000000     80000 "reserved"
inand03:  20000000     80000 "cache"
inand04:    800000     80000 "env"
inand05:   2000000     80000 "logo"
inand06:   2000000     80000 "recovery"
inand07:    800000     80000 "rsv"
inand08:    800000     80000 "tee"
inand09:   2000000     80000 "crypt"
inand10:   2000000     80000 "misc"
inand11:   2000000     80000 "boot"
inand12:  40000000     80000 "system"
inand13:   4000000     80000 "params"
inand14:  20000000     80000 "bootfiles"
inand15: 135c00000     80000 "data"

## block 映射关系
root@p201_iptv:/ # cd /dev/block/platform/d0074000.emmc/
root@p201_iptv:/dev/block/platform/d0074000.emmc # ls -al
lrwxrwxrwx root     root              2015-01-01 08:00 boot -> /dev/block/boot
lrwxrwxrwx root     root              2015-01-01 08:00 bootfiles -> /dev/block/bootfiles
lrwxrwxrwx root     root              2015-01-01 08:00 bootloader -> /dev/block/bootloader
drwxr-xr-x root     root              2015-01-01 08:00 by-num
lrwxrwxrwx root     root              2015-01-01 08:00 cache -> /dev/block/cache
lrwxrwxrwx root     root              2015-01-01 08:00 crypt -> /dev/block/crypt
lrwxrwxrwx root     root              2015-01-01 08:00 data -> /dev/block/data
lrwxrwxrwx root     root              2015-01-01 08:00 env -> /dev/block/env
lrwxrwxrwx root     root              2015-01-01 08:00 logo -> /dev/block/logo
lrwxrwxrwx root     root              2015-01-01 08:00 misc -> /dev/block/misc
lrwxrwxrwx root     root              2015-01-01 08:00 mmcblk0 -> /dev/block/mmcblk0
lrwxrwxrwx root     root              2015-01-01 08:00 mmcblk0boot0 -> /dev/block/mmcblk0boot0
lrwxrwxrwx root     root              2015-01-01 08:00 mmcblk0boot1 -> /dev/block/mmcblk0boot1
lrwxrwxrwx root     root              2015-01-01 08:00 mmcblk0rpmb -> /dev/block/mmcblk0rpmb
lrwxrwxrwx root     root              2015-01-01 08:00 params -> /dev/block/params
lrwxrwxrwx root     root              2015-01-01 08:00 recovery -> /dev/block/recovery
lrwxrwxrwx root     root              2015-01-01 08:00 reserved -> /dev/block/reserved
lrwxrwxrwx root     root              2015-01-01 08:00 rsv -> /dev/block/rsv
lrwxrwxrwx root     root              2015-01-01 08:00 system -> /dev/block/system
lrwxrwxrwx root     root              2015-01-01 08:00 tee -> /dev/block/tee

## block 对应的 num
root@p201_iptv:/ # cd /dev/block/platform/d0074000.emmc/by-num/
root@p201_iptv:/dev/block/platform/d0074000.emmc/by-num #
root@p201_iptv:/dev/block/platform/d0074000.emmc/by-num # ls -al
lrwxrwxrwx root     root              2015-01-01 08:00 p1 -> /dev/block/bootloader
lrwxrwxrwx root     root              2015-01-01 08:00 p10 -> /dev/block/misc
lrwxrwxrwx root     root              2015-01-01 08:00 p11 -> /dev/block/boot
lrwxrwxrwx root     root              2015-01-01 08:00 p12 -> /dev/block/system
lrwxrwxrwx root     root              2015-01-01 08:00 p13 -> /dev/block/params
lrwxrwxrwx root     root              2015-01-01 08:00 p14 -> /dev/block/bootfiles
lrwxrwxrwx root     root              2015-01-01 08:00 p15 -> /dev/block/data
lrwxrwxrwx root     root              2015-01-01 08:00 p2 -> /dev/block/reserved
lrwxrwxrwx root     root              2015-01-01 08:00 p3 -> /dev/block/cache
lrwxrwxrwx root     root              2015-01-01 08:00 p4 -> /dev/block/env
lrwxrwxrwx root     root              2015-01-01 08:00 p5 -> /dev/block/logo
lrwxrwxrwx root     root              2015-01-01 08:00 p6 -> /dev/block/recovery
lrwxrwxrwx root     root              2015-01-01 08:00 p7 -> /dev/block/rsv
lrwxrwxrwx root     root              2015-01-01 08:00 p8 -> /dev/block/tee
lrwxrwxrwx root     root              2015-01-01 08:00 p9 -> /dev/block/crypt
root@p201_iptv:/dev/block/platform/d0074000.emmc/by-num #

## 重要分区备份
----------------------------------------------------------------------------------------------
 dd if=/dev/block/boot | gzip > /storage/external_storage/sda1/backup/boot.gz
 dd if=/dev/block/bootloader | gzip > /storage/external_storage/sda1/backup/bootloader.gz
 dd if=/dev/block/bootfiles | gzip > /storage/external_storage/sda1/backup/bootfiles.gz
 dd if=/dev/block/recovery | gzip > /storage/external_storage/sda1/backup/recovery.gz
 dd if=/dev/block/reserved | gzip > /storage/external_storage/sda1/backup/reserved.gz
 dd if=/dev/block/tee | gzip > /storage/external_storage/sda1/backup/tee.gz
----------------------------------------------------------------------------------------------
 dd if=/dev/block/mmcblk0boot0 | gzip > /storage/external_storage/sda1/archived/mmcblk0boot0.gz
 dd if=/dev/block/mmcblk0boot1 | gzip > /storage/external_storage/sda1/archived/mmcblk0boot1.gz
 dd if=/dev/block/mmcblk0rpmb | gzip > /storage/external_storage/sda1/archived/mmcblk0rpmb.gz
#dd if=/dev/block/mmcblk0 | gzip > /storage/external_storage/sda1/backup/mmcblk0.gz
----------------------------------------------------------------------------------------------
#dd if=/dev/block/crypt | gzip > /storage/external_storage/sda1/backup/
#dd if=/dev/block/env | gzip > /storage/external_storage/sda1/backup/
#dd if=/dev/block/logo | gzip > /storage/external_storage/sda1/backup/
#dd if=/dev/block/misc | gzip > /storage/external_storage/sda1/backup/
#dd if=/dev/block/params | gzip > /storage/external_storage/sda1/backup/
#dd if=/dev/block/rsv | gzip > /storage/external_storage/sda1/backup/

## reserved 镜像相应 dtb 的偏移量

我的方法是直接使用 WinHex 查找 dtb ,根据 offset 进行提取,
不同偏移量的 dtb,通过 Beyond Compare 做对比两两相同。

-----------------
gxlx2_p291_1g
428000 -> 431ACF
468000 -> 471ACF
-----------------
gxl_p211_1g
400800 -> 40A0CF
440800 -> 44A0CF
-----------------
gxl_p215_1g
40A800 -> 413FAF
44A800 -> 453FAF
-----------------
gxlx_p261_1g
414000 -> 41DB1F
454000 -> 45DB1F
-----------------
gxlx_p265_1g
41E000 -> 427A0F
45E000 -> 467A0F
-----------------
gxlx2_p295_1g
432000 -> 43BA0F
472000 -> 47BA0F
@signigelchan signigelchan changed the title 请教关于 九联UNT400G1(S905L3) 电视盒子提取原系统 dtb 后的转换问题 请教关于 九联UNT400G1(S905L3) 电视盒子提取原系统 dtb 后的适配问题 Apr 15, 2023
@ophub
Copy link
Owner

ophub commented Apr 16, 2023

安卓的dtb不能直接使用,只用来辅助你写/改dts时确认一些节点的值是多少。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants