Xây dựng Android 13 cho Raspberry Pi 4

1. Chuẩn bị môi trường

1.1. Cài đặt các công cụ cần thiết

1.2. Cài đặt repo tool

1.3. Cấu hình git

2. Build Android 13

2.1. Download mã nguồn Android 13

  • mkdir -p aosp/source/: Tạo thư mục chứa mã nguồn Android.
  • repo init -u https://android.googlesource.com/platform/manifest -b android-13.0.0_r61: Khởi tạo repo chứa mã nguồn Android.
  • curl –create-dirs -L -o .repo/local_manifests/manifest_brcm_rpi4.xml -O -L https://raw.githubusercontent.com/raspberry-vanilla/android_local_manifest/android-13.0/manifest_brcm_rpi4.xml: Thêm manifest tùy chỉnh cho Raspberry Pi 4.
  • repo sync: Tải về mã nguồn Android.

2.2. Build Android 13 Image

  • . build/envsetup.sh: Thiết lập môi trường.
  • lunch aosp_rpi4-userdebug: Chọn cấu hình build cho Raspberry Pi 4.
  • make bootimage systemimage vendorimage -j$(nproc): Build các image của phân vùng boot, system, và vendor.
  • ./rpi4-mkimg.sh: Build image hoàn chỉnh cho Raspberry Pi 4.

3. Build Kernel

3.1. Download mã nguồn Kernel

  • mkdir -p kernel/: Tạo thư mục chứa mã nguồn kernel.
  • repo init -u https://android.googlesource.com/kernel/manifest -b common-android13-5.15-lts: Khởi tạo repo chứa mã nguồn kernel.
  • curl –create-dirs -L -o .repo/local_manifests/manifest_brcm_rpi4.xml -O -L https://raw.githubusercontent.com/raspberry-vanilla/android_kernel_manifest/android-13.0/manifest_brcm_rpi4.xml: Thêm manifest tùy chỉnh cho Raspberry Pi 4.
  • repo sync: Tải về mã nguồn kernel.

3.2. Build Kernel Image

4. Cài Android lên thẻ nhớ SD

4.1. Cài đặt Imager

4.2. Thay đổi quyền sở hữu của Android Image

  • source/out/target/product/rpi4/RaspberryVanillaAOSP13… : Đường dẫn tới Android Image

4.3. Flash Android Image

  • Cắm thẻ SD vào máy và umount thẻ. Ví dụ: sudo umount /media/minhnn/*
  • Mở Imager, chọn “Chose OS”
  • Chọn “Use custom”
  • Tìm đường dẫn tới file Android Image
  • Chọn “Chose storage” và chọn thẻ SD
  • Chọn “Next” và đợi thẻ được ghi xong

4.4. Flash Kernel Image

  • Rút ra cắm lại thẻ SD để thẻ được mount lại.
  • Copy Kernel Image vào thẻ vào file boot

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top