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

From Variscite Wiki
(14 intermediate revisions by the same user not shown)
Line 31: Line 31:
|}}|}}
|}}|}}


== Flashing Bootloader to target ==
== Flashing New Bootloader to Target ==
Transfer the newly created bootloader file  {{#var:BUILD_FOLDER}}/output/{{#var:SPL_SD_IMAGE_NAME}} from
 
=== Flashing New Bootloader to target eMMC via network ===
Transfer the newly created bootloader file   
{{#ifeq: {{#var:SOC_SERIES}}|imx8|
'''{{#var:U-BOOT_SD_IMAGE_NAME}}'''
|
'''SPL and u-boot.img'''
}}
 
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 scp {{#var:BUILD_FOLDER}}/output/{{#var:SPL_SD_IMAGE_NAME}} root@192.168.0.34:/tmp/
For example <br>
{{#ifeq: {{#var:SOC_SERIES}}|imx8|
<br>
$scp {{#var:BUILD_FOLDER}}/output/{{#var:U-BOOT_SD_IMAGE_NAME}} 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/
}}


== Flahsing New bootlaoder to SD card.
Change 192.168.0.36 to your target board IP.<br>
To flash the newly created bootloader on the SD Card  
On target run below commands:<br>
{{#ifeq: {{#var:SOC_SERIES}}|imx8|
<br>
$ sudo dd if=/tmp/{{#var:U-BOOT_SD_IMAGE_NAME}}  of=/dev/{{#var:EMMC_ROOTFS_DEV}} bs=1K seek={{#var:U-BOOT_OFFSET}} conv=fsync
|
{{#ifeq: {{#var:SPL_SD_IMAGE_NAME}} | N/A
|<br>
$ sudo dd if={{#var:U-BOOT_IMAGE_NAME}} of=/dev/{{#var:EMMC_ROOTFS_DEV}} bs=1K seek=1; sync
|<br>
$ sudo dd if=/tmp/SPL of=/dev/{{#var:EMMC_ROOTFS_DEV}} bs=1K seek=1; sync
$ sudo dd if=/tmp/u-boot.img of=/dev/{{#var:EMMC_ROOTFS_DEV}} bs=1K seek=69; sync
}}
}}
 
=== 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.
{{#ifeq: {{#var:SOC_SERIES}}|imx8|
{{#ifeq: {{#var:SOC_SERIES}}|imx8|
  <br>
  <br>
Line 52: Line 84:
}}
}}
}}
}}
=== Flashing using recovery sdcard ===
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:
{{#ifeq: {{#var:SPL_SD_IMAGE_NAME}} | N/A
<br>
|<br>
{{#ifeq: {{#var:SOC_SERIES}}|imx8|
  $ sudo cp {{#var:U-BOOT_IMAGE_NAME}} /media/rootfs/opt/images/...
  $ sudo cp {{#var:U-BOOT_SD_IMAGE_NAME}} /media/rootfs/opt/images/Debian/
|<br>
|
  $ sudo cp SPL /media/rootfs/opt/images/...
  $ sudo cp SPL /media/rootfs/opt/images/Debian/
  $ sudo cp u-boot.img /media/rootfs/opt/images/...
  $ sudo cp u-boot.img /media/rootfs/opt/images/Debian/
}}
}}
And eject the SD card gracefully from host machine.
And eject the SD card gracefully from host machine.


{{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]])}}

Revision as of 01:34, 28 July 2020

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.
On target run below commands:

$ sudo 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 sdcard

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/

And eject the SD card gracefully from host machine.


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)