mkdir ~/bin
curl https://mirrors.tuna.tsinghua.edu.cn/git/git-repo -o repo
chmod a+x ~/bin/repo
PATH=${PATH}:~/bin
git config --global user.email "you@example.com"
git config --global user.name "Your Name"
mkdir fsl-auto-yocto-bsp
cd fsl-auto-yocto-bsp
python3 /home/djnakata/bin/repo init -u https://source.codeaurora.org/external/autobsps32/auto_yocto_bsp -b release/bsp30.0 --repo-url='https://mirrors.tuna.tsinghua.edu.cn/git/git-repo/'
python3 /home/djnakata/bin/repo sync
下载完Yocto开发环境之后,接着进行编译
./sources/meta-alb/scripts/host-prepare.sh
source nxp-setup-alb.sh -m s32g274ardb2
bitbake fsl-image-base
编译完毕之后,所需的目标文件存放在build_s32g274ardb2/tmp/deploy/images/s32g274ardb2下面
git clone https://source.codeaurora.org/external/autobsps32/u-boot
cd u-boot
git checkout -b bsp30.0-2020.04 bsp30.0-2020.04
make CROSS_COMPILE=/path/to/your/toolchain/dir/bin/aarch64-none-linux-gnu- s32g274ardb2
_defconfig
make CROSS_COMPILE=/path/to/your/toolchain/dir/bin/aarch64-none-linux-gnu-
git clone https://source.codeaurora.org/external/autobsps32/linux
cd linux
git checkout -b bsp30.0-5.10.41-rt bsp30.0-5.10.41-rt
make ARCH=arm64 CROSS_COMPILE=/path/to/your/toolchain/dir/bin/aarch64-none-linux-gnu- s32gen1_defconfig
make ARCH=arm64 CROSS_COMPILE=/path/to/your/toolchain/dir/bin/aarch64-none-linux-gnu-
编译好的image位于arch/arm64/boot目录下面,dtb文件位于arch/arm64/boot/dts/freescale目录下面
1) 如果是从Yocto进行编译,编译完成的image文件fsl-image-base-s32g274ardb2.sdcard位于build_s32g274ardb2/tmp/deploy/images/s32g274ardb2
然后使用dd命令进行burn up
sudo dd if=./fsl-image-base-s32g274ardb2.sdcard of=/dev/sdd bs=1M && sync
2) 如果想手动进行拷贝,需执行如下操作:
sudo fdisk /dev/sdd
Welcome to fdisk (util-linux 2.31.1).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.
Command (m for help): p
Disk /dev/sdd: 14.5 GiB, 15552479232 bytes, 30375936 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
Disklabel type: dos
Disk identifier: 0x1a3401e2
Command (m for help): n
Partition type
p primary (0 primary, 0 extended, 4 free)
e extended (container for logical partitions)
Select (default p): p
Partition number (1-4, default 1): 1
First sector (2048-30375935, default 2048): 8192
Last sector, +sectors or +size{K,M,G,T,P} (8192-30375935, default 30375935): +255M
Created a new partition 1 of type 'Linux' and of size 255 MiB.
Command (m for help): p
Disk /dev/sdd: 14.5 GiB, 15552479232 bytes, 30375936 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
Disklabel type: dos
Disk identifier: 0x1a3401e2
Device Boot Start End Sectors Size Id Type
/dev/sdd1 8192 530431 522240 255M 83 Linux
Command (m for help): n
Partition type
p primary (1 primary, 0 extended, 3 free)
e extended (container for logical partitions)
Select (default p): p
Partition number (2-4, default 2): 2
First sector (2048-30375935, default 2048): 530432
Last sector, +sectors or +size{K,M,G,T,P} (530432-30375935, default 30375935):
Created a new partition 2 of type 'Linux' and of size 14.2 GiB.
Command (m for help): p
Disk /dev/sdd: 14.5 GiB, 15552479232 bytes, 30375936 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
Disklabel type: dos
Disk identifier: 0x1a3401e2
Device Boot Start End Sectors Size Id Type
/dev/sdd1 8192 530431 522240 255M 83 Linux
/dev/sdd2 530432 30375935 29845504 14.2G 83 Linux
Command (m for help): t
Partition number (1,2, default 2): 1
Hex code (type L to list all codes): c
Changed type of partition 'Linux' to 'W95 FAT32 (LBA)'.
Command (m for help): t
Partition number (1,2, default 2): 2
Hex code (type L to list all codes): 83
Changed type of partition 'Linux' to 'Linux'.
Command (m for help): w
The partition table has been altered.
Calling ioctl() to re-read partition table.
Syncing disks.
sudo mkfs.vfat -n boot /dev/sdd1
sudo mkfs.ext3 -L rootfs /dev/sdd2
cd build_s32g274ardb2/tmp/deploy/images/s32g274ardb2
sudo dd if=u-boot.s32 of=/dev/sdd conv=notrunc bs=256 count=1 seek=0
sudo dd if=u-boot.s32 of=/dev/sdd conv=notrunc bs=512 seek=1 skip=1 (写u-boot到/dev/sdd)
sudo mount /dev/sdd1 /media/
sudo cp Image /media (拷贝kernel image到/dev/sdd1)
sudo cp fsl-s32g274a-rdb2.dtb /media/fsl-s32g274a-rdb2.dtb (拷贝dtb文件到/dev/sdd1)
sudo umount /media
sudo mount /dev/sdd2 /media
sudo tar xf fsl-image-base-s32g274ardb2.tar.gz -C /media (拷贝根文件系统到/dev/sdd2)
sudo umount /media
执行bitbake fsl-image-flash
生成.flashimage后缀的文件,整个进行烧写, 如下:
=> run flashbootargs
=> sf probe 6:0
=> setenv image fsl-image-flash-s32g274ardb2.flashimage
=> setenv loadaddr 0x85000000
=> run loadimage
=> sf erase ${uboot_flashaddr} +${filesize}
=> sf write ${loadaddr} ${uboot_flashaddr} ${filesize}
或者拷贝编译后生成的u-boot.s32, Image, fsl-s32g274a-rdb2.dtb,fsl-image-base-s32g274ardb2.cpio.gz.u-boot到SD卡中,然后在uboot命令行,通过如下命令进行烧写:
=> run flashbootargs
=> sf probe 6:0
1)u-boot
=> setenv image u-boot.s32
=> run loadimage
=> sf erase ${uboot_flashaddr} +${filesize}
=> sf write ${loadaddr} ${uboot_flashaddr} ${filesize}
2) linux kernel
=> setenv image Image
=> run loadimage
=> sf erase ${kernel_flashaddr} +${kernel_maxsize}
=> sf write ${loadaddr} ${kernel_flashaddr} ${kernel_maxsize}
3) Linux DTS
=> setenv image ${fdt_file}
=> run loadimage
=> sf erase ${fdt_flashaddr} +${fdt_maxsize}
=> sf write ${loadaddr} ${fdt_flashaddr} ${fdt_maxsize}
4) Linux filesystem
=> setenv Image fsl-image-base-s32g274ardb2.cpio.gz.u-boot
=> run loadimage
=> sf erase ${ramdisk_flashaddr} +${ramdisk_maxsize}
重新开机,然后使用QSPI的方式启动