Debian NAND Flash Burning: Difference between revisions
(Branch from Yocto_NAND_Flash_Burning (23:58, 18 January 2023)) |
(Installing Debian to the SOM's internal storage: debianized the page) |
||
Line 1: | Line 1: | ||
<!-- Set release according to "release" parameter in URL and use | <!-- Set release according to "release" parameter in URL and use mx8m-debian-bullseye-5.4-2.1.x-v1.4 as default | ||
--> {{INIT_RELEASE_PARAM| | --> {{INIT_RELEASE_PARAM|mx8m-debian-bullseye-5.4-2.1.x-v1.4}}<!-- | ||
-- | --> {{#lst:Debian_Platform_Customization|{{#var:RELEASE_PARAM}}}} <!-- | ||
--> {{#lst: | --> {{PageHeader|Installing Debian to the SOM's internal storage}} {{DocImage|category1=Debian|category2={{#var:HARDWARE_NAME}}}} __toc__ | ||
--> {{PageHeader|Installing | |||
= Introduction = | = Introduction = | ||
All SOMs can either boot from an SD card or from their internal storage.<br> | All SOMs can either boot from an SD card or from their internal storage.<br> | ||
Line 57: | Line 53: | ||
{{#switch: {{#var:SOC_SERIES}} | imx8 | imx9=|#default= | {{#switch: {{#var:SOC_SERIES}} | imx8 | imx9=|#default= | ||
= | = Debian Built binaries for NAND flash / eMMC = | ||
The resulting images are located at tmp/deploy/images/{{#var:MACHINE_NAME}}.<br> | The resulting images are located at tmp/deploy/images/{{#var:MACHINE_NAME}}.<br> | ||
{{#lst: | {{#lst:Debian_Platform_Customization|{{#var:DEBIAN_BUILD_RESULTS_SECTION}}}} | ||
}} | }} | ||
= Installing the | = Installing the Debian binaries = | ||
If you followed the [[ | If you followed the [[Debian_Build_Release#Create a bootable SD card |Create a bootable SD card]] steps, the [[#Images locations|Debian binaries]] and the [[#Flashing scripts|flashing scripts]] will be included in your SD card. <br> | ||
The flashing scripts are easy-to-use example scripts for flashing images into NAND flash / eMMC.<br> | The flashing scripts are easy-to-use example scripts for flashing images into NAND flash / eMMC.<br> | ||
There is also a section below describing how to [[#Manual step-by-step flashing to NAND flash / eMMC|flash the images manually]]. | There is also a section below describing how to [[#Manual step-by-step flashing to NAND flash / eMMC|flash the images manually]]. | ||
Line 71: | Line 66: | ||
== Images locations == | == Images locations == | ||
Following is the directory structure on your SD card, which elaborates the files' location that the below installation scripts are expecting: | Following is the directory structure on your SD card, which elaborates the files' location that the below installation scripts are expecting: | ||
{{#lst: | {{#lst:Debian_Platform_Customization|{{#var:SD_TREE_SECTION}}}} | ||
{{#switch: {{#var:SOC_SERIES}} | imx8 | imx9= | {{#switch: {{#var:SOC_SERIES}} | imx8 | imx9= | ||
Line 79: | Line 74: | ||
}} | }} | ||
Plug the bootable SD card into your host machine and mount the rootfs partition - here we assume it is mounted on /media/rootfs.<br> | Plug the bootable SD card into your host machine and mount the rootfs partition - here we assume it is mounted on /media/rootfs.<br> | ||
Copy all the mentioned | Copy all the mentioned debian-built binaries to the SD card: | ||
<br> | <br> | ||
* <span style="color:red">Note:</span> If you followed the [[ | * <span style="color:red">Note:</span> If you followed the [[Debian_Build_Release#Create an extended SD card |Create an extended SD card]] steps, the [[#Flashing scripts|flashing scripts]] and all relevant binaries are already included in your SD card, and the below commands are redundant!<br> | ||
Setup: | Setup: | ||
$ export | $ export DEBIAN_IMGS_PATH={{#var:BUILD_FOLDER}}/{{#var:BUILD_FOLDER_DISTRO}}/tmp/deploy/images/{{#var:MACHINE_NAME}} | ||
$ export P2_MOUNT_DIR=/media/rootfs/ | $ export P2_MOUNT_DIR=/media/rootfs/ | ||
$ sudo mkdir -p ${P2_MOUNT_DIR}/opt/images/ | $ sudo mkdir -p ${P2_MOUNT_DIR}/opt/images/Debian/ | ||
{{#switch: {{#var:SOC_SERIES}} | imx8 | imx9=|#default= | {{#switch: {{#var:SOC_SERIES}} | imx8 | imx9=|#default= | ||
Linux: | Linux: | ||
$ sudo cp ${ | $ sudo cp ${DEBIAN_IMGS_PATH}/{{#var:KERNEL_IMAGE}} ${P2_MOUNT_DIR}/opt/images/Debian/ | ||
Device Tree: | Device Tree: | ||
$ for f in ${ | $ for f in ${DEBIAN_IMGS_PATH}/*.dtb; do if <nowiki>[[ -L $f ]] && [[</nowiki> $f != *{{#var:MACHINE_NAME}}.dtb <nowiki>]]</nowiki>; then sudo cp $f ${P2_MOUNT_DIR}/opt/images/Debian/; fi done | ||
$ sudo rename 's/{{#var:KERNEL_IMAGE}}-imx/imx/' ${P2_MOUNT_DIR}/opt/images/ | $ sudo rename 's/{{#var:KERNEL_IMAGE}}-imx/imx/' ${P2_MOUNT_DIR}/opt/images/Debian/*.dtb | ||
NAND images: | NAND images: | ||
{{#ifeq: {{#var:SPL_SD_IMAGE_NAME}} | N/A ||SPL: | {{#ifeq: {{#var:SPL_SD_IMAGE_NAME}} | N/A ||SPL: | ||
$ sudo cp ${ | $ sudo cp ${DEBIAN_IMGS_PATH}/{{#var:SPL_NAND_IMAGE_NAME}} ${P2_MOUNT_DIR}/opt/images/Debian/ | ||
}} | }} | ||
U-Boot: | U-Boot: | ||
$ sudo cp ${ | $ sudo cp ${DEBIAN_IMGS_PATH}/{{#var:U-BOOT_NAND_IMAGE_NAME}} ${P2_MOUNT_DIR}/opt/images/Debian/ | ||
File System: | File System: | ||
$ sudo cp ${ | $ sudo cp ${DEBIAN_IMGS_PATH}/{{#var:DEFAULT_IMAGE_BB_NAME}}-{{#var:MACHINE_NAME}}.ubi ${P2_MOUNT_DIR}/opt/images/Debian/rootfs.ubi | ||
}} | }} | ||
eMMC images: | eMMC images: | ||
{{#ifeq: {{#var:HARDWARE_NAME}}|VAR-SOM-MX6|*'''VAR-SOM-MX6 and VAR-SOM-SOLO/DUAL''' | {{#ifeq: {{#var:HARDWARE_NAME}}|VAR-SOM-MX6|*'''VAR-SOM-MX6 and VAR-SOM-SOLO/DUAL''' | ||
File System: | File System: | ||
$ sudo cp ${ | $ sudo cp ${DEBIAN_IMGS_PATH}/{{#var:DEFAULT_IMAGE_BB_NAME}}-{{#var:MACHINE_NAME}}.tar.gz ${P2_MOUNT_DIR}/opt/images/Debian/rootfs.tar.gz | ||
|}} <!-- | |}} <!-- | ||
-->{{#ifeq: {{#var:HARDWARE_NAME}}|VAR-SOM-MX6|*'''DART-MX6'''|}} | -->{{#ifeq: {{#var:HARDWARE_NAME}}|VAR-SOM-MX6|*'''DART-MX6'''|}} | ||
{{#ifeq: {{#var:SPL_SD_IMAGE_NAME}} | N/A ||SPL: | {{#ifeq: {{#var:SPL_SD_IMAGE_NAME}} | N/A ||SPL: | ||
$ sudo cp ${ | $ sudo cp ${DEBIAN_IMGS_PATH}/{{#var:SPL_SD_IMAGE_NAME}} ${P2_MOUNT_DIR}/opt/images/Debian/ | ||
|}} | |}} | ||
Line 121: | Line 116: | ||
<br> | <br> | ||
U-Boot: | U-Boot: | ||
$ sudo cp ${ | $ sudo cp ${DEBIAN_IMGS_PATH}/imx-boot-{{#var:MACHINE_NAME}}-sd.bin ${P2_MOUNT_DIR}/opt/images/Debian/{{#var:U-BOOT_SD_IMAGE_NAME}} | ||
File System: | File System: | ||
$ sudo cp ${ | $ sudo cp ${DEBIAN_IMGS_PATH}/{{#var:DEFAULT_IMAGE_BB_NAME}}-{{#var:MACHINE_NAME}}.tar.gz ${P2_MOUNT_DIR}/opt/images/Debian/rootfs.tar.gz | ||
| | | | ||
<br> | <br> | ||
U-Boot: | U-Boot: | ||
$ sudo cp ${ | $ sudo cp ${DEBIAN_IMGS_PATH}/{{#var:U-BOOT_SD_IMAGE_NAME}} ${P2_MOUNT_DIR}/opt/images/Debian/ | ||
File System: | File System: | ||
$ sudo cp ${ | $ sudo cp ${DEBIAN_IMGS_PATH}/{{#var:DEFAULT_IMAGE_BB_NAME}}-{{#var:MACHINE_NAME}}.tar.gz ${P2_MOUNT_DIR}/opt/images/Debian/rootfs.tar.gz | ||
}} | }} | ||
Line 137: | 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_yocto.sh - Flash | install_yocto.sh - Flash Debian into eMMC (Run and follow usage instructions) | ||
| | | | ||
install_yocto.sh - Flash | install_yocto.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| | ||
Line 152: | Line 147: | ||
<br> | <br> | ||
<pre> | <pre> | ||
$ cd /opt/images/ | $ cd /opt/images/Debian | ||
</pre> | </pre> | ||
Line 182: | Line 177: | ||
Flash the Linux Kernel image & Device Tree:<br> | Flash the Linux Kernel image & Device Tree:<br> | ||
You need to use the right .dtb file for you hardware setup. See the [[# | You need to use the right .dtb file for you hardware setup. See the [[#Debian Built binaries for NAND flash / eMMC | table]] above for a complete description. | ||
{{#ifeq: {{#var:HARDWARE_NAME}}|VAR-SOM-MX6| | {{#ifeq: {{#var:HARDWARE_NAME}}|VAR-SOM-MX6| | ||
Line 211: | Line 206: | ||
* '''DART-MX6''' | * '''DART-MX6''' | ||
$ export node=/dev/mmcblk2 | $ export node=/dev/mmcblk2 | ||
$ cd /opt/images/ | $ cd /opt/images/Debian | ||
* '''VAR-SOM-MX6 and VAR-SOM-SOLO/DUAL''' | * '''VAR-SOM-MX6 and VAR-SOM-SOLO/DUAL''' | ||
}} | }} | ||
$ export node=/dev/{{#var:EMMC_ROOTFS_DEV}} | $ export node=/dev/{{#var:EMMC_ROOTFS_DEV}} | ||
$ cd /opt/images/ | $ cd /opt/images/Debian | ||
Make sure the eMMC is not mounted: | Make sure the eMMC is not mounted: | ||
Line 333: | Line 328: | ||
= Summary = | = Summary = | ||
We described the results of a | 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/install_yocto.sh. It is much safer to use it instead of flashing the system manually.<br> | With our extended SD card and our recovery SD card we provide an installation script located at /usr/bin/install_yocto.sh. It is much safer to use it instead of flashing the system manually.<br> |
Revision as of 11:31, 17 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_yocto.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_yocto.sh. It is much safer to use it instead of flashing the system manually.