Debian NAND Flash Burning: Difference between revisions
(Installing Debian to the SOM's internal storage: debianized the page) |
(Correct install OS name) |
||
Line 132: | Line 132: | ||
The flashing scripts are located on the SD card at /usr/bin/: | The flashing scripts are located on the SD card at /usr/bin/: | ||
{{#switch: {{#var:SOC_SERIES}} | imx8 | imx9= | {{#switch: {{#var:SOC_SERIES}} | imx8 | imx9= | ||
install_debian.sh - Flash Debian into eMMC (Run and follow usage instructions) | |||
| | | | ||
install_debian.sh - Flash Debian into NAND flash or eMMC (Run and follow usage instructions) | |||
}} | }} | ||
{{#ifeq: {{#var:HARDWARE_NAME}}|VAR-SOM-MX6| | {{#ifeq: {{#var:HARDWARE_NAME}}|VAR-SOM-MX6| | ||
( | (install_debian_emmc.sh - This script is being called by install_debian.sh when choosing to install the rootfs to eMMC - it should not be called directly!) | ||
|}} | |}} | ||
Line 329: | Line 329: | ||
= Summary = | = Summary = | ||
We described the results of a Debian build, how to copy it to a bootable SD card and how to flash it to NAND and eMMC.<br> | We described the results of a Debian build, how to copy it to a bootable SD card and how to flash it to NAND and eMMC.<br> | ||
With our extended SD card and our recovery SD card we provide an installation script located at /usr/bin/ | With our extended SD card and our recovery SD card we provide an installation script located at /usr/bin/install_debian.sh. It is much safer to use it instead of flashing the system manually.<br> |
Latest revision as of 20:35, 28 April 2023
This page is using the default release mx8m-debian-bullseye-5.4-2.1.x-v1.4.
To view this page for a specific Variscite SoM and software release, please follow these steps:
- Visit variwiki.com
- Select your SoM
- Select the software release
Introduction
All SOMs can either boot from an SD card or from their internal storage.
The SOM's internal storage:
The Variscite DART-MX8M comes with eMMC, which holds U-Boot, the kernel image and the ext4 root file system.
eMMC structure
0-8 MiB : Non-partitioned space, saved for U-Boot.
8 MiB-End: "rootfs" - An ext4 partition containing the root file system (including Linux image and the device tree blobs under /boot).
Installing the Debian binaries
If you followed the Create a bootable SD card steps, the Debian binaries and the flashing scripts will be included in your SD card.
The flashing scripts are easy-to-use example scripts for flashing images into NAND flash / eMMC.
There is also a section below describing how to flash the images manually.
Images locations
Following is the directory structure on your SD card, which elaborates the files' location that the below installation scripts are expecting:
Prepare the images for flashing to eMMC
Plug the bootable SD card into your host machine and mount the rootfs partition - here we assume it is mounted on /media/rootfs.
Copy all the mentioned debian-built binaries to the SD card:
- Note: If you followed the Create an extended SD card steps, the flashing scripts and all relevant binaries are already included in your SD card, and the below commands are redundant!
Setup:
$ export DEBIAN_IMGS_PATH=~/debian_imx8mq-var-dart_debian_bullseye//tmp/deploy/images/imx8m-var-dart $ export P2_MOUNT_DIR=/media/rootfs/ $ sudo mkdir -p ${P2_MOUNT_DIR}/opt/images/Debian/
eMMC images:
U-Boot: $ sudo cp ${DEBIAN_IMGS_PATH}/imx-boot-imx8m-var-dart-sd.bin ${P2_MOUNT_DIR}/opt/images/Debian/imx-boot-sd.bin File System: $ sudo cp ${DEBIAN_IMGS_PATH}/-imx8m-var-dart.tar.gz ${P2_MOUNT_DIR}/opt/images/Debian/rootfs.tar.gz
Flashing scripts
The flashing scripts are located on the SD card at /usr/bin/:
install_debian.sh - Flash Debian into eMMC (Run and follow usage instructions)
Manual step-by-step flashing to eMMC
Flashing the eMMC requires several steps including partitioning, file system formatting and image extraction.
We recommend to use our provided scripts to perform this task.
Use the prepared SD card to boot the board and run the following:
$ export node=/dev/mmcblk1 $ cd /opt/images/Debian
Make sure the eMMC is not mounted:
$ umount ${node}p*
Delete current data on eMMC:
$ for((i=1; i<=16; i++)); do [ -e ${node}p${i} ] && dd if=/dev/zero of=${node}p${i} bs=1M count=1 conv=fsync; done $ dd if=/dev/zero of=${node} bs=1M count=8 conv=fsync
Create a partition table:
$ (echo n; echo p; echo 1; echo 16384; echo; echo p; echo w) | fdisk -u $node $ sync
Format the partitions:
$ mkfs.ext4 ${node}p1 -L rootfs $ sync
Flash U-Boot:
$ dd if=imx-boot-sd.bin of=${node} bs=1K seek=33 conv=fsync
Extract the rootfs archive:
$ mkdir /run/media/mmcblk1p2 $ mount ${node}p2 /run/media/mmcblk1p2 $ tar xvpf rootfs.tar.gz -C /run/media/mmcblk1p2 $ (cd /run/media/mmcblk1p2/boot; ln -fs imx8mq-var-dart-dt8mcustomboard.dtb imx8mq-var-dart-dt8mcustomboard.dtb) $ sync $ umount /run/media/mmcblk1p2
Summary
We described the results of a Debian build, how to copy it to a bootable SD card and how to flash it to NAND and eMMC.
With our extended SD card and our recovery SD card we provide an installation script located at /usr/bin/install_debian.sh. It is much safer to use it instead of flashing the system manually.