imx8mm yocto_bsp 编译

在实际的项目中,根据使用的具体版本来进行下载。
其中-b 选择分支

https://source.codeaurora.org/external/imx/imx-manifest/tree/README?h=imx-linux-zeus


mkdir imx-yocto-bsp
sudo chmod 777 imx-yocto-bsp
cd imx-yocto-bsp
repo init -u https://source.codeaurora.org/external/imx/imx-manifest -b imx-linux-sumo -m imx-4.14.98-2.0.0_ga.xml
repo sync


fsl-setup-release.sh脚本会对参数如下的三个参数进行解析

DISTRO=fsl-imx-wayland 
MACHINE=imx8mmevk source
-b imx8mmevk_wayland


DISTRO=fsl-imx-wayland MACHINE=imx8mmevk source fsl-setup-release.sh -b imx8mmevk_wayland
这个命令使用sources文件夹,
fsl-setup-release.sh以及setup-environment生成imx8mmevk_wayland目录以及子目local/local.conf文件。
如果想在local.conf中增加内容,
比如增加CORE_IMAGE_EXTRA_INSTALL += "dhcp-server iperf2",那么可以在fsl-setup-release.sh文件中
echo BSPDIR=$BSPDIR之前增加以下命令:
echo "CORE_IMAGE_EXTRA_INSTALL += \"dhcp-server iperf2\"" >> $BUILD_DIR/conf/local.conf
然后执行DISTRO=fsl-imx-wayland MACHINE=imx8mmevk source fsl-setup-release.sh -b imx8mmevk_wayland,就会更新local.conf文件

bitbake fsl-image-validation-imx     编译基于wayland 的支持GUI 的测试镜像

在下面的链接中下载文档,主要参考i.MX_Yocto_Project_User's_Guide.pdfi.MX Developer Resources | NXP Semiconductorshttps://www.nxp.com/design/i-mx-developer-resources:IMXSW_HOMEimx8mm yocto_bsp 编译_第1张图片

下面的链接中也有对imx_linux_zeus 这个分子进行介绍说明如何编译

README - imx-manifest - i.MX Release Manifesthttps://source.codeaurora.org/external/imx/imx-manifest/tree/README?h=imx-linux-zeus

imx8mm yocto_bsp 编译_第2张图片

imx8mm yocto_bsp 编译_第3张图片

可以在下面的链接中搜索想要编译到文件系统中的bb recipes,其中已tcpdump为例

OpenEmbedded Layer Index - recipeshttp://layers.openembedded.org/layerindex/branch/master/recipes/?q=tcpdump

imx8mm yocto_bsp 编译_第4张图片

2:内核编译(Image-imx8mmevk.bin)

注意看其中的linux-imx_4.14.98.bb 

imx8mm yocto_bsp 编译_第5张图片

bitbake -v -c clean linux-imx

bitbake -v  linux-imx

对应编译日志如下:由此可以知道上面bb中的mkdir -p ${B} B只的是build

$<50>+ do_copy_defconfig
+ install -d /home/linshubin/origin_imx-yocto-bsp/imx8mmevk_wayland/tmp/work/imx8mmevk-poky-linux/linux-imx/4.14.98-r0/build

$<50>+ [ no = yes ]
+ mkdir -p /home/linshubin/origin_imx-yocto-bsp/imx8mmevk_wayland/tmp/work/imx8mmevk-poky-linux/linux-imx/4.14.98-r0/build

$<50>+ cp /home/linshubin/origin_imx-yocto-bsp/imx8mmevk_wayland/tmp/work/imx8mmevk-poky-linux/linux-imx/4.14.98-r0/git/arch/arm64/configs/defconfig /home/linshubin/origin_imx-yocto-bsp/imx8mmevk_wayland/tmp/work/imx8mmevk-poky-linux/linux-imx/4.14.98-r0/build/.config

$<50>+ cp /home/linshubin/origin_imx-yocto-bsp/imx8mmevk_wayland/tmp/work/imx8mmevk-poky-linux/linux-imx/4.14.98-r0/git/arch/arm64/configs/defconfig /home/linshubin/origin_imx-yocto-bsp/imx8mmevk_wayland/tmp/work/imx8mmevk-poky-linux/linux-imx/4.14.98-r0/build/../defconfig

编译完成之后,有如何生成的文件

imx8mm yocto_bsp 编译_第6张图片

如果要能烧写到imx中还需要额外的文件 先将系统中内核挂载出来。

root@imx8mmevk:~/kernel# cat /proc/partitions 
major minor  #blocks  name

  31        0      32768 mtdblock0
 179        0    7761920 mmcblk1
 179        1      65536 mmcblk1p1
 179        2    1613824 mmcblk1p2
 179       32   15388672 mmcblk2
 179       33       4096 mmcblk2p1
 179       34       4096 mmcblk2p2
 179       35      65536 mmcblk2p3
 179       36      65536 mmcblk2p4
 179       37      65536 mmcblk2p5
 179       38      65536 mmcblk2p6
 179       39       4096 mmcblk2p7
 179       40      16384 mmcblk2p8
 179       41       1024 mmcblk2p9
 179       42    4194304 mmcblk2p10
 179       43    9127936 mmcblk2p11
 179       44       1024 mmcblk2p12
 179       45       1024 mmcblk2p13
 179       46       1024 mmcblk2p14
 179      128       4096 mmcblk2rpmb
 179       96       4096 mmcblk2boot1
 179       64       4096 mmcblk2boot0
root@imx8mmevk:~/kernel# df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/root       1.5G  1.2G  146M  90% /
devtmpfs        659M  4.0K  659M   1% /dev
tmpfs           979M     0  979M   0% /dev/shm
tmpfs           979M  8.5M  971M   1% /run
tmpfs           979M     0  979M   0% /sys/fs/cgroup
tmpfs           979M     0  979M   0% /tmp
tmpfs           979M  248K  979M   1% /var/volatile
/dev/mmcblk2p8   12M  176K   11M   2% /run/media/mmcblk2p8
/dev/mmcblk1p1   64M   23M   42M  36% /home/root/kernel
tmpfs           196M     0  196M   0% /run/user/0
root@imx8mmevk:~/kernel# ls -alh //home/root/kernel
total 23M
drwxrwx--- 3 root disk  16K Jan  1  1970 .
drwx------ 5 root root 4.0K Sep 19 23:42 ..
-rwxrwx--- 1 root disk  23M Mar 11  2022 Image
drwxrwx--- 2 root disk 2.0K Mar 11  2022 System Volume Information
-rwxrwx--- 1 root disk  44K Mar 11  2022 fsl-imx8mm-ddr4-evk-rm67191.dtb
-rwxrwx--- 1 root disk  44K Mar 11  2022 fsl-imx8mm-ddr4-evk.dtb
-rwxrwx--- 1 root disk  44K Mar 11  2022 fsl-imx8mm-ddr4-qca9377-evk.dtb
-rwxrwx--- 1 root disk  43K Mar 11  2022 fsl-imx8mm-evk-ak4497.dtb
-rwxrwx--- 1 root disk  43K Mar 11  2022 fsl-imx8mm-evk-ak5558.dtb
-rwxrwx--- 1 root disk  43K Mar 11  2022 fsl-imx8mm-evk-audio-tdm.dtb
-rwxrwx--- 1 root disk  22K Mar 11  2022 fsl-imx8mm-evk-inmate.dtb
-rwxrwx--- 1 root disk  43K Mar 11  2022 fsl-imx8mm-evk-m4.dtb
-rwxrwx--- 1 root disk  43K Mar 11  2022 fsl-imx8mm-evk-revb-rm67191.dtb
-rwxrwx--- 1 root disk  43K Mar 11  2022 fsl-imx8mm-evk-revb.dtb
-rwxrwx--- 1 root disk  43K Mar 11  2022 fsl-imx8mm-evk-rm67191.dtb
-rwxrwx--- 1 root disk  43K Mar 11  2022 fsl-imx8mm-evk-root.dtb
-rwxrwx--- 1 root disk  43K Mar 11  2022 fsl-imx8mm-evk.dtb
-rwxrwx--- 1 root disk 6.2K Mar 11  2022 imx8mm_m4_TCM_hello_world.bin
-rwxrwx--- 1 root disk  17K Mar 11  2022 imx8mm_m4_TCM_rpmsg_lite_pingpong_rtos_linux_remote.bin
-rwxrwx--- 1 root disk  17K Mar 11  2022 imx8mm_m4_TCM_rpmsg_lite_str_echo_rtos.bin
-rwxrwx--- 1 root disk  40K Mar 11  2022 imx8mm_m4_TCM_sai_low_power_audio.bin
root@imx8mmevk:~/kernel# 

在执行bitbake -c compile  -v fsl-image-validation-imx 得日志过程中

 其中image_types_fsl.bbclass包含升级可升级的boot.img的过程

linshubin@fcrdsw-13:~/origin_imx-yocto-bsp/sources$ grep -srn "_generate_boot_image" ./
./meta-fsl-bsp-release/imx/meta-bsp/classes/image_types_fsl.bbclass:123:_generate_boot_image() {
./meta-fsl-bsp-release/imx/meta-bsp/classes/image_types_fsl.bbclass:259:        _generate_boot_image 1
./meta-fsl-bsp-release/imx/meta-bsp/classes/image_types_fsl.bbclass:337:                _generate_boot_image 2
linshubin@fcrdsw-13:~/origin_imx-yocto-bsp/sources$ 
linshubin@fcrdsw-13:~/origin_imx-yocto-bsp/sources$ grep -srn "BOOT_SCRIPTS" ./
./meta-fsl-bsp-release/imx/meta-bsp/classes/image_types_fsl.bbclass:143:        for item in ${BOOT_SCRIPTS}; do
linshubin@fcrdsw-13:~/origin_imx-yocto-bsp/sources$ 

imx8mm yocto_bsp 编译_第7张图片

其烧写文件为:boot.img 由下面的个文件组成

imx8mm yocto_bsp 编译_第8张图片

3: 文件系统

dd if=/dev/zero of=/home/linshubin/origin_imx-yocto-bsp/imx8mmevk_wayland/tmp/work/imx8mmevk-poky-linux/fsl-image-validation-imx/1.0-r0/deploy-fsl-image-validation-imx-image-complete/fsl-image-validation-imx-imx8mmevk-20220329061930.rootfs.ext4 seek=1400832 count=0 bs=1024

先生成空文件fsl-image-validation-imx-imx8mmevk-20220329061930.rootfs.ext4

之后再使用mkfs.ext4

mkfs.ext4 -F -i 4096 /home/linshubin/origin_imx-yocto-bsp/imx8mmevk_wayland/tmp/work/imx8mmevk-poky-linux/fsl-image-validation-imx/1.0-r0/deploy-fsl-image-validation-imx-image-complete/fsl-image-validation-imx-imx8mmevk-20220329061930.rootfs.ext4 -d /home/linshubin/origin_imx-yocto-bsp/imx8mmevk_wayland/tmp/work/imx8mmevk-poky-linux/fsl-image-validation-imx/1.0-r0/rootfs

r

分区信息如下:

imx8mm yocto_bsp 编译_第9张图片

 4:BootLoader

bitbake imx-boot  制作启动文件,其中包含了:
bitbake u-boot-imx 这个才是我们平时所谓的u-boot.bin 及u-boot-spl.bin

im8mm的boot 有多个文件组合而成的,并非仅仅只有一个传统的uboot文件

 imx8mm yocto_bsp 编译_第10张图片

imx8mm yocto_bsp 编译_第11张图片

imx8mm yocto_bsp 编译_第12张图片

 imx8mm yocto_bsp 编译_第13张图片

imx8mm yocto_bsp 编译_第14张图片

SD卡Image

imx8mm yocto_bsp 编译_第15张图片

 有上面整个打包过程可以知道:SDimage有三部分组成

1:imx-boot-imx8mmevk-sd.bin  这个就是flash.bin

2:boot.img

3:fsl-image-validation-imx-imx8mmevk-20220329061930.rootfs.ext4

dd if=/dev/zero of=/home/linshubin/origin_imx-yocto-bsp/imx8mmevk_wayland/tmp/work/imx8mmevk-poky-linux/fsl-image-validation-imx/1.0-r0/deploy-fsl-image-validation-imx-image-complete/fsl-image-validation-imx-imx8mmevk-20220329061930.rootfs.sdcard bs=1 count=0 seek=1518338048

parted -s /home/linshubin/origin_imx-yocto-bsp/imx8mmevk_wayland/tmp/work/imx8mmevk-poky-linux/fsl-image-validation-imx/1.0-r0/deploy-fsl-image-validation-imx-image-complete/fsl-image-validation-imx-imx8mmevk-20220329061930.rootfs.sdcard mklabel msdos
parted -s /home/linshubin/origin_imx-yocto-bsp/imx8mmevk_wayland/tmp/work/imx8mmevk-poky-linux/fsl-image-validation-imx/1.0-r0/deploy-fsl-image-validation-imx-image-complete/fsl-image-validation-imx-imx8mmevk-20220329061930.rootfs.sdcard unit KiB mkpart primary fat32 8192 73728
parted -s /home/linshubin/origin_imx-yocto-bsp/imx8mmevk_wayland/tmp/work/imx8mmevk-poky-linux/fsl-image-validation-imx/1.0-r0/deploy-fsl-image-validation-imx-image-complete/fsl-image-validation-imx-imx8mmevk-20220329061930.rootfs.sdcard unit KiB mkpart primary 73728 1474560
parted /home/linshubin/origin_imx-yocto-bsp/imx8mmevk_wayland/tmp/work/imx8mmevk-poky-linux/fsl-image-validation-imx/1.0-r0/deploy-fsl-image-validation-imx-image-complete/fsl-image-validation-imx-imx8mmevk-20220329061930.rootfs.sdcard print
Disk /home/linshubin/origin_imx-yocto-bsp/imx8mmevk_wayland/tmp/work/imx8mmevk-poky-linux/fsl-image-validation-imx/1.0-r0/deploy-fsl-image-validation-imx-image-complete/fsl-image-validation-imx-imx8mmevk-20220329061930.rootfs.sdcard: 1518MB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Disk Flags: 
Number  Start   End     Size    Type     File system  Flags
 1      8389kB  75.5MB  67.1MB  primary               lba
 2      75.5MB  1510MB  1434MB  primary
dd if=/home/linshubin/origin_imx-yocto-bsp/imx8mmevk_wayland/tmp/deploy/images/imx8mmevk/imx-boot-imx8mmevk-sd.bin of=/home/linshubin/origin_imx-yocto-bsp/imx8mmevk_wayland/tmp/work/imx8mmevk-poky-linux/fsl-image-validation-imx/1.0-r0/deploy-fsl-image-validation-imx-image-complete/fsl-image-validation-imx-imx8mmevk-20220329061930.rootfs.sdcard conv=notrunc seek=33 bs=1K
dd if=/home/linshubin/origin_imx-yocto-bsp/imx8mmevk_wayland/tmp/work/imx8mmevk-poky-linux/fsl-image-validation-imx/1.0-r0/boot.img of=/home/linshubin/origin_imx-yocto-bsp/imx8mmevk_wayland/tmp/work/imx8mmevk-poky-linux/fsl-image-validation-imx/1.0-r0/deploy-fsl-image-validation-imx-image-complete/fsl-image-validation-imx-imx8mmevk-20220329061930.rootfs.sdcard conv=notrunc,fsync seek=1 bs=8388608
dd if=/home/linshubin/origin_imx-yocto-bsp/imx8mmevk_wayland/tmp/work/imx8mmevk-poky-linux/fsl-image-validation-imx/1.0-r0/deploy-fsl-image-validation-imx-image-complete/fsl-image-validation-imx-imx8mmevk-20220329061930.rootfs.ext4 of=/home/linshubin/origin_imx-yocto-bsp/imx8mmevk_wayland/tmp/work/imx8mmevk-poky-linux/fsl-image-validation-imx/1.0-r0/deploy-fsl-image-validation-imx-image-complete/fsl-image-validation-imx-imx8mmevk-20220329061930.rootfs.sdcard conv=notrunc,fsync seek=1 bs=75497472

pbzip2 -f -k fsl-image-validation-imx-imx8mmevk-20220329061930.rootfs.sdcard
rm fsl-image-validation-imx-imx8mmevk-20220329061930.rootfs.sdcard
fsl-image-validation-imx-1.0-r0 do_image_sdcard: Creating symlink: /home/linshubin/origin_imx-yocto-bsp/imx8mmevk_wayland/tmp/work/imx8mmevk-poky-linux/fsl-image-validation-imx/1.0-r0/deploy-fsl-image-validation-imx-image-complete/fsl-image-validation-imx-imx8mmevk.sdcard.bz2 -> fsl-image-validation-imx-imx8mmevk-20220329061930.rootfs.sdcard.bz2

你可能感兴趣的:(NXP,iMx8mm,yocto_bsp,imx8mm)