Debian Edit Modify Build and Flash U-Boot: Difference between revisions

From Variscite Wiki
(Flashing using recovery SD card: fix varlink)
 
(14 intermediate revisions by 2 users 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 RELEASE_BUSTER_V1.0_DART-MX8M-MINI as default
--> {{#vardefine:RELEASE_PARAM|{{#urlget:release}}}} <!--
--> {{INIT_RELEASE_PARAM|RELEASE_BUSTER_V1.0_DART-MX8M-MINI}}<!--
--> {{#lst:Debian_Platform_Customization|{{#var:RELEASE_PARAM|RELEASE_BUSTER_V1.0_DART-MX8M-MINI}}}} <!--
--> {{#lst:Debian_Platform_Customization|{{#var:RELEASE_PARAM}}}} <!--
--> {{PageHeader|{{#var:HARDWARE_NAME}} - Debian U-Boot Customization}} {{DocImage|category1={{#var:HARDWARE_NAME}}|category2=Debian}} __toc__
--> {{PageHeader|{{#var:HARDWARE_NAME}} - Debian U-Boot Customization}} {{DocImage|category1={{#var:HARDWARE_NAME}}|category2=Debian}} __toc__
<br>
<br>


== Making Changes to U-Boot ==
== Making changes to U-Boot ==
  $ cd {{#var:BUILD_FOLDER}}/src/uboot-imx
  $ cd {{#var:BUILD_FOLDER}}/src/uboot-imx
  $ gedit board/variscite/{{#var:U-BOOT_BOARD_NAME}}/{{#var:U-BOOT_BOARD_NAME}}.c
  $ gedit board/variscite/{{#var:U-BOOT_BOARD_NAME}}/{{#var:U-BOOT_BOARD_NAME}}.c
  $ gedit include/configs/{{#var:U-BOOT_BOARD_NAME}}.h
  $ gedit include/configs/{{#var:U-BOOT_BOARD_NAME}}.h


For example, we want to change the default environment variable,  
For example, we want to change the default environment variable,
  "netargs=setenv bootargs ${jh_clk} console=${console} " \
  "netargs=setenv bootargs ${jh_clk} console=${console} " \
  "root=/dev/nfs ${cma_size} " \
  "root=/dev/nfs ${cma_size} " \
  "ip=dhcp nfsroot=${serverip}:${nfsroot},v3,tcp\0" \
  "ip=dhcp nfsroot=${serverip}:${nfsroot},v3,tcp\0" \
To
to
  "netargs=setenv bootargs ${jh_clk} console=${console} " \
  "netargs=setenv bootargs ${jh_clk} console=${console} " \
  "root=/dev/nfs ${cma_size} " \
  "root=/dev/nfs ${cma_size} " \
  "ip=dhcp serverip=192.168.0.34 nfsroot=${serverip}:${nfsroot},v3,tcp\0" \
  "ip=dhcp serverip=192.168.0.34 nfsroot=${serverip}:${nfsroot},v3,tcp\0" \


Here above example sets the serverip to 192.168.0.34,
Here above example sets the serverip to 192.168.0.34.


== Building Bootloader ==
== Building bootloader ==
To build a bootloader run below commands on host machine.  
To build a bootloader run below commands on host machine.  
  $ cd {{#var:BUILD_FOLDER}}
  $ cd {{#var:BUILD_FOLDER}}
Line 31: Line 31:
|}}|}}
|}}|}}


== Flashing New Bootloader to target eMMC via network ==
== Flashing new bootloader to target ==
 
=== Flashing new bootloader to target eMMC via network ===
Transfer the newly created bootloader file   
Transfer the newly created bootloader file   
{{#ifeq: {{#var:SOC_SERIES}}|imx8|
{{#ifeq: {{#var:SOC_SERIES}}|imx8|
Line 41: Line 43:
From
From
  {{#var:BUILD_FOLDER}}/output/ to running target to flash it on the eMMC.  
  {{#var:BUILD_FOLDER}}/output/ to running target to flash it on the eMMC.  
For example
For example: <br>
{{#ifeq: {{#var:SOC_SERIES}}|imx8|
{{#ifeq: {{#var:SOC_SERIES}}|imx8|
  $scp {{#var:BUILD_FOLDER}}/output/{{#var:U-BOOT_SD_IMAGE_NAME}} root@192.168.0.36:/tmp/
<br>
|
  $ scp {{#var:BUILD_FOLDER}}/output/{{#var:U-BOOT_SD_IMAGE_NAME}} root@192.168.0.36:/tmp/
  $scp {{#var:BUILD_FOLDER}}/output/SPL root@192.168.0.36:/tmp/
|
  $scp {{#var:BUILD_FOLDER}}/output/u-boot.img root@192.168.0.36:/tmp/
<br>
  $ scp {{#var:BUILD_FOLDER}}/output/SPL root@192.168.0.36:/tmp/
  $ scp {{#var:BUILD_FOLDER}}/output/u-boot.img root@192.168.0.36:/tmp/
}}  
}}  


Change 192.168.0.36 to your target board IP.  
Change 192.168.0.36 to your target board IP.
 
Login via ssh on the target with the user 'root', and run the below commands':<br>
{{#ifeq: {{#var:SOC_SERIES}}|imx8|
{{#ifeq: {{#var:SOC_SERIES}}|imx8|
  <br>
  <br>
  # dd if=/tmp/{{#var:U-BOOT_IMAGE_NAME}} of=/dev/{{#var:EMMC_ROOTFS_DEV}} bs=1K seek={{#var:U-BOOT_OFFSET}}; sync
  $ dd if=/tmp/{{#var:U-BOOT_SD_IMAGE_NAME}} of=/dev/{{#var:EMMC_ROOTFS_DEV}} bs=1K seek={{#var:U-BOOT_OFFSET}} conv=fsync
|
|
  # dd if=SPL of=/dev/{{#var:EMMC_ROOTFS_DEV}} bs=1K seek=1; sync
{{#ifeq: {{#var:SPL_SD_IMAGE_NAME}} | N/A
  # dd if=u-boot.img of=/dev/{{#var:EMMC_ROOTFS_DEV}} bs=1K seek=69; sync
|<br>
  $ dd if={{#var:U-BOOT_IMAGE_NAME}} of=/dev/{{#var:EMMC_ROOTFS_DEV}} bs=1K seek=1; sync
|<br>
$ dd if=/tmp/SPL of=/dev/{{#var:EMMC_ROOTFS_DEV}} bs=1K seek=1; sync
  $ dd if=/tmp/u-boot.img of=/dev/{{#var:EMMC_ROOTFS_DEV}} bs=1K seek=69; sync
}}
}}
}}


== Flashing New Bootloader to SD card ==
=== Flashing new bootloader to SD card ===
To flash the newly created bootloader on the SD Card
To flash the newly created bootloader on the SD card if you are running your entire OS from SD card.
{{#ifeq: {{#var:SOC_SERIES}}|imx8|
{{#ifeq: {{#var:SOC_SERIES}}|imx8|
  <br>
  <br>
Line 75: Line 86:
}}
}}


== Flashing using recovery sdcard ==
=== Flashing using recovery SD card ===
If you want to use our recovery SD card to flash the built U-Boot to NAND flash/eMMC, then copy it to the appropriate location in the SD card:
If you want to use our recovery SD card to flash the built U-Boot to NAND flash/eMMC, then copy it to the appropriate location in the SD card:
<br>
<br>
Line 84: Line 95:
  $ sudo cp u-boot.img /media/rootfs/opt/images/Debian/
  $ sudo cp u-boot.img /media/rootfs/opt/images/Debian/
}}
}}
And eject the SD card gracefully from host machine.
Eject the SD card gracefully from the host machine, and {{varlink|Debian_Recovery_SD_card#Recover_NAND_flash.2FeMMC|{{#var:RELEASE_LINK}}|flash the internal on-SOM storage using the recovery SD card}}.


{{Note|Note: If you manually upgrade an existing U-Boot, and you have an old environment saved, it is a good idea to reset your environment to the new default (see [[U-Boot 4.1.15 features#Environment handling commands|Environment handling commands]])}}
{{Note|Note: If you manually upgrade an existing U-Boot, and you have an old environment saved, it is a good idea to reset your environment to the new default (see [[U-Boot 4.1.15 features#Environment handling commands|Environment handling commands]])}}

Latest revision as of 21:26, 27 April 2023

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

This page is using the default release RELEASE_BUSTER_V1.0_DART-MX8M-MINI.
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-MINI - Debian U-Boot Customization


Making changes to U-Boot

$ cd ~/var_mx8mm_dart_debian_buster/src/uboot-imx
$ gedit board/variscite/mx8mm_var_dart/mx8mm_var_dart.c
$ gedit include/configs/mx8mm_var_dart.h

For example, we want to change the default environment variable,

"netargs=setenv bootargs ${jh_clk} console=${console} " \
		"root=/dev/nfs ${cma_size} " \
		"ip=dhcp nfsroot=${serverip}:${nfsroot},v3,tcp\0" \

to

"netargs=setenv bootargs ${jh_clk} console=${console} " \
		"root=/dev/nfs ${cma_size} " \
		"ip=dhcp serverip=192.168.0.34 nfsroot=${serverip}:${nfsroot},v3,tcp\0" \

Here above example sets the serverip to 192.168.0.34.

Building bootloader

To build a bootloader run below commands on host machine.

$ cd ~/var_mx8mm_dart_debian_buster
$ sudo MACHINE=imx8mm-var-dart ./var_make_debian.sh -c bootloader


Flashing new bootloader to target

Flashing new bootloader to target eMMC via network

Transfer the newly created bootloader file imx-boot-sd.bin

From

~/var_mx8mm_dart_debian_buster/output/ to running target to flash it on the eMMC. 

For example:

$ scp ~/var_mx8mm_dart_debian_buster/output/imx-boot-sd.bin root@192.168.0.36:/tmp/ 

Change 192.168.0.36 to your target board IP.

Login via ssh on the target with the user 'root', and run the below commands':

$ dd if=/tmp/imx-boot-sd.bin  of=/dev/mmcblk2 bs=1K seek=33 conv=fsync

Flashing new bootloader to SD card

To flash the newly created bootloader on the SD card if you are running your entire OS from SD card.

$ sudo dd if=imx-boot-sd.bin of=/dev/sdX bs=1K seek=33 conv=fsync

Flashing using recovery SD card

If you want to use our recovery SD card to flash the built U-Boot to NAND flash/eMMC, then copy it to the appropriate location in the SD card:

$ sudo cp imx-boot-sd.bin /media/rootfs/opt/images/Debian/

Eject the SD card gracefully from the host machine, and flash the internal on-SOM storage using the recovery SD card.


Note: If you manually upgrade an existing U-Boot, and you have an old environment saved, it is a good idea to reset your environment to the new default (see Environment handling commands)