作者:PengJin05 | 来源:互联网 | 2023-09-25 13:04
--- ---#!binbashOUTDIRouttargetproducttiny4412AHOSTBINouthostlinux-x86bin#installvendorfi
---
---
#!/bin/bash
OUTDIR=out/target/product/tiny4412
AHOSTBIN=out/host/linux-x86/bin
# install vendor files
if [ -d vendor/friendly-arm/tiny4412/rootdir/system/ ]; then
cp -af vendor/friendly-arm/tiny4412/rootdir/system/* ${OUTDIR}/system/
fi
if [ -d vendor/friendly-arm/tiny4412/rootdir/data/ ]; then
cp -af vendor/friendly-arm/tiny4412/rootdir/data/* ${OUTDIR}/data/
fi
# make images
${AHOSTBIN}/make_ext4fs -s -l 320000000 -a system system.img ${OUTDIR}/system
# eMMC Size | UserData partition Size
#------------------------------------------------
# 4G | 2149580800 (2G) 2050*1024*1024
# 8G | 4299161600 (4G)
# 16G | 10747904000 (10G) 10250*1024*1024
#------------------------------------------------
${AHOSTBIN}/make_ext4fs -s -l 2149580800 -a data userdata-4g.img ${OUTDIR}/data
${AHOSTBIN}/make_ext4fs -s -l 4299161600 -a data userdata-8g.img ${OUTDIR}/data
${AHOSTBIN}/make_ext4fs -s -l 10485760000 -a data userdata-16g.img ${OUTDIR}/data
cp userdata-4g.img userdata.img
# ramdisk
${AHOSTBIN}/mkbootfs ${OUTDIR}/root | ${AHOSTBIN}/minigzip > ${OUTDIR}/ramdisk.img
mkimage -A arm -O linux -T ramdisk -C none -a 0x40800000 -n "ramdisk" \
-d ${OUTDIR}/ramdisk.img ramdisk-u.img
# minitools support
MINITOOLS_PATH=/opt/MiniTools/tiny4412/images/Android4.1.2
if [ -d ${MINITOOLS_PATH} ]; then
cp -f ramdisk-u.img ${MINITOOLS_PATH}/
cp -f system.img ${MINITOOLS_PATH}/
cp -f userdata*.img ${MINITOOLS_PATH}/
ls -l ${MINITOOLS_PATH}/ramdisk-u.img
ls -l ${MINITOOLS_PATH}/system.img
ls -l ${MINITOOLS_PATH}/userdata*.img
fi
Created filesystem with 15/640848 inodes and 78703/2560000 blocks
./gen-img.sh: 行 30: mkimage: 未找到命令
?????
答:
不过这需要依赖 UBoot 的一个工具:mkimage,如果你之前编译过 UBoot,可以在 UBoot 的 tools 目录下找到这个程序,也可以通过 apt-get 来安装它:
[yuhuashi@local android-4.2.2_r1]$ sudo apt-get install u-boot-tools
有了这个工具我们便可以制作 img 镜像文件了
[yuhuashi@local android-4.2.2_r1]$ ./gen-img.sh
OK,看看是不是在当前目录下出现了下面这几个文件:
[yuhuashi@local android-4.2.2_r1]$ ls
system.img
userdata-16g.img
userdata-4g.img
userdata-8g.img
userdata.img
ramdisk-u.img
......
隐藏了若干不相关文件