我在做 aosp14 移植,目前用 uboot2025.01-rc1,linux 5.10 现在能运行内核,内核能调用 android 的第一阶段 init ( bl 把 init_boot+vendor_boot 的 ramdisk 读取到内存后传递给内核,内核把 initramfs unpack 到 rootfs ),metadata 分区 16MB ,刷入了生成的空白 ext4 文件系统镜像。
第一阶段 init 可以运行,但是只能运行一部分,大概运行到
if (!fsm) {
fsm = CreateFirstStageMount(cmdline);
}
设备就会自动重启,cmdline 加了 init_fatal_panic=true 但是没任何 panic 还是 reboot 到 bootloader 。 如果 fstab 里不写 metadata 会跳过 metadata ,此时串口日志显示创建了几个逻辑分区给 system 、vendor 等,但是也会突然自动重启。
所有串口日志最后一条的下一条就是设备重启的日志:rk860-regulator 1-0042: rk860..... reset
等,无参考价值。
串口日志( fstab 有 metadata ):
[ 18.277402] Run /init as init process
[ 18.280593] init: init first stage started!
[ 18.280826] init: Unable to open /lib/modules, skipping module loading.
[ 18.281153] init: Copied ramdisk prop to /second_stage_resources/system/etc/ramdisk/build.prop
[ 18.281316] init: Using generic ramdisk copy of snapuserd /system/bin/snapuserd_ramdisk
[ 18.281417] init: hard linking /system/bin/snapuserd_ramdisk to /first_stage_ramdisk/system/bin/snapuserd succeeded
[ 18.281754] init: Switching root to '/first_stage_ramdisk'
[ 18.282159] init: [libfstab] Using Android DT directory /proc/device-tree/firmware/android/
[ 18.282286] init: [libfstab] ReadFstabFromDt(): failed to read fstab from dt
[ 18.355352] init: [libfs_mgr] superblock s_max_mnt_count:65535,/dev/block/by-name/metadata
[ 18.355625] EXT4-fs (mmcblk0p21): Ignoring removed nomblk_io_submit option
[ 18.357141] EXT4-fs (mmcblk0p21): mounted filesystem with ordered data mode. Opts: errors=remount-ro,nomblk_io_submit
[ 18.357185] init: [libfs_mgr] check_fs(): mount(/dev/block/by-name/metadata,/metadata,ext4)=0: Success
[ 18.361990] EXT4-fs (mmcblk0p21): mounted filesystem with ordered data mode. Opts: discard
串口日志(无 metadata 或挂载失败):
[ 18.276158] Run /init as init process
[ 18.279226] init: init first stage started!
[ 18.279431] init: Unable to open /lib/modules, skipping module loading.
[ 18.279750] init: Copied ramdisk prop to /second_stage_resources/system/etc/ramdisk/build.prop
[ 18.279911] init: Using generic ramdisk copy of snapuserd /system/bin/snapuserd_ramdisk
[ 18.280010] init: hard linking /system/bin/snapuserd_ramdisk to /first_stage_ramdisk/system/bin/snapuserd succeeded
[ 18.280335] init: Switching root to '/first_stage_ramdisk'
[ 18.280730] init: [libfstab] Using Android DT directory /proc/device-tree/firmware/android/
[ 18.280848] init: [libfstab] ReadFstabFromDt(): failed to read fstab from dt
[ 18.282054] init: Check Point2
[ 18.282082] init: Check Point3.22
[ 18.456015] usb 2-1.1: new full-speed USB device number 3 using ehci-platform
[ 18.557933] usb 2-1.1: New USB device found, idVendor=0bda, idProduct=b85b, bcdDevice= 0.00
[ 18.558009] usb 2-1.1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[ 18.558032] usb 2-1.1: Product: Bluetooth Radio
[ 18.558053] usb 2-1.1: Manufacturer: Realtek
[ 18.558073] usb 2-1.1: SerialNumber: 00e04c000001
[ 20.194029] rk_hdmirx fdee0000.hdmirx-controller: hdmirx_cancel_cpu_limit_freq freq qos nod add
[ 20.276050] rk-pcie fe170000.pcie: PCIe Link Fail, LTSSM is 0x3, hw_retries=0
[ 20.286057] rk-pcie fe150000.pcie: PCIe Link Fail, LTSSM is 0x0, hw_retries=0
[ 20.286119] rk-pcie fe150000.pcie: failed to initialize host
[ 22.602724] rk_pcie_establish_link: 232 callbacks suppressed
[ 22.602741] rk-pcie fe170000.pcie: PCIe Linking... LTSSM is 0x3
[ 22.629398] rk-pcie fe170000.pcie: PCIe Linking... LTSSM is 0x3
[ 22.656059] rk-pcie fe170000.pcie: PCIe Linking... LTSSM is 0x3
[ 22.682736] rk-pcie fe170000.pcie: PCIe Linking... LTSSM is 0x3
[ 22.709494] rk-pcie fe170000.pcie: PCIe Linking... LTSSM is 0x3
[ 22.736063] rk-pcie fe170000.pcie: PCIe Linking... LTSSM is 0x3
[ 22.762728] rk-pcie fe170000.pcie: PCIe Linking... LTSSM is 0x3
[ 22.789396] rk-pcie fe170000.pcie: PCIe Linking... LTSSM is 0x3
[ 22.816061] rk-pcie fe170000.pcie: PCIe Linking... LTSSM is 0x3
[ 22.842733] rk-pcie fe170000.pcie: PCIe Linking... LTSSM is 0x3
[ 24.176058] rk-pcie fe170000.pcie: PCIe Link Fail, LTSSM is 0x3, hw_retries=1
[ 25.196063] rk-pcie fe170000.pcie: failed to initialize host
[ 38.369022] init: [libfs_mgr] Skipping mounting '/dev/block/bootdevice/by-name/metadata'
[ 38.369297] init: [libfs_mgr] Failed to open '/dev/block/bootdevice/by-name/metadata': No such file or directory
[ 38.369580] init: [libfs_mgr] __mount(source=/dev/block/bootdevice/by-name/metadata(missing),target=/metadata,type=ext4)=-1: No such file or directory
[ 38.374465] init: [libfs_mgr] Created logical partition odm_a on device /dev/block/dm-0
[ 38.374503] init: [libfs_mgr] Skipping zero-length logical partition: odm_b
[ 38.375365] init: [libfs_mgr] Created logical partition system_a on device /dev/block/dm-1
[ 38.375389] init: [libfs_mgr] Skipping zero-length logical partition: system_b
[ 38.376232] init: [libfs_mgr] Created logical partition system_ext_a on device /dev/block/dm-2
[ 38.376255] init: [libfs_mgr] Skipping zero-length logical partition: system_ext_b
[ 38.377209] init: [libfs_mgr] Created logical partition vendor_a on device /dev/block/dm-3
fstab 如下:
/dev/block/platform/ff0f0000.dwmmc/by-name/user /mnt/internal_sd vfat defaults defaults
/dev/block/mmcblk0p1 /mnt/external_sd vfat /dev/block/mmcblk0 defaults
# /dev/block/by-name/
system /system ext4 rw,barrier=1,discard wait,slotselect,logical,first_stage_mount,avb=vbmeta_system
system_ext /system_ext ext4 rw wait,slotselect,logical,first_stage_mount,avb=vbmeta_system
product /product ext4 rw wait,slotselect,logical,first_stage_mount
vendor /vendor ext4 rw wait,slotselect,logical,first_stage_mount
odm /odm ext4 ro wait,slotselect,logical,first_stage_mount
/dev/block/by-name/dtbo /dtbo emmc defaults slotselect,first_stage_mount,avb=vbmeta
/dev/block/by-name/boot /boot emmc defaults slotselect,first_stage_mount,avb=vbmeta
/dev/block/by-name/init_boot /init_boot emmc defaults slotselect,first_stage_mount,avb=vbmeta
/dev/block/by-name/vendor_boot /vendor_boot emmc defaults slotselect,first_stage_mount,avb=vbmeta
/dev/block/by-name/recovery /recovery emmc defaults slotselect,first_stage_mount,avb=vbmeta
/dev/block/by-name/metadata /metadata ext4 noatime,nosuid,nodev,discard wait,check,formattable,first_stage_mount
/dev/block/bootdevice/by-name/misc /misc emmc defaults defaults
/dev/block/bootdevice/by-name/userdata /data ext4 noatime,nosuid,nodev,discard latemount,wait,check,formattable,reservedsize=128M
关键词: rockchip 、瑞芯微、rk3588 、rk3399 、安卓、android 、aosp 、开发板
1
LeviMarvin OP 板子 SoC 是 rk3588 、16+128GB ,MMC
|
2
lloovve 39 天前 via iPhone
自己适配?这个都是官方给做好,自己搞恐怕很难
|
3
LeviMarvin OP 还有问题就是 init 打印出来的日志不全,我手动输入 check point 等字样只能连续输出二至四条,然后 init 的所有 log 都没了
|
4
LeviMarvin OP @lloovve rk 官方目前公开的是 a12 的 sdk ,a13 的 sdk 需要花钱定制,所以想自己适配一下试一试,一路上很多玄学问题(很多是我知识储备不够),从 uboot 最新版本适配开始目前总算是能正常启动 linux 了,然后就想试一下 android 移植,也是很多问题,最后以为 init 跑起来就好了,结果跑起来还有奇怪的问题。
|
5
scys 39 天前
PCIE 都启动失败了,驱动的 pin 脚要适配,你对下配置表
|
6
LeviMarvin OP @scys 感谢大佬指点,我去修正一下这个问题,但是启动 linux 的时候有这个问题但不影响系统启动,这个问题会导致 android init 启动不了吗
|
7
scys 39 天前
我之前的弄 MTK ,不着调 MMC 是不是通过 PCIE 总线链接的。这个你需要看 U 图确认。
然后一般来说就是启动的配置表有问题,这个根据我移植 MTK 经验来谈。 |
8
LeviMarvin OP @scys 大佬,启动的配置表是指什么呀
|
9
scys 39 天前
dts
|
10
LeviMarvin OP 更新,日志显示 system 挂不上,然后经过检查发现是 fstab 里参数写的 rw ,不支持,必须用 ro 只读挂载才行。目前还有很多问题需要修,慢慢来,终会可以进入系统的
|
11
LeviMarvin OP 更新,可以跑到 zygote 、zygote_secondary 了,但是这俩服务(和他们带的服务一直重启,不知道为什么)
|