sd‐card‐creation‐imx6ull - eaglelinuxplatform/meta-calixto-nxp GitHub Wiki

Detect the SD Card

Insert the SD Card in your Linux host machine

[!NOTE] We need to access the External Drive to be utilized by the target device. Run lsblk to help figure out what linux device has been reserved for your External Drive.

#Example: for DISK=/dev/sdX
lsblk
NAME   MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
sda      8:0    0 465.8G  0 disk
├─sda1   8:1    0   512M  0 part /boot/efi
└─sda2   8:2    0 465.3G  0 part /                <- Development Machine Root Partition
sdb      8:16   1   962M  0 disk                  <- microSD/USB Storage Device
└─sdb1   8:17   1   961M  0 part                  <- microSD/USB Storage Partition
#Thus you would use:
export DISK=/dev/sdb
#Example: for DISK=/dev/mmcblkX
lsblk
NAME      MAJ:MIN   RM   SIZE RO TYPE MOUNTPOINT
sda         8:0      0 465.8G  0 disk
├─sda1      8:1      0   512M  0 part /boot/efi
└─sda2      8:2      0 465.3G  0 part /                <- Development Machine Root Partition
mmcblk0     179:0    0   962M  0 disk                  <- microSD/USB Storage Device
└─mmcblk0p1 179:1    0   961M  0 part                  <- microSD/USB Storage Partition
#Thus you would use:
export DISK=/dev/mmcblk0

Create Partitions

Erase partition table/labels on microSD card

sudo dd if=/dev/zero of=${DISK} bs=1M count=10

Create Partition Layout

sudo sfdisk ${DISK} <<-__EOF__
1M,,L,*
__EOF__

Format Partition

for: DISK=/dev/mmcblkX
sudo mkfs.ext4 -L rootfs ${DISK}p1

for: DISK=/dev/sdX
sudo mkfs.ext4 -L rootfs ${DISK}1

Copy Images to SD Card

Bootloader

sudo dd if=u-boot-dtb.imx of=${DISK} seek=2 bs=512

Root Filesystem

tar --zstd -xvf rootfs.tar.zst -C /media/${USER}/rootfs