Brillo: RPi 2B(树莓派)与brilloemulator-arm相互验证

再接着将system.img写入到mmc.bin5并格式化mmc.bin7( 脚本实现,执行需要root权限):

#! /bin/bash
set -e -x

#Disk mmc.bin: 1610 MB, 1610612736 bytes
#255 heads, 63 sectors/track, 195 cylinders, total 3145728 sectors
#Units = sectors of 1 * 512 = 512 bytes
#Sector size (logical/physical): 512 bytes / 512 bytes
#I/O size (minimum/optimal): 512 bytes / 512 bytes
#Disk identifier: 0x61a15a29

#  Device Boot      Start         End      Blocks   Id  System
#mmc.bin1            2048      526335      262144   83  Linux
#mmc.bin2          526336     1050623      262144   83  Linux
#mmc.bin3         1050624     1574911      262144   83  Linux
#mmc.bin4         1574912     3145727      785408    5  Extended
#mmc.bin5         1576960     2101247      262144   83  Linux
#mmc.bin6         2103296     2627583      262144   83  Linux

# system partition /dev/sd?5
DEV=`losetup -o $((1576960*512)) --sizelimit $((262144*1024)) -f --show mmc.bin`
if [ $? != 0 ] ; then
    exit 1;
fi

echo "DEV=${DEV}"

if [ "${DEV}x" =~ "^/dev/loop" ] ; then
    exit 2;
fi

dd if=system.img of=${DEV}
losetup -d ${DEV}

# data partition /dev/sd?6
DEV=`losetup -o $((2103296*512)) --sizelimit $((262144*1024)) -f --show mmc.bin`
if [ $? != 0 ] ; then
    exit 1;
fi

echo "DEV=${DEV}"

if [ "${DEV}x" =~ "^/dev/loop" ] ; then
    exit 2;
fi

mkfs.ext4 -L data ${DEV}

set +e
tune2fs -O ^huge_file ${DEV}

fsck.ext4 ${DEV}
set -e

losetup -d ${DEV}

echo "Done!"

最后,修改out/host/linux-x86/bin/brilloemulator-arm文件:

exec \
${ANDROID_BUILD_TOP}/prebuilts/android-emulator/linux-x86_64/qemu/linux-x86_64/qemu-system-aarch64 \
  -M vexpress-a9 \
  -m ${MEM}M \
  -kernel ${ANDROID_BUILD_TOP}/out/target/product/brilloemulator_arm/kernel \
  -initrd ${ANDROID_BUILD_TOP}/out/target/product/rpi/ramdisk.img \
  -sd ${ANDROID_BUILD_TOP}/out/target/product/rpi/mmc.bin \
  -append "console=ttyAMA0 ro noinitrd androidboot.hardware=rpi rootwait noinitrd init=/init androidboot.selinux=permissive" \
  -nographic \
  -redir tcp:5555::5555 \
  -dtb ${ANDROID_BUILD_TOP}/out/target/product/brilloemulator_arm/kernel-dtb \
  "$@"

执行brilloemulator-arm就可以开机了。

  • 让Raspberry Pi 2B运行brilloemulator_arm-eng编译出来的代码

发表评论

电子邮件地址不会被公开。 必填项已用*标注