Difference between revisions of "Linux BSP build User Guide (LSDK20.12)"

From ESS-WIKI
Jump to: navigation, search
Line 38: Line 38:
 
</pre>
 
</pre>
  
'''Build Images'''
+
== Build Images ==
  
&nbsp; &nbsp; These commands are execute in Docker environment.
+
These commands are execute in Docker environment.
 +
 
 +
'''Composite Firmware'''
 +
 
 +
Type with&nbsp;QSPI, eMMC and&nbsp;SD
 
<pre>    $ cd flexbuild_lsdk2012
 
<pre>    $ cd flexbuild_lsdk2012
 
     $ source setup.env
 
     $ source setup.env
 +
    $ flex-builder -i mkfw -m ls1046ardb -b qspi
 +
    $ flex-builder -i mkfw -m ls1046ardb -b emmc
 
     $ flex-builder -i mkfw -m ls1046ardb -b sd
 
     $ flex-builder -i mkfw -m ls1046ardb -b sd
    $ flex-builder -i mkrfs -a arm64
+
</pre>
    $ flex-builder -i mkbootpartition -a arm64</pre>
 
  
 +
'''Root File System'''
 +
<pre>    $ flex-builder -i mkrfs -r ubuntu:main -a arm64</pre>
  
 +
'''Boot Partition'''
 +
<pre>    $ flex-builder -i mkbootpartition -a arm64</pre>
  
'''Flash&nbsp; Images (In Local Host)'''
 
  
'''&nbsp; &nbsp;&nbsp;'''The&nbsp;following example&nbsp;is for sd card&nbsp;:
+
 
 +
==  ==
 +
 
 +
== Flash Images ==
 +
 
 +
These operations process in linux local host
 +
 
 +
'''Bootable SD card :'''
 
<pre>    $ cd adv-release-bsp/flexbuild_lsdk2012/build/images/
 
<pre>    $ cd adv-release-bsp/flexbuild_lsdk2012/build/images/
 
     $ flex-installer -i pf -d /dev/sda
 
     $ flex-installer -i pf -d /dev/sda
Line 61: Line 76:
  
  
== How to Flash eMMC ==
+
'''Rootfs and Boot-Partition in USB'''
 +
<pre>    $ cd adv-release-bsp/flexbuild_lsdk2012/build/images/
 +
    $ flex-installer -i pf -d /dev/sdx
 +
    $ flex-installer -b bootpartition_LS_arm64_lts_5.4_xxxxxxxxxxxx.tgz -r rootfs_lsdk2012_ubuntu_main_arm64.tgz -d /dev/sdx
 +
</pre>
 +
 
 +
 
  
'''Boot Mode'''
+
== Boot Mode ==
  
 
{| border="1" cellspacing="1" cellpadding="1" style="width:500px;"
 
{| border="1" cellspacing="1" cellpadding="1" style="width:500px;"
Line 76: Line 97:
  
  
'''Burn In Boot-Loader to QSPI Flash'''
+
==  ==
  
You need a bootable SD card&nbsp;(follow above section), and&nbsp;switch to MMC boot mode.
+
== Flash Image to&nbsp;eMMC ==
  
Insert your SD card and follow below flow&nbsp;in U-boot console.
+
'''Step 1. Burn In Boot-Loader to QSPI Flash'''
  
Set FTP Server IP
+
&nbsp; &nbsp; You need a bootable SD card&nbsp;(follow above section), and&nbsp;switch boot mode&nbsp;to SD&nbsp;mode.
 +
 
 +
&nbsp; &nbsp; Insert your SD card and follow below flow&nbsp;in U-boot console.
 +
 
 +
&nbsp; &nbsp;'''Set FTP Server IP'''
 
<pre>  $ setenv serverip 172.22.31.153</pre>
 
<pre>  $ setenv serverip 172.22.31.153</pre>
  
Request IP Address
+
&nbsp; &nbsp; '''Request IP Address'''
 
<pre>    $ dhcp</pre>
 
<pre>    $ dhcp</pre>
  
Try to Ping FTP Server
+
&nbsp; &nbsp; '''Try to Ping FTP Server'''
 
<pre>    $ ping 172.22.31.153</pre>
 
<pre>    $ ping 172.22.31.153</pre>
  
Load U-boot Firmware Image
+
&nbsp; &nbsp; '''Load U-boot Firmware Image'''
 
<pre>    $ tftp $load_addr firmware_ls1046ardb_uboot_qspiboot.img</pre>
 
<pre>    $ tftp $load_addr firmware_ls1046ardb_uboot_qspiboot.img</pre>
  
Install Image to QSPI (32MB)
+
&nbsp; &nbsp; '''Install Image to QSPI (32MB)'''
 
<pre>    $ sf probe 0:0
 
<pre>    $ sf probe 0:0
 
     $ sf erase 0 0x2000000 && sf write $load_addr 0 0x2000000</pre>
 
     $ sf erase 0 0x2000000 && sf write $load_addr 0 0x2000000</pre>
  
Shutdown, unplug SD card, switch to QSPI mode, plugin the prepared USB disk&nbsp;and power on the board again.
+
&nbsp; &nbsp; Shutdown, unplug SD card, switch to QSPI mode, plugin the prepared USB disk&nbsp;and power on the board again.
  
Boot into U-boot console, then flush the eMMC
+
&nbsp; &nbsp; '''Boot into U-boot console again and flush the eMMC'''
 
<pre>    $ mmc erase 0 0x8000
 
<pre>    $ mmc erase 0 0x8000
 
&nbsp;  $ boot
 
&nbsp;  $ boot
 
</pre>
 
</pre>
  
Boot into rootfs in USB disk
+
&nbsp; &nbsp; Boot into rootfs with&nbsp;USB disk
 +
 
 +
&nbsp; &nbsp; '''Create FTP Temp Folder'''
 
<pre>    $ mkdir /media/mytftp
 
<pre>    $ mkdir /media/mytftp
     $ cd /media/mytftp
+
     $ cd /media/mytftp</pre>
    $ ifconfig fm1-mac9 up
+
 
 +
&nbsp; &nbsp; '''Request IP Address'''
 +
<pre>    $ ifconfig fm1-mac9 up
 
     $ udhcpc -i fm1-mac9
 
     $ udhcpc -i fm1-mac9
     $ ping 172.22.31.153
+
     $ ping 172.22.31.153</pre>
    $ tftp -g -r bootpartition_LS_arm64_lts_5.4_xxxxxxxxxxxx.tgz 172.22.31.153
+
 
     $ tftp -g -r firmware_ls1046ardb_uboot_sdboot.img
+
&nbsp; &nbsp; '''Download Images from FTP'''
     $ tftp -g -r rootfs_lsdk2012_ubuntu_main_arm64.tgz
+
<pre>    $ tftp -g -r bootpartition_LS_arm64_lts_5.4_xxxxxxxxxxxx.tgz 172.22.31.153
    $ flex-installer -i pf -d /dev/mmcblk0
+
     $ tftp -g -r firmware_ls1046ardb_uboot_sdboot.img 172.22.31.153
    $ flex-installer -f firmware_ls1046ardb_uboot_sdboot.img -b bootpartition_LS_arm64_lts_5.4_xxxxxxxxxxxx.tgz -r rootfs_lsdk2012_ubuntu_main_arm64.tgz -d /dev/mmcblk0</pre>
+
     $ tftp -g -r rootfs_lsdk2012_ubuntu_main_arm64.tgz 172.22.31.153</pre>
 +
 
 +
&nbsp; &nbsp;'''Initial eMMC Partitions'''
 +
<pre>    $ flex-installer -i pf -d /dev/mmcblk0</pre>
 +
 
 +
&nbsp; &nbsp;'''Install Images'''
 +
<pre>    $ flex-installer -f firmware_ls1046ardb_uboot_sdboot.img -b bootpartition_LS_arm64_lts_5.4_xxxxxxxxxxxx.tgz -r rootfs_lsdk2012_ubuntu_main_arm64.tgz -d /dev/mmcblk0</pre>
  
Shutdown, and then&nbsp;restart after&nbsp;switch back to SD boot mode.&nbsp;
+
&nbsp; &nbsp; *&nbsp;'''Finally, shutdown and restart after switch boot mode back to SD mode.'''

Revision as of 04:09, 30 March 2022

Linux BSP Version

Ubuntu 18.04

Kernel 5.4.47

Released Image

Download flex-installer

    $ wget https://www.nxp.com/lgfiles/sdk/lsdk2012/flex-installer && chmod +x flex-installer && sudo mv flex-installer /usr/bin

Build Environment on Host

If you don't have docker in your system, then you can follow the below  steps to install docker and run it first.

Log in to a Docker registry

   $ docker login -u advcus -p iTk7Sy9OQVQCkN2FPKw=Om8mfwfZQqKi riscswacr.azurecr.io

Pull Ubuntu 18.04 from Azure Container Registry

   $ docker pull riscswacr.azurecr.io/u18.04-ls1046albv1:latest

Run/Create Docker Container

   $ docker run -it --name ${CONTAINER_NAME} --privileged -v ${WORK_SPACE}:/home/adv/flexbuild_lsdk2012:rw riscswacr.azurecr.io/u18.04-ls1046albv1 /bin/bash


Get BSP

Download BSP from Azure DevOps

    The following example shows how to download the Advantech LSDK flexbuilder from DevOps. (Execute in Docker container)

    For this example, a directory called adv-release-bsp is created for the project.

    $ cd adv-release-bsp
    $ git clone https://AIM-Linux@dev.azure.com/AIM-Linux/flexbuild_lsdk2012/_git/flexbuild_lsdk2012

Build Images

These commands are execute in Docker environment.

Composite Firmware

Type with QSPI, eMMC and SD

    $ cd flexbuild_lsdk2012
    $ source setup.env
    $ flex-builder -i mkfw -m ls1046ardb -b qspi
    $ flex-builder -i mkfw -m ls1046ardb -b emmc
    $ flex-builder -i mkfw -m ls1046ardb -b sd

Root File System

    $ flex-builder -i mkrfs -r ubuntu:main -a arm64

Boot Partition

    $ flex-builder -i mkbootpartition -a arm64


Flash Images

These operations process in linux local host

Bootable SD card :

    $ cd adv-release-bsp/flexbuild_lsdk2012/build/images/
    $ flex-installer -i pf -d /dev/sda
    $ flex-installer -f firmware_ls1046ardb_uboot_sdboot.img -b bootpartition_LS_arm64_lts_5.4_xxxxxxxxxxxx.tgz -r rootfs_lsdk2012_ubuntu_main_arm64.tgz -d /dev/sda



Rootfs and Boot-Partition in USB

    $ cd adv-release-bsp/flexbuild_lsdk2012/build/images/
    $ flex-installer -i pf -d /dev/sdx
    $ flex-installer -b bootpartition_LS_arm64_lts_5.4_xxxxxxxxxxxx.tgz -r rootfs_lsdk2012_ubuntu_main_arm64.tgz -d /dev/sdx


Boot Mode

QSPI Mode MMC mode
RTENOTITLE
RTENOTITLE


Flash Image to eMMC

Step 1. Burn In Boot-Loader to QSPI Flash

    You need a bootable SD card (follow above section), and switch boot mode to SD mode.

    Insert your SD card and follow below flow in U-boot console.

   Set FTP Server IP

   $ setenv serverip 172.22.31.153

    Request IP Address

    $ dhcp

    Try to Ping FTP Server

    $ ping 172.22.31.153

    Load U-boot Firmware Image

    $ tftp $load_addr firmware_ls1046ardb_uboot_qspiboot.img

    Install Image to QSPI (32MB)

    $ sf probe 0:0
    $ sf erase 0 0x2000000 && sf write $load_addr 0 0x2000000

    Shutdown, unplug SD card, switch to QSPI mode, plugin the prepared USB disk and power on the board again.

    Boot into U-boot console again and flush the eMMC

    $ mmc erase 0 0x8000
    $ boot

    Boot into rootfs with USB disk

    Create FTP Temp Folder

    $ mkdir /media/mytftp
    $ cd /media/mytftp

    Request IP Address

    $ ifconfig fm1-mac9 up
    $ udhcpc -i fm1-mac9
    $ ping 172.22.31.153

    Download Images from FTP

    $ tftp -g -r bootpartition_LS_arm64_lts_5.4_xxxxxxxxxxxx.tgz 172.22.31.153
    $ tftp -g -r firmware_ls1046ardb_uboot_sdboot.img 172.22.31.153
    $ tftp -g -r rootfs_lsdk2012_ubuntu_main_arm64.tgz 172.22.31.153

   Initial eMMC Partitions

    $ flex-installer -i pf -d /dev/mmcblk0

   Install Images

    $ flex-installer -f firmware_ls1046ardb_uboot_sdboot.img -b bootpartition_LS_arm64_lts_5.4_xxxxxxxxxxxx.tgz -r rootfs_lsdk2012_ubuntu_main_arm64.tgz -d /dev/mmcblk0

    * Finally, shutdown and restart after switch boot mode back to SD mode.