wiki:venice/bootloader

Venice U-Boot Bootloader

Gateworks supports the U-Boot Bootloader for the Venice product family.

The purpose of a bootloader is to load the Linux kernel and execute it passing it configuration parameters such as an optional kernel command-line, an optional initial ramdisk filesystem, and a device-tree.

The following items are supported in the Gateworks U-Boot for Venice:

  • IMX8M FEC GbE
  • IMX8MP EQOS GbE
  • USB Host support (USB Mass Storage and USB Networking for ASIX USB 2.0 USB Network device)
  • eMMC / microSD

The following items are not currently supported in the Gateworks U-Boot for Venice:

  • PCIe support (include PCIe based Gbe)

Additional resources:

see uboot for more info

Editing the environment

If you would like to modify the default environment you can edit the venice/venice.env in the Venice BSP.

Restoring environment defaults

The Venice boot firmware has a copy of the original U-Boot env that was created during build time.

To restore default bootloader environment variables:

  • At the "Hit any key to stop autoboot:" prompt press any key.
  • Execute the following command:
    run restore_env && reset
    

Boot Devices

The Venice U-Boot Bootloader supports the following devices and partition types:

  • eMMC
  • microSD
  • USB Mass Storage
  • NVMe

The U-Boot 'Generic Distro Config' is used for Venice:

  • the default bootcmd will ultimately search for boot scripts on a set of bootable devices
  • the 'boot_targets' env variable dictates which devices are checked and in what order
  • the 'boot_prefixes' env variable dictates what file prefixes are searched for a boot script
  • the 'boot_scripts' env variable dictates what bootscript names are searched for
  • only partitions that have the 'boot' flag set are looked at for boot scripts

Venice boards are configured via one-time-programable fuses to boot to an on-board eMMC device (it is possible to have Gateworks configure a board to boot to microSD instead for a special or custom build).

If you wish to select a different boot device priority you can adjust boot_targets. For example:

  • Boot from NVMe (nvme dev 0)
    # flash your disk image to the NVMe device
    u-boot=> pci enum
    PCIE-0: Link up (Gen1-x1, Bus0)
    u-boot=> nvme scan
    u-boot=> nvme info
    Device 0: Vendor: 0x10ec Rev: 0426-D00 Prod: 60272-0005          
                Type: Hard Disk
                Capacity: 57241.8 MB = 55.9 GB (117231408 x 512)
    u-boot=> tftpboot $loadaddr venice/jammy-venice.img.gz && gzwrite nvme 0 $loadaddr $filesize
    ...
    # set boot targets to boot only from nvme
    setenv boot_targets nvme0
    saveenv
    #now reset the board and let it boot to NVMe
    reset
    
  • Troubleshooting:
    • There must be a bootable partition and a boot script. In the example here you see we have an NVME device, it has a partition that is flagged as bootable (Type=83 Boot), and has a boot.scr in its /boot directory
      u-boot=> nvme devices # show NVMe devices; should show your device
      
      IDE device 0: Vendor: 0x10ec Rev: 0426-D00 Prod: 60272-0005          
                  Type: Hard Disk
                  Capacity: 57241.8 MB = 55.9 GB (117231408 x 512)
      
      u-boot=> part list nvme 0 # show the partition table on nvme device 0
      
      Partition Map for NVMe device 0  --   Partition Type: DOS
      
      Part    Start Sector    Num Sectors     UUID            Type
        1     32768           117198640       a7d49245-01     83 Boot
      
      u-boot=> ls nvme 0:1 /boot # list files on nvme device 0 partition 1
      <DIR>       4096 .
      <DIR>       4096 ..
                 51836 imx8mm-venice-gw73xx-0x.dtb
              31556096 Image
              11414268 kernel.itb
                  2244 boot.scr
      
      
  • boot from microSD (mmc dev 1)
    u-boot=> mmc dev 1
    switch to partitions #0, OK
    mmc1 is current device
    u-boot=> mmc list
    FSL_SDHC: 0
    FSL_SDHC: 1 (SD)
    FSL_SDHC: 2 (eMMC)
    u-boot=> tftpboot $loadaddr venice/jammy-venice.img.gz && gzwrite mmc 1 $loadaddr $filesize
    ...
    # set boot targets to boot only from nvme
    setenv boot_targets mmc1
    saveenv
    
  • boot from USB 0 (usb dev 0)
    u-boot=> usb start
    starting USB...
    Bus usb@38100000: Register 2000140 NbrPorts 2
    Starting the controller
    USB XHCI 1.10
    Bus usb@38200000: Register 2000140 NbrPorts 2
    Starting the controller
    USB XHCI 1.10
    scanning bus usb@38100000 for devices... cannot reset port 1!?
    2 USB Device(s) found
    scanning bus usb@38200000 for devices... 4 USB Device(s) found
           scanning usb for storage devices... 1 Storage Device(s) found
    u-boot=> usb storage
      Device 0: Vendor: ASolid   Rev:      Prod: USB             
                Type: Removable Hard Disk
                Capacity: 60000.0 MB = 58.5 GB (122880001 x 512)
           
    u-boot=> tftpboot $loadaddr venice/jammy-venice.img.gz && gzwrite usb 0 $loadaddr $filesize
    ...
    # set boot targets to boot only from nvme
    setenv boot_targets mmc1
    saveenv
    

Memory Mapping

When working with boot firmware you are often dealing with choosing where to load in memory various components. Sometimes this is done by hard-coding addresses into U-Boot commands, using env variables, or hard coding them into the U-Boot build configuration files (ie binman node) or FIT image templates.

Here is what we recommend for memory mapping on the IMX8M{M,N,P} SoC's:

address var Note
0x00920000 ARM Trusted Firmware
0x40000000 base of DRAM
0x40200000 kernel_comp_addr_r CONFIG_TEXT_BASE: base of non-secure memory<BR>The ATF configures the first 2M of DRAM as secure for itself
0x40310000 binman_fip image gets put here
0x44000000 CONFIG_SPL_LOAD_FIT_ADDRESS (used for secure boot)
0x48200000 loadaddr, kernel_addr_r CONFIG_SYS_LOAD_ADDR
0x50200000 fdt_addr_r area for loading fdt (128M above kernel_addr_r)
0x50300000 scriptaddr area for loading script (512K above fdt_addr_r)
0x7e000000 CFG_TZDRAM_START (secure boot with TEE; for 1GB DRAM boards)
0x80000000 1GB boundary
0xbe000000 CFG_TZDRAM_START (secure boot with TEE; for 2GB DRAM boards)
0xc0000000 2GB boundary
0xfe000000 CGG_TZDRAM_START (secure boot with TEE; for 4GB DRAM boards)
0x100000000 3GB boundary
0x140000000 4GB boundary
Last modified 8 days ago Last modified on 04/19/2024 10:34:41 PM
Note: See TracWiki for help on using the wiki.