编译rk3399-sd-friendlydesktop 系统镜像 实现自定义分区大小

最下面是镜像的编译过程,我先着重介绍自定义分区部分,
通过自定义分区可以修改两个分区的大小,适应不同大小的sd卡

假定你将文件放在 your_dir 文件夹下面

  • 修改./your_dir/mk-sd-image.sh

主要修改line61

friendlydesktop-arm64)
	RAW_FILE=${SOC}-sd-friendlydesktop-${CODENAME}-4.4-arm64-$(date +%Y%m%d).img
	RAW_SIZE_MB=29696 ;;

其中29696是sd卡的大小,单位MB


  • 修改./your_dir/sd-fuse_rk3399/friendlydesktop-arm64/partmap.txt

主要是line10-line11,下面是修改好的文件,

flash=mmc,1:loader:idb:0x8000,0x280000:idbloader.img;
flash=mmc,1:env:env:0x3F8000,0x8000;
flash=mmc,1:parm:parm:0x400000,0x0400000:param4sd.txt;
flash=mmc,1:uboot:raw:0x800000,0x0400000:uboot.img;
flash=mmc,1:trust:raw:0xC00000,0x0400000:trust.img;
flash=mmc,1:misc:raw:0x1000000,0x0400000;
flash=mmc,1:resc:raw:0x1400000,0x0C00000:resource.img;
flash=mmc,1:kern:raw:0x2000000,0x2000000:kernel.img;
flash=mmc,1:boot:raw:0x4000000,0x2000000:boot.img;
flash=mmc,1:rootfs:ext4:0x6000000,0x6da050000:rootfs.img;
flash=mmc,1:userdata:ext4:0x6ea050000,0x0:userdata.img;

flash=mmc,1:rootfs:ext4:0x6000000,0x6da050000:rootfs.img;

“0x6000000” :代表分区起始节点,
“0x6da050000”:代表分区的大小。
同理userdata的起始节点也要更改。


sd-fuse_rk3399

Create bootable SD card for NanoPC T4/NanoPi M4/NanoPi NEO4

How to find the /dev name of my SD Card

Unplug all usb devices:

ls -1 /dev > ~/before.txt

plug it in, then

ls -1 /dev > ~/after.txt
diff ~/before.txt ~/after.txt

Build friendlycore bootable SD card

git clone https://github.com/friendlyarm/sd-fuse_rk3399.git
cd sd-fuse_rk3399
sudo ./fusing.sh /dev/sdX friendlycore-arm64

You can build the following OS: friendlycore-arm64, friendlydesktop-arm64, lubuntu, eflasher.
Because the android system has to run on the emmc, so you need to make eflasher img to install Android.

Notes:
fusing.sh will check the local directory for a directory with the same name as OS, if it does not exist fusing.sh will go to download it from network.
So you can download from the netdisk in advance, on netdisk, the images files are stored in a directory called images-for-eflasher, for example:

cd sd-fuse_rk3399
tar xvzf ../images-for-eflasher/friendlycore-arm64-images.tgz
sudo ./fusing.sh /dev/sdX friendlycore-arm64

Build an sd card image

First, download and unpack:

git clone https://github.com/friendlyarm/sd-fuse_rk3399.git
cd sd-fuse_rk3399
wget http://112.124.9.243/dvdfiles/RK3399/images-for-eflasher/friendlycore-arm64-images.tgz
tar xvzf friendlycore-arm64-images.tgz

Now, Change something under the friendlycore-arm64 directory,
for example, replace the file you compiled, then build friendlycore-arm64 bootable SD card:

sudo ./fusing.sh /dev/sdX friendlycore-arm64

or build an sd card image:

sudo ./mk-sd-image.sh friendlycore-arm64

The following file will be generated:

out/rk3399-sd-friendlycore-bionic-4.4-arm64-yyyymmdd.img

You can use dd to burn this file into an sd card:

dd if=out/rk3399-sd-friendlycore-bionic-4.4-arm64-20181112.img of=/dev/sdX bs=1M

Build an sdcard-to-emmc image (eflasher rom)

Enable exFAT file system support on Ubuntu:

sudo apt-get install exfat-fuse exfat-utils

Generate the eflasher raw image, and put friendlycore image files into eflasher:

git clone https://github.com/friendlyarm/sd-fuse_rk3399.git
cd sd-fuse_rk3399
wget http://112.124.9.243/dvdfiles/RK3399/images-for-eflasher/emmc-flasher-images.tgz
tar xzf emmc-flasher-images.tgz
wget http://112.124.9.243/dvdfiles/RK3399/images-for-eflasher/friendlycore-arm64-images.tgz
tar xzf friendlycore-arm64-images.tgz
sudo ./mk-emmc-image.sh friendlycore-arm64

The following file will be generated:

out/rk3399-eflasher-friendlycore-bionic-4.4-arm64-yyyymmdd.img

You can use dd to burn this file into an sd card:

dd if=out/rk3399-eflasher-friendlycore-bionic-4.4-arm64-20181112.img of=/dev/sdX bs=1M

Replace the file you compiled

Install cross compiler and tools

Install the package:

apt install liblz4-tool android-tools-fsutils

Install Cross Compiler:

git clone https://github.com/friendlyarm/prebuilts.git
sudo mkdir -p /opt/FriendlyARM/toolchain
sudo tar xf prebuilts/gcc-x64/aarch64-cortexa53-linux-gnu-6.4.tar.xz -C /opt/FriendlyARM/toolchain/

Build U-boot and Kernel for Lubuntu, FriendlyCore and FriendlyDesktop

Download image files:

cd sd-fuse_rk3399
wget http://112.124.9.243/dvdfiles/RK3399/images-for-eflasher/lubuntu-desktop-images.tgz
tar xzf lubuntu-desktop-images.tgz
wget http://112.124.9.243/dvdfiles/RK3399/images-for-eflasher/friendlycore-arm64-images.tgz
tar xzf friendlycore-arm64-images.tgz
wget http://112.124.9.243/dvdfiles/RK3399/images-for-eflasher/friendlydesktop-arm64-images.tgz
tar xzf friendlydesktop-arm64-images.tgz

Build kernel:

cd sd-fuse_rk3399
git clone https://github.com/friendlyarm/kernel-rockchip --depth 1 -b nanopi4-linux-v4.4.y out/kernel-rk3399
# lubuntu
./build-kernel.sh lubuntu

# friendlycore-arm64
./build-kernel.sh friendlycore-arm64

# friendlydesktop-arm64
./build-kernel.sh friendlydesktop-arm64

Build uboot:

cd sd-fuse_rk3399
git clone https://github.com/friendlyarm/uboot-rockchip --depth 1 -b nanopi4-v2014.10_dev
cd uboot-rockchip
make CROSS_COMPILE=aarch64-linux- rk3399_defconfig
export PATH=/opt/FriendlyARM/toolchain/6.4-aarch64/bin/:$PATH
make CROSS_COMPILE=aarch64-linux-
cp uboot.img trust.img ../lubuntu
cp uboot.img trust.img ../friendlycore-arm64
cp uboot.img trust.img ../friendlydesktop-arm64
cp rk3399_loader_v1.12.109.bin ../lubuntu/MiniLoaderAll.bin
cp rk3399_loader_v1.12.109.bin ../friendlycore-arm64/MiniLoaderAll.bin
cp rk3399_loader_v1.12.109.bin ../friendlydesktop-arm64/MiniLoaderAll.bin

Custom rootfs for Lubuntu, FriendlyCore and FriendlyDesktop

Custom rootfs in the bootable SD card

Use FriendlyCore as an example:

git clone https://github.com/friendlyarm/sd-fuse_rk3399.git
cd sd-fuse_rk3399

wget http://112.124.9.243/dvdfiles/RK3399/rootfs/rootfs-friendlycore-arm64-YYMMDD.tgz
tar xzf rootfs-friendlycore-arm64-YYMMDD.tgz

Now, change something under rootfs directory, like this:

echo hello > friendlycore/rootfs/root/welcome.txt  

Remake rootfs.img:

./build-rootfs-img.sh friendlycore/rootfs friendlycore/rootfs.img

Make sdboot image:

sudo ./mk-sd-image.sh friendlycore

or make sd-to-emmc image (eflasher rom):

sudo ./mk-emmc-image.sh friendlycore

Build Android8

git clone https://gitlab.com/friendlyelec/rk3399-android-8.1 --depth 1 -b master
cd rk3399-android-8.1
./build-nanopc-t4.sh -F -M
wget http://112.124.9.243/dvdfiles/RK3399/images-for-eflasher/android-oreo-images.tgz
tar xzf android-oreo-images.tgz
cp rockdev/Image-nanopc_t4/* android8

Copy the new image files to the exfat partition of the eflasher sd card:

cp -af android8 /mnt/exfat/
  • 1
    点赞
  • 9
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值