RK3568打包导出根文件系统rootfs

  1. 根文件系统

rootfs就是根文件系统的意思,一个可以使用的基于linux内核的系统包括引导程序uboot, linux内核固件(含设备树),rootfs根文件系统。比如ubuntu系统就是一个根文件系统,文件系统中存放着整个linux系统相关的功能软件功能的文件。如下图就是ubuntu 20.04.5的根文件系统,可以看出就是各种各样的文件。本文介绍的就是在一个已经安装各种应用软件的ubuntu系统中把根文件系统导出来,用于烧写到新的设备中去。

RK3568打包导出根文件系统rootfs_第1张图片

RK3568系列芯片使用的是RKDevTool软件来烧写映像文件,其中包括根文件系统映像,生成烧写映像文件只需要在SDK下使用build.sh来编译生成即可。

RK3568打包导出根文件系统rootfs_第2张图片

2. img文件

img(映像)文件就是以.img为结尾的文件,我之前的理解这个img文件可能是一种特殊的格式的文件,与普通文件并无区别,后来经过我深入的学习,才知道img文件的作用就是一个磁盘分区,分区内放一些文件,因此严格来说它不是一个文件,是一个分区。通过后面的生成img文件的过程你就理解了,它实际是一个分区。

3. 导出根文件系统rootfs

在一个能正常运行的ubuntu系统上,并且已经安装好要使用的应用软件,导出时可以连应用软件一起导出。以下在RK3568 ubuntu 20.04系统上操作。

  1. 在设备的 Ubuntu 环境下,安装 fireflydev

sudo apt update

sudo apt install fireflydev

  1. 安装 fireflydev 后,就能使用 ff_export_rootfs 脚本导出根文件系统

  • 建议使用容量较大的移动硬盘,一般8G以上最好,我这里使用的是16G的SD卡,注意SD卡要格式化成EXT4文件系统,格式化SD卡时,先把SD卡卸载。

sudo mkfs.ext4 /dev/mmcblk1 SD卡识别成mmcblk1磁盘分区

  • 导出工具会执行 apt clean 等操作以减小文件系统大小

  • 将根文件系统导出,例如导出到 /media/firefly/fe43143b-6945-4081-aa14-335e15f6cc60/,此 目录是SD卡挂载后的目录(需要等待一定时间,大约10分钟):

执行命令 ff_export_rootfs /media/firefly/fe43143b-6945-4081-aa14-335e15f6cc60, 导出根文件系统

导出成功后在SD卡目录下会生成Ubuntu20.04.5LTS_Firefly_ext4_202303141457.img文件,如下图。

可以看到整个SD卡使用的空间total:2.9G, 而导出的根文件系统 Ubuntu20.04.5LTS_Firefly_ext4_202303141457.img的大小占用了7.8G的空间,在linux SDK中编译时放根文件系统的分区大小只有3G左右,这么大的映像是无法使用的。

  • 压缩文件系统,删除不必要的空白空间以减少存储器资源的占用:

# 有部分客户说导出的 rootfs 大小为 3.3G,可实际只用了 3G,原因是没有对 rootfs 进行压缩

e2fsck -p -f Firefly_Ubuntu_18.04.6_rootfs.img

resize2fs -M Firefly_Ubuntu_18.04.6_rootfs.img

使用上面2条命令只能把img从8G变成7.9G,依然无法解决问题。

以上操作参考:1. 用户和密码 — Firefly Wiki (t-firefly.com)。

4. 减少根文件系统映像文件大小

上面导出的根文件系统的工作已经完成,可以把导出的根文件系统放到另外一台x86的ubuntu系统上面做进一步的文件大小变小的工作了。

由于根文件系统需要的实际大小为2.9G,因此创建一个3G大小的映像文件,取名为rootfs.img,可以使用dd命令来创建。把创建的img文件和原来的Ubuntu20.04.5LTS_Firefly_ext4_202303141457.img使用mount命令挂载到rootfs, img两个文件夹下面,使用cp命令从img文件夹中复制所有文件到rootfs文件夹下面,到此就完成了img文件减小的工作。具体操作流程如下

#使用dd命令来创建一个img映像文件,实际是一个磁盘分区,同时设置读入/输出的块大小为1M bytes个字节bs=1M, count=3072,即3G空间img文件
eiota@eiota-Default-string:~/icore-3568jq/ubuntu_rootfs$ sudo dd if=/dev/zero of=./rootfs20.04.5.img bs=1M count=3072
3072+0 records in
3072+0 records out
3221225472 bytes (3.2 GB, 3.0 GiB) copied, 10.0385 s, 321 MB/s
eiota@eiota-Default-string:~/icore-3568jq/ubuntu_rootfs$ ls -l
total 24591952
-rw-r--r-- 1 eiota eiota 8456601600 3月  14 12:40 rk356x_ubuntu_rootfs.img
-rw-r--r-- 1 root  root  3221225472 3月  14 16:26 rootfs20.04.5.img
-rw-rw-r-- 1 eiota eiota  369150429 12月 12 17:58 ubuntu_18.04_RK3568_ext4_v2.10-42-g50c7f0ac_20220120-1924_DESKTOP.7z
-rw-r--r-- 1 eiota eiota 2225065984 1月  21  2022 ubuntu_18.04_RK3568_ext4_v2.10-42-g50c7f0ac_20220120-1924_DESKTOP.img
-rw-r--r-- 1 eiota eiota 8456601600 3月  14 16:21 Ubuntu20.04.5LTS_Firefly_ext4_202303141110.img
-rw-r--r-- 1 eiota eiota 2453487616 10月 20 17:10 Ubuntu20.04-Lxqt_RK3568_v2.11-110_20220920.img

#对刚刚创建的rootfs20.04.5.img格式化成ext4文件系统
eiota@eiota-Default-string:~/icore-3568jq/ubuntu_rootfs$ sudo mkfs.ext4 ./rootfs20.04.5.img
mke2fs 1.44.1 (24-Mar-2018)
Discarding device blocks: done
Creating filesystem with 786432 4k blocks and 196608 inodes
Filesystem UUID: 587fa640-1412-4a4a-b6d2-7c7ea86cf04f
Superblock backups stored on blocks:
        32768, 98304, 163840, 229376, 294912

Allocating group tables: done
Writing inode tables: done
Creating journal (16384 blocks): done
Writing superblocks and filesystem accounting information: done

#创建一个rootfs的文件夹,用于挂载rootfs20.04.5.img文件
eiota@eiota-Default-string:~/icore-3568jq/ubuntu_rootfs$ mkdir /home/eiota/rootfs
#挂载rootfs20.04.5.img文件到rootfs文件夹下面
eiota@eiota-Default-string:~/icore-3568jq/ubuntu_rootfs$ sudo mount -o loop rootfs20.04.5.img /home/eiota/rootfs/

eiota@eiota-Default-string:~/icore-3568jq/ubuntu_rootfs$ ls /home/eiota/rootfs/ -lh
total 16K
drwx------ 2 root root 16K 3月  14 16:27 lost+found

eiota@eiota-Default-string:~/icore-3568jq/ubuntu_rootfs$ ls -l
total 24591952
-rw-r--r-- 1 eiota eiota 8456601600 3月  14 12:40 rk356x_ubuntu_rootfs.img
-rw-r--r-- 1 root  root  3221225472 3月  14 16:26 rootfs20.04.5.img
-rw-rw-r-- 1 eiota eiota  369150429 12月 12 17:58 ubuntu_18.04_RK3568_ext4_v2.10-42-g50c7f0ac_20220120-1924_DESKTOP.7z
-rw-r--r-- 1 eiota eiota 2225065984 1月  21  2022 ubuntu_18.04_RK3568_ext4_v2.10-42-g50c7f0ac_20220120-1924_DESKTOP.img
-rw-r--r-- 1 eiota eiota 8456601600 3月  14 16:21 Ubuntu20.04.5LTS_Firefly_ext4_202303141110.img
-rw-r--r-- 1 eiota eiota 2453487616 10月 20 17:10 Ubuntu20.04-Lxqt_RK3568_v2.11-110_20220920.img

#把Ubuntu20.04.5LTS_Firefly_ext4_202303141110挂载到img文件夹下面
sudo mount -o loop Ubuntu20.04.5LTS_Firefly_ext4_202303141110.img /home/eiota/img/

eiota@eiota-Default-string:~/img$ ls -l
total 84
lrwxrwxrwx   1 root root     7 2月   1  2021 bin -> usr/bin
drwxr-xr-x   2 root root  4096 3月  14 11:09 dev
drwxr-xr-x 111 root root  4096 3月  14 09:31 etc
drwxr-xr-x   3 root root  4096 3月  14 11:16 home
lrwxrwxrwx   1 root root     7 6月  24  2021 lib -> usr/lib
drwx------   2 root root 16384 9月  20 19:01 lost+found
drwxr-xr-x   3 root root  4096 3月  14 11:16 media
drwxr-xr-x   2 root root  4096 3月  14 11:16 mnt
drwxr-xr-x   2 root root  4096 3月  14 11:16 opt
dr-xr-xr-x   2 root root  4096 3月  14 11:16 proc
drwx------   3 root root  4096 3月  14 11:16 root
drwxr-xr-x   2 root root  4096 3月  14 11:16 run
lrwxrwxrwx   1 root root     8 2月   1  2021 sbin -> usr/sbin
drwxr-xr-x   2 root root  4096 12月 30 14:15 snap
drwxr-xr-x   2 root root  4096 2月   1  2021 srv
dr-xr-xr-x   2 root root  4096 8月   4  2017 sys
drwxr-xr-x   4 root root  4096 3月  14 11:16 system
drwxrwxrwt   7 root root  4096 3月  14 11:16 tmp
drwxr-xr-x  11 root root  4096 3月  14 11:16 usr
drwxr-xr-x  14 root root  4096 3月  14 11:16 var
drwxr-xr-x   3 root root  4096 3月  14 11:16 vendor

#cp命令使用说明:
    -a:此选项通常在复制目录时使用,它保留链接、文件属性,并复制目录下的所有内容。其作用等于dpR参数组合。
    -d:复制时保留链接。这里所说的链接相当于Windows系统中的快捷方式。
    -f:覆盖已经存在的目标文件而不给出提示。
    -i:与-f选项相反,在覆盖目标文件之前给出提示,要求用户确认是否覆盖,回答"y"时目标文件将被覆盖。
    -p:除复制文件的内容外,还把修改时间和访问权限也复制到新文件中。
    -r:若给出的源文件是一个目录文件,此时将复制该目录下所有的子目录和文件。
    -l:不复制文件,只是生成链接文件。
#注意这里一定要使用-a来复制,否则减小后的根文件系统不能启动
eiota@eiota-Default-string:~/img$ sudo cp -a * ../rootfs/

在新创建的img文件中已经写入了根文件系
eiota@eiota-Default-string:~/rootfs$ ls -l
total 84
lrwxrwxrwx   1 root root     7 2月   1  2021 bin -> usr/bin
drwxr-xr-x   2 root root  4096 3月  14 11:09 dev
drwxr-xr-x 111 root root  4096 3月  14 09:31 etc
drwxr-xr-x   3 root root  4096 3月  14 11:16 home
lrwxrwxrwx   1 root root     7 6月  24  2021 lib -> usr/lib
drwx------   2 root root 16384 9月  20 19:01 lost+found
drwxr-xr-x   3 root root  4096 3月  14 11:16 media
drwxr-xr-x   2 root root  4096 3月  14 11:16 mnt
drwxr-xr-x   2 root root  4096 3月  14 11:16 opt
dr-xr-xr-x   2 root root  4096 3月  14 11:16 proc
drwx------   3 root root  4096 3月  14 11:16 root
drwxr-xr-x   2 root root  4096 3月  14 11:16 run
lrwxrwxrwx   1 root root     8 2月   1  2021 sbin -> usr/sbin
drwxr-xr-x   2 root root  4096 12月 30 14:15 snap
drwxr-xr-x   2 root root  4096 2月   1  2021 srv
dr-xr-xr-x   2 root root  4096 8月   4  2017 sys
drwxr-xr-x   4 root root  4096 3月  14 11:16 system
drwxrwxrwt   7 root root  4096 3月  14 11:16 tmp
drwxr-xr-x  11 root root  4096 3月  14 11:16 usr
drwxr-xr-x  14 root root  4096 3月  14 11:16 var
drwxr-xr-x   3 root root  4096 3月  14 11:16 vendor

#卸载2个img文件
eiota@eiota-Default-string:~$ sudo umount rootfs
eiota@eiota-Default-string:~$ sudo umount img

5. 编译生成整个烧写的映像文件

上面的操作是生成了ubuntu的根文件系统,要生成整个烧写映像文件,需要在RK3568 SDK目录下执行全部编译操作,这个操作会打包uboot, kernel, 根文件系统,芯片内部引层程序等。如下图操作。

把上面生成的rootfs20.04.5.img重命名为rk356x_ubuntu_rootfs.img,用于SDK编译生时调用
eiota@eiota-Default-string:~/icore-3568jq/ubuntu_rootfs$ ls -l
total 10794340
-rw-r--r-- 1 eiota eiota 3094016000 3月  14 17:51 rk356x_ubuntu_rootfs.img
-rw-rw-r-- 1 eiota eiota  369150429 12月 12 17:58 ubuntu_18.04_RK3568_ext4_v2.10-42-g50c7f0ac_20220120-1924_DESKTOP.7z
-rw-r--r-- 1 eiota eiota 2225065984 1月  21  2022 ubuntu_18.04_RK3568_ext4_v2.10-42-g50c7f0ac_20220120-1924_DESKTOP.img
-rw-r--r-- 1 eiota eiota 3094016000 3月  14 18:10 Ubuntu20.04.5LTS_Firefly_ext4_202303141457.img
-rw-r--r-- 1 eiota eiota 2453487616 3月  14 17:52 Ubuntu20.04-Lxqt_RK3568_v2.11-110_20220920.img
#
root@eiota-Default-string:~/icore-3568jq# ./build.sh
processing option: allff
============================================
TARGET_ARCH=arm64
TARGET_PLATFORM=rk356x
TARGET_UBOOT_CONFIG=firefly-rk3568
TARGET_SPL_CONFIG=
TARGET_KERNEL_CONFIG=firefly_linux_defconfig
TARGET_KERNEL_DTS=rk3568-UEJR-004-mipi
TARGET_TOOLCHAIN_CONFIG=
TARGET_BUILDROOT_CONFIG=
TARGET_RECOVERY_CONFIG=
TARGET_PCBA_CONFIG=
TARGET_RAMBOOT_CONFIG=
============================================
============Start building uboot============
TARGET_UBOOT_CONFIG=firefly-rk3568
=========================================
## make firefly-rk3568_defconfig -j8
#
# configuration written to .config
#
scripts/kconfig/conf  --silentoldconfig Kconfig
  CHK     include/config.h
  GEN     include/autoconf.mk.dep
  CFG     tpl/u-boot.cfg
  CFG     u-boot.cfg
  CFG     spl/u-boot.cfg
  GEN     include/autoconf.mk
  GEN     tpl/include/autoconf.mk
  GEN     spl/include/autoconf.mk
  CHK     include/config/uboot.release
  CHK     include/generated/timestamp_autogenerated.h
  UPD     include/generated/timestamp_autogenerated.h
  CHK     include/config.h
  CFG     u-boot.cfg
  CHK     include/generated/version_autogenerated.h
  CHK     include/generated/asm-offsets.h
  CHK     include/generated/generic-asm-offsets.h
  HOSTCC  tools/mkenvimage.o
  HOSTCC  tools/fit_image.o
  HOSTCC  tools/image-host.o
  HOSTCC  tools/dumpimage.o
  HOSTCC  tools/rockchip/boot_merger.o
  HOSTCC  tools/mkimage.o
  HOSTCC  tools/rockchip/loaderimage.o
  HOSTLD  tools/mkenvimage
  HOSTLD  tools/loaderimage
  HOSTLD  tools/dumpimage
  HOSTLD  tools/mkimage
  HOSTLD  tools/boot_merger
  CC      arch/arm/cpu/armv8/fwcall.o
  LD      arch/arm/cpu/armv8/built-in.o
  CC      common/main.o
  CC      cmd/version.o
  LD      cmd/built-in.o
  LD      common/built-in.o
  CC      drivers/usb/gadget/f_fastboot.o
  CC      lib/display_options.o
  LD      drivers/usb/gadget/built-in.o
  LD      lib/built-in.o
  LD      u-boot
  OBJCOPY u-boot.srec
  OBJCOPY u-boot-nodtb.bin
  SYM     u-boot.sym
start=$(/home/eiota/icore-3568jq/prebuilts/gcc/linux-x86/aarch64/gcc-linaro-6.3.1-2017.05-x86_64_aarch64-linux-gnu/bin/aarch64-linux-gnu-nm u-boot | grep __rel_dyn_start | cut -f 1 -d ' '); end=$(/home/eiota/icore-3568jq/prebuilts/gcc/linux-x86/aarch64/gcc-linaro-6.3.1-2017.05-x86_64_aarch64-linux-gnu/bin/aarch64-linux-gnu-nm u-boot | grep __rel_dyn_end | cut -f 1 -d ' '); tools/relocate-rela u-boot-nodtb.bin 0x00a00000 $start $end
make[2]: 'arch/arm/dts/rk3568-firefly.dtb' is up to date.
  COPY    u-boot.dtb
  CAT     u-boot-dtb.bin
  MKIMAGE u-boot.img
  MKIMAGE u-boot-dtb.img
  COPY    u-boot.bin
  ALIGN   u-boot.bin
  CC      spl/common/spl/spl.o
  CC      spl/arch/arm/cpu/armv8/fwcall.o
  CC      tpl/arch/arm/mach-rockchip/tpl.o
  COPY    spl/u-boot-spl.dtb
  LD      spl/arch/arm/cpu/armv8/built-in.o
  LD      spl/common/spl/built-in.o
  CC      tpl/arch/arm/cpu/armv8/fwcall.o
  LD      tpl/arch/arm/mach-rockchip/built-in.o
  LD      tpl/arch/arm/cpu/armv8/built-in.o
  CC      spl/lib/display_options.o
  LD      spl/lib/built-in.o
  LD      tpl/u-boot-tpl
  OBJCOPY tpl/u-boot-tpl-nodtb.bin
  COPY    tpl/u-boot-tpl.bin
  LD      spl/u-boot-spl
  OBJCOPY spl/u-boot-spl-nodtb.bin
  CAT     spl/u-boot-spl-dtb.bin
  COPY    spl/u-boot-spl.bin
  CFGCHK  u-boot.cfg
SEC=1
pack u-boot.itb okay! Input: /home/eiota/icore-3568jq/rkbin/RKTRUST/RK3568TRUST.ini

FIT description: FIT Image with ATF/OP-TEE/U-Boot/MCU
Created:         Wed Mar 15 10:08:58 2023
 Image 0 (uboot)
  Description:  U-Boot
  Created:      Wed Mar 15 10:08:58 2023
  Type:         Standalone Program
  Compression:  uncompressed
  Data Size:    1243872 Bytes = 1214.72 KiB = 1.19 MiB
  Architecture: AArch64
  Load Address: 0x00a00000
  Entry Point:  unavailable
  Hash algo:    sha256
  Hash value:   86a81609918caa751fcdae33683bf4f5adc61434160e17bb95fbf66f2abc93b7
 Image 1 (atf-1)
  Description:  ARM Trusted Firmware
  Created:      Wed Mar 15 10:08:58 2023
  Type:         Firmware
  Compression:  uncompressed
  Data Size:    163840 Bytes = 160.00 KiB = 0.16 MiB
  Architecture: AArch64
  Load Address: 0x00040000
  Hash algo:    sha256
  Hash value:   6204b6f381d2ad6175ffa52cc82abe8c934eb23aaf8a00c7db2dda0367449fdc
 Image 2 (atf-2)
  Description:  ARM Trusted Firmware
  Created:      Wed Mar 15 10:08:58 2023
  Type:         Firmware
  Compression:  uncompressed
  Data Size:    40960 Bytes = 40.00 KiB = 0.04 MiB
  Architecture: AArch64
  Load Address: 0xfdcc1000
  Hash algo:    sha256
  Hash value:   5563d929dab73f22d2229dd7933b58de3dd6553334fc653502e97b1bd561365f
 Image 3 (atf-3)
  Description:  ARM Trusted Firmware
  Created:      Wed Mar 15 10:08:58 2023
  Type:         Firmware
  Compression:  uncompressed
  Data Size:    20267 Bytes = 19.79 KiB = 0.02 MiB
  Architecture: AArch64
  Load Address: 0x0006a000
  Hash algo:    sha256
  Hash value:   b04372ab0f84e300cccc8281c5ecfe73111b211f223491be16d2a5d7e1587c7c
 Image 4 (atf-4)
  Description:  ARM Trusted Firmware
  Created:      Wed Mar 15 10:08:58 2023
  Type:         Firmware
  Compression:  uncompressed
  Data Size:    8192 Bytes = 8.00 KiB = 0.01 MiB
  Architecture: AArch64
  Load Address: 0xfdcd0000
  Hash algo:    sha256
  Hash value:   b46eaa95b8be8ee3e8e1cacf59ac20c8ea85e4f61c4441cc85d520750274003f
 Image 5 (atf-5)
  Description:  ARM Trusted Firmware
  Created:      Wed Mar 15 10:08:58 2023
  Type:         Firmware
  Compression:  uncompressed
  Data Size:    8192 Bytes = 8.00 KiB = 0.01 MiB
  Architecture: AArch64
  Load Address: 0xfdcce000
  Hash algo:    sha256
  Hash value:   2f8839c8032a60fdcad5abdd39b5d7d0cdb937a946b009a2c674e9d6304f10e6
 Image 6 (atf-6)
  Description:  ARM Trusted Firmware
  Created:      Wed Mar 15 10:08:58 2023
  Type:         Firmware
  Compression:  uncompressed
  Data Size:    7732 Bytes = 7.55 KiB = 0.01 MiB
  Architecture: AArch64
  Load Address: 0x00068000
  Hash algo:    sha256
  Hash value:   6e9d32ba2391ea86ec585080eebb4c76fae7b5363dca1a69e6035ba3e4491bc8
 Image 7 (optee)
  Description:  OP-TEE
  Created:      Wed Mar 15 10:08:58 2023
  Type:         Firmware
  Compression:  uncompressed
  Data Size:    457112 Bytes = 446.40 KiB = 0.44 MiB
  Architecture: AArch64
  Load Address: 0x08400000
  Hash algo:    sha256
  Hash value:   66bbd173528d12e9739c336926e33ee1ac1f4c7078fcac5712eeb8747d02163e
 Image 8 (fdt)
  Description:  U-Boot dtb
  Created:      Wed Mar 15 10:08:58 2023
  Type:         Flat Device Tree
  Compression:  uncompressed
  Data Size:    15719 Bytes = 15.35 KiB = 0.01 MiB
  Architecture: AArch64
  Hash algo:    sha256
  Hash value:   bf758d1c80fd4a1a2fbebd3277ddb5bf40e4fe4dff6f4e9d35b2939dccc2c8fd
 Default Configuration: 'conf'
 Configuration 0 (conf)
  Description:  rk3568-firefly
  Kernel:       unavailable
  Firmware:     atf-1
  FDT:          fdt
  Loadables:    uboot
                atf-2
                atf-3
                atf-4
                atf-5
                atf-6
                optee
********boot_merger ver 1.2********
Info:Pack loader ok.
pack loader(SPL) okay! Input: /home/eiota/icore-3568jq/rkbin/RKBOOT/RK3568MINIALL.ini

/home/eiota/icore-3568jq/u-boot
pack loader with new: spl/u-boot-spl.bin

Image(no-signed, version=0): uboot.img (FIT with uboot, trust...) is ready
Image(no-signed): rk356x_spl_loader_v1.13.112.bin (with spl, ddr...) is ready
pack uboot.img okay! Input: /home/eiota/icore-3568jq/rkbin/RKTRUST/RK3568TRUST.ini

Platform RK3568 is build OK, with new .config(make firefly-rk3568_defconfig -j8)
/home/eiota/icore-3568jq/prebuilts/gcc/linux-x86/aarch64/gcc-linaro-6.3.1-2017.05-x86_64_aarch64-linux-gnu/bin/aarch64-linux-gnu-
Wed Mar 15 10:08:58 CST 2023
Image Type:   Rockchip RK35 boot image
Init Data Size: 59392 bytes
Boot Data Size: 241664 bytes
Input:
    /home/eiota/icore-3568jq/rkbin/RKBOOT/RK3568MINIALL.ini
    /home/eiota/icore-3568jq/rkbin/bin/rk35/rk3568_ddr_1560MHz_v1.13.bin
    /home/eiota/icore-3568jq/rkbin/bin/rk35/rk356x_spl_v1.12.bin

Pack rk3568 idblock.bin okay!

Running build_uboot succeeded.
Skipping build_loader for missing configs:  RK_LOADER_BUILD_TARGET.
============Start building kernel============
TARGET_ARCH          =arm64
TARGET_KERNEL_CONFIG =firefly_linux_defconfig
TARGET_KERNEL_DTS    =rk3568-UEJR-004-mipi
TARGET_KERNEL_CONFIG_FRAGMENT =rk356x_linux.config
==========================================
/home/eiota/icore-3568jq
#
# configuration written to .config
#
Using .config as base
Merging ./arch/arm64/configs/rk356x_linux.config
Value of CONFIG_LEDS_TRIGGER_HEARTBEAT is redefined by fragment ./arch/arm64/configs/rk356x_linux.config:
Previous value: # CONFIG_LEDS_TRIGGER_HEARTBEAT is not set
New value: CONFIG_LEDS_TRIGGER_HEARTBEAT=y

Value of CONFIG_USB_SERIAL_CH341 is redefined by fragment ./arch/arm64/configs/rk356x_linux.config:
Previous value: # CONFIG_USB_SERIAL_CH341 is not set
New value: CONFIG_USB_SERIAL_CH341=y

Value of CONFIG_MOTORCOMM_PHY is redefined by fragment ./arch/arm64/configs/rk356x_linux.config:
Previous value: # CONFIG_MOTORCOMM_PHY is not set
New value: CONFIG_MOTORCOMM_PHY=y

Value of CONFIG_VIDEO_VM149C is redefined by fragment ./arch/arm64/configs/rk356x_linux.config:
Previous value: # CONFIG_VIDEO_VM149C is not set
New value: CONFIG_VIDEO_VM149C=y

#
# merged configuration written to .config (needs make)
#
scripts/kconfig/conf  --oldconfig Kconfig
#
# configuration written to .config
#
scripts/kconfig/conf  --syncconfig Kconfig
  CALL    scripts/checksyscalls.sh
  CHK     include/generated/compile.h
  GZIP    kernel/config_data.gz
  Image:  kernel.img is ready
  CALL    scripts/checksyscalls.sh
  Building modules, stage 2.
  MODPOST 455 modules
found ./arch/arm64/boot/dts/rockchip/.rk3568-UEJR-004-mipi.dtb.dts.tmp
found ./arch/arm64/boot/dts/rockchip/.rk3568-UEJR-004-mipi.dtb.dts.tmp
found ./arch/arm64/boot/dts/rockchip/.rk3568-UEJR-004-mipi.dtb.dts.tmp
found ./arch/arm64/boot/dts/rockchip/.rk3568-UEJR-004-mipi.dtb.dts.tmp
found ./arch/arm64/boot/dts/rockchip/.rk3568-UEJR-004-mipi.dtb.dts.tmp
found ./arch/arm64/boot/dts/rockchip/.rk3568-UEJR-004-mipi.dtb.dts.tmp
found ./arch/arm64/boot/dts/rockchip/.rk3568-UEJR-004-mipi.dtb.dts.tmp
  Image:  resource.img (with rk3568-UEJR-004-mipi.dtb logo.bmp logo_kernel.bmp) is ready
  Image:  boot.img (with Image ramdisk.img resource.img) is ready
  Image:  zboot.img (with Image.lz4 ramdisk.img resource.img) is ready
 Generate extLinuxBoot image start
  INSTALL arch/arm64/crypto/chacha-neon.ko
  INSTALL arch/arm64/crypto/poly1305-neon.ko
  INSTALL crypto/xor.ko
  INSTALL drivers/md/dm-bio-prison.ko
...
  INSTALL net/xfrm/xfrm_user.ko
  DEPMOD  4.19.232
Running build_extboot succeeded.
Skipping build_toolchain for missing configs:  RK_CFG_TOOLCHAIN.
Skipping build_buildroot for missing configs:  RK_CFG_BUILDROOT.
buildroot/output//images/rootfs.ext4 not generated?
Running build_rootfs succeeded.
==========Start building recovery==========
TARGET_RECOVERY_CONFIG=
========================================
config is 
use prebuilt rk356x-recovery-arm64.cpio.gz for CPIO image
found kernel image
pack recovery.img...fdt {
kernel {
ramdisk {
resource {
FIT description: U-Boot FIT source file for arm
Created:         Wed Mar 15 10:09:42 2023
 Image 0 (fdt)
  Description:  unavailable
  Created:      Wed Mar 15 10:09:42 2023
  Type:         Flat Device Tree
  Compression:  uncompressed
  Data Size:    138801 Bytes = 135.55 KiB = 0.13 MiB
  Architecture: AArch64
  Load Address: 0xffffff00
  Hash algo:    sha256
  Hash value:   d34058503ee772fba2aa20cef2d788cefac74f816f9112f222caa3c872a87257
 Image 1 (kernel)
  Description:  unavailable
  Created:      Wed Mar 15 10:09:42 2023
  Type:         Kernel Image
  Compression:  uncompressed
  Data Size:    24686600 Bytes = 24108.01 KiB = 23.54 MiB
  Architecture: AArch64
  OS:           Linux
  Load Address: 0xffffff01
  Entry Point:  0xffffff01
  Hash algo:    sha256
  Hash value:   90f3d004810533c72626b6d73a2e1ec841015fac19734275a05f2cc5c5b70306
 Image 2 (ramdisk)
  Description:  unavailable
  Created:      Wed Mar 15 10:09:42 2023
  Type:         RAMDisk Image
  Compression:  uncompressed
  Data Size:    8629789 Bytes = 8427.53 KiB = 8.23 MiB
  Architecture: AArch64
  OS:           Linux
  Load Address: 0xffffff02
  Entry Point:  unavailable
  Hash algo:    sha256
  Hash value:   afa9465ba81dd6c9dcf5c6ebab3a799108cf5a04f002ae2b75b1dcffa7814861
 Image 3 (resource)
  Description:  unavailable
  Created:      Wed Mar 15 10:09:42 2023
  Type:         Multi-File Image
  Compression:  uncompressed
  Data Size:    397312 Bytes = 388.00 KiB = 0.38 MiB
  Hash algo:    sha256
  Hash value:   9c5153fd1d719a7ff1351450857e622a6a0584eb0cb95b85b143fc2225088881
 Default Configuration: 'conf'
 Configuration 0 (conf)
  Description:  unavailable
  Kernel:       kernel
  Init Ramdisk: ramdisk
  FDT:          fdt
done.
you take 0:01.62 to build recovery
====Build recovery ok!====
Running build_recovery succeeded.
Skipping build_ramboot for missing configs:  RK_CFG_RAMBOOT.
Running build_all succeeded.
/usr/bin/fakeroot
 Source buildroot/build/envsetup.sh 
 Linking parameter.txt from /home/eiota/icore-3568jq/device/rockchip/rk356x/parameter-ubuntu-fit.txt... 
 Done linking parameter.txt 
 Linking uboot.img from /home/eiota/icore-3568jq/u-boot/uboot.img... 
 Done linking uboot.img 
 Linking MiniLoaderAll.bin from /home/eiota/icore-3568jq/u-boot/rk356x_spl_loader_v1.13.112.bin... 
 Done linking MiniLoaderAll.bin 
 Linking boot.img from /home/eiota/icore-3568jq/kernel/extboot.img... 
 Done linking boot.img 
 Linking misc.img from /home/eiota/icore-3568jq/device/rockchip/rockimg/misc.img... 
 Fallback to /home/eiota/icore-3568jq/device/rockchip/rockimg/wipe_all-misc.img 
 Done linking misc.img 
 Linking rootfs.img from /home/eiota/icore-3568jq/ubuntu_rootfs/rk356x_ubuntu_rootfs.img... 
 Done linking rootfs.img 
 Images in /home/eiota/icore-3568jq/rockdev are ready! 
Make image ok!
File name is  UEJR-004-MIPI_Rk356x_v1.3.0b_230315.img
Rename the file? [N|y]Make update.img
start to make update.img...
Resize rootfs partition size
dumpe2fs 1.44.1 (24-Mar-2018)
Android Firmware Package Tool v2.0
------ PACKAGE ------
Add file: ./package-file
package-file,Add file: ./package-file done,offset=0x800,size=0x11a,userspace=0x1
Add file: ./Image/MiniLoaderAll.bin
bootloader,Add file: ./Image/MiniLoaderAll.bin done,offset=0x1000,size=0x689c0,userspace=0xd2
Add file: ./Image/parameter.txt
parameter,Add file: ./Image/parameter.txt done,offset=0x6a000,size=0x1de,userspace=0x1
Add file: ./Image/uboot.img
uboot,Add file: ./Image/uboot.img done,offset=0x6a800,size=0x400000,userspace=0x800
Add file: ./Image/misc.img
misc,Add file: ./Image/misc.img done,offset=0x46a800,size=0xc000,userspace=0x18
Add file: ./Image/boot.img
boot,Add file: ./Image/boot.img done,offset=0x476800,size=0x8000000,userspace=0x10000
Add file: ./Image/recovery.img
recovery,Add file: ./Image/recovery.img done,offset=0x8476800,size=0x2049e00,userspace=0x4094
Add file: ./Image/rootfs.img
rootfs,Add file: ./Image/rootfs.img done,offset=0xa4c0800,size=0xb86af000,userspace=0x170d5e
Add CRC...
Make firmware OK!
------ OK ------
********rkImageMaker ver 2.0********
Generating new image, please wait...
Writing head info...
Writing boot file...
Writing firmware...
Generating MD5 data...
MD5 data generated successfully!
New image generated successfully!
Making ./Image/update.img OK.
Make update image ok!
 /home/eiota/icore-3568jq/rockdev/pack/UEJR-004-MIPI_Rk356x_v1.3.0b_230315.img 
Running build_updateimg succeeded.

上面成功编译完成在/home/eiota/icore-3568jq/rockdev/pack/ 下生成了可用于烧写的全部映像文件UEJR-004-MIPI_Rk356x_v1.3.0b_230315.img,之后使用专用工具RKDevTool来烧写就可以了。

你可能感兴趣的:(Linux驱动开发,rootfs,打包,ubuntu,根文件系统)