Debian Flash From Net: Difference between revisions

From Variscite Wiki
(Initial: Inherited from Yocto_Flash_From_Net (00:06, 19 January 2023‎‎))
 
(Make distro features (page groups) conditional)
 
(One intermediate revision by the same user not shown)
Line 1: Line 1:
<!-- Set release according to "release" parameter in URL and use MORTY_V1.0_DART-6UL as default
<!-- 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|RELEASE_MORTY_V1.0_DART-6UL}}<!--
--> {{INIT_RELEASE_PARAM|mx8m-debian-bullseye-5.4-2.1.x-v1.4}}<!--
--> {{#lst:Yocto_Platform_Customization|{{#var:RELEASE_PARAM}}}} <!--
--> {{#lst:Debian_Platform_Customization|{{#var:RELEASE_PARAM}}}} <!--
--> {{#lst:B2QT_Platform_Customization|{{#var:RELEASE_PARAM}}}} <!--
--> {{PageHeader|{{#var:HARDWARE_NAME}} - Flash Debian images from network}} {{DocImage|category1={{#var:HARDWARE_NAME}}|category2=Debian}} __toc__
-->                                {{#vardefine:BUILD_PAGE|Yocto_Build_Release}}  {{#vardefine:PLATFORM_OS|Yocto}}        <!-- Default to Yocto
--> {{#varexists:DEBIAN_NAME      | {{#vardefine:BUILD_PAGE|Debian_Build_Release}} {{#vardefine:PLATFORM_OS|Debian}}  | }} <!-- Debian
--> {{#varexists:B2QT_BSP_VERSION | {{#vardefine:BUILD_PAGE|B2QT_Build_Release}}  {{#vardefine:PLATFORM_OS|Boot2Qt}} | }} <!-- B2Qt
--> {{PageHeader|{{#var:HARDWARE_NAME}} - Flash Yocto images from network}} {{DocImage|category1={{#var:HARDWARE_NAME}}|category2=Yocto}} __toc__


= Flashing a complete Yocto system from Network using TFTP &amp; NFS  =
= Flashing a complete Debian system from Network using TFTP &amp; NFS  =
{{note| NOTES:<br>
{{note| NOTES:<br>
#Please make sure your host system is ready to use TFTP/NFS. Use our Wiki if required: {{Varlink2|Yocto Setup TFTP/NFS|{{#var:RELEASE_LINK}}}}
#Please make sure your host system is ready to use TFTP/NFS. Use our Wiki if required: {{Varlink2|Debian Setup TFTP/NFS|{{#var:RELEASE_LINK}}}}
#This is a concept Wiki. Please adapt it to your system and your requirements.
#This is a concept Wiki. Please adapt it to your system and your requirements.
#Android can be flashed in the same way.
|info}}
|info}}


== Build minimal file system ==
== Build {{#ifexpr:{{#var:DEBIAN_VERSION}} >= 11|minimal|}} file system ==
To setup a build environment follow steps 1 & 3 of the {{Varlink|{{#var:BUILD_PAGE}}|{{#var:RELEASE_LINK}}|Build {{#var:PLATFORM_OS}} from source code}} guide.<br>
To setup a build environment follow steps 2 & 3 of the {{Varlink|Debian Build Release Stage|{{#var:RELEASE_LINK}}|Build Debian from source code}} guide.<br>
Then, append the following to the conf/local.conf file in your Yocto build directory:
<!-- Distro features support by the build script has been introduced in Debian 11 (Bullseye) -->
{{#switch: {{#var:SOC_SERIES}} | imx8 | imx9=
{{#ifexpr:{{#var:DEBIAN_VERSION}} >= 11|
IMAGE_INSTALL_append = " bash e2fsprogs-mke2fs tar"
Then, disable all distro features listed in {{Varlink|Debian Build Release Stage#Distro features|{{#var:RELEASE_LINK}}|Distro Features}} to get a minimal file system.
|#default=
|}}
IMAGE_INSTALL_append = " bash e2fsprogs-mke2fs tar mtd-utils imx-kobs mtd-utils-ubifs"
}}


And build the image:
And build the image:
  $ bitbake core-image-minimal
  $ sudo {{#var:BUILD_SCRIPT}} -c all


Create a root file system and copy files:
Create a root file system and copy files:
Line 31: Line 24:
<br>
<br>
  $ mkdir ~/flash_rootfs
  $ mkdir ~/flash_rootfs
  $ sudo tar xf tmp/deploy/images/{{#var:MACHINE_NAME}}/core-image-minimal-{{#var:MACHINE_NAME}}.tar.gz -C ~/flash_rootfs
  $ sudo tar xf {{#var:BUILD_FOLDER}}/output/rootfs.tar.gz -C ~/flash_rootfs
  $ sudo cp -a ~/flash_rootfs/boot/*.dtb /tftpboot
  $ sudo cp -a ~/flash_rootfs/boot/*.dtb /tftpboot
  $ sudo cp ~/flash_rootfs/boot/{{#var:KERNEL_IMAGE}} /tftpboot
  $ sudo cp ~/flash_rootfs/boot/{{#var:KERNEL_IMAGE}} /tftpboot
Line 37: Line 30:
<br>
<br>
  $ mkdir ~/flash_rootfs
  $ mkdir ~/flash_rootfs
  $ sudo tar xf tmp/deploy/images/{{#var:MACHINE_NAME}}/core-image-minimal-{{#var:MACHINE_NAME}}.tar.gz -C ~/flash_rootfs
  $ sudo tar xf {{#var:BUILD_FOLDER}}/output/rootfs.tar.gz -C ~/flash_rootfs
  $ sudo cp tmp/deploy/images/{{#var:MACHINE_NAME}}/{{#var:KERNEL_IMAGE}} /tftpboot
  $ sudo cp {{#var:BUILD_FOLDER}}/output/{{#var:KERNEL_IMAGE}} /tftpboot
  $ for f in tmp/deploy/images/{{#var:MACHINE_NAME}}/*.dtb; do if <nowiki>[[ -L $f ]] && [[</nowiki> $f != *{{#var:MACHINE_NAME}}.dtb <nowiki>]]</nowiki>; then sudo cp $f /tftpboot/; fi done
  $ for f in {{#var:BUILD_FOLDER}}/output/*.dtb; do if <nowiki>[[ -L $f ]] && [[</nowiki> $f != *{{#var:MACHINE_NAME}}.dtb <nowiki>]]</nowiki>; then sudo cp $f /tftpboot/; fi done
  $ sudo rename 's/{{#var:KERNEL_IMAGE}}-imx/imx/' /tftpboot/{{#var:KERNEL_IMAGE}}-*.dtb
  $ sudo rename 's/{{#var:KERNEL_IMAGE}}-imx/imx/' /tftpboot/{{#var:KERNEL_IMAGE}}-*.dtb
}}
}}
Line 68: Line 61:


On the target flash your system:
On the target flash your system:
  # install_yocto.sh
  # install_debian.sh


A complete system is flashed into the SOMs internal storage (NAND flash/eMMC).<br>
A complete system is flashed into the SOMs internal storage (NAND flash/eMMC).<br>
Once the file system is built you can use it again and again to flash your {{#var:HARDWARE_NAME}}.<br>
Once the file system is built you can use it again and again to flash your {{#var:HARDWARE_NAME}}.<br>
You can update the images to use your images and/or customize install_yocto.sh to your requirements.
You can update the images to use your images and/or customize install_debian.sh to your requirements.

Latest revision as of 14:48, 28 April 2023

Warning: This page is designed to be used with a 'release' URL parameter.

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:

  1. Visit variwiki.com
  2. Select your SoM
  3. Select the software release


DART-MX8M - Flash Debian images from network

Flashing a complete Debian system from Network using TFTP & NFS

NOTES:
  1. Please make sure your host system is ready to use TFTP/NFS. Use our Wiki if required: Debian Setup TFTP/NFS
  2. This is a concept Wiki. Please adapt it to your system and your requirements.

Build minimal file system

To setup a build environment follow steps 2 & 3 of the Build Debian from source code guide.
Then, disable all distro features listed in Distro Features to get a minimal file system.

And build the image:

$ sudo MACHINE=imx8mq-var-dart ./var_make_debian.sh -c all

Create a root file system and copy files:

$ mkdir ~/flash_rootfs
$ sudo tar xf ~/debian_imx8mq-var-dart_debian_bullseye/output/rootfs.tar.gz -C ~/flash_rootfs
$ sudo cp -a ~/flash_rootfs/boot/*.dtb /tftpboot
$ sudo cp ~/flash_rootfs/boot/zImage /tftpboot

Edit /etc/exports. E.g.

$ sudo gedit /etc/exports

...and add the following line to it (replace <uname> with the actual username):

/home/<uname>/flash_rootfs    *(rw,sync,no_root_squash,no_all_squash,no_subtree_check) 

Restart the NFS server:

$ sudo /etc/init.d/nfs-kernel-server restart

Insert the recovery SD card into your host PC and copy the following files from it (assuming it is mounted at /media):

$ sudo cp -a /media/rootfs/opt/images ~/flash_rootfs/opt/
$ sudo cp /media/rootfs/usr/bin/*.sh  ~/flash_rootfs/usr/bin/

Boot the board, stop the autoboot to get to the U-Boot command line, and set the following environment variables:

=> setenv serverip <your host ip address>
=> setenv nfsroot /home/<your username>/flash_rootfs

If you want to set the fdt file yourself, instead of using the default auto detection:
=> setenv fdt_file <relevant device tree>
=> setenv bootcmd 'run netboot'
=> saveenv
=> boot

On the target flash your system:

# install_debian.sh

A complete system is flashed into the SOMs internal storage (NAND flash/eMMC).
Once the file system is built you can use it again and again to flash your DART-MX8M.
You can update the images to use your images and/or customize install_debian.sh to your requirements.