1. Android電腦架設
OS需安裝Ubuntu,CPU能力將決定build image的時間
2. 下載Android source code
# repo init -u https://android.googlesource.com/platform/manifest -b android-12.1.0_r5
# git clone https://github.com/android-rpi/local_manifests .repo/local_manifests -b arpi-12
# repo sync
3. 上patch
4.製作Android Image
# source build/envsetup.sh
# lunch rpi4-eng
# make -j 16 ramdisk systemimage vendorimage
(須等一段時間)
5. 編譯Android Kernel
# mkdir arpi-5.10
# cd arpi-5.10
# repo init -u https://github.com/android-rpi/kernel_manifest -b arpi-5.10
# repo sync
# build/build.sh
檔案會產生在out/arpi-5.10/dist/
需要的檔案為Image.gz, bcm2711-rpi-*.dtb 和 vc4-kms-v3d-pi4.dtbo
6. 插入記憶卡到電腦,用fdisk產生下列partition
(假如記憶卡device node為sda)
# fdisk /dev/sda
p1 128MB for boot : Do fdisk, set W95 FAT32(LBA) & Bootable type, mkfs.vfat
p2 1024MB for /system : Do fdisk, new primary partition
p3 128MB for /vendor : Do fdisk, new primary partition
p4 remainings for /data : Do fdisk, mkfs.ext4, use -L option for mkfs.ext4
7. 處理記憶卡開機用partition
1) 格式化FAT32 partition
# mkfs.fat /dev/sda1
# mount /dev/sda1 /mnt
8. 拷貝需要的開機檔案
# cp device/arpi/rpi4/boot/* /mnt
# cp out/target/product/rpi4/ramdisk.img /mnt
# cp arpi-5.10/out/arpi-5.10/dist/Image.gz to /mnt
# cp arpi-5.10/out/arpi-5.10/dist/bcm2711-rpi-*.dtb /mnt
# cp arpi-5.10/out/arpi-5.10/dist/vc4-kms-v3d-pi4.dtbo /mnt/overlays/
9.更新system.img和vendor.img至記憶卡
# cd out/target/product/rpi4
# sudo dd if=system.img of=/dev/sda2 bs=1M
# sudo dd if=vendor.img of=/dev/sda3 bs=1M
10. 完成. 將記憶卡插入記憶卡開機
沒有留言:
張貼留言