Windows On ARM BSP User Guide for ROM-5720

From ESS-WIKI
Revision as of 09:42, 12 April 2022 by Liszt.kao (talk | contribs)
Jump to: navigation, search

Windows On ARM (WoA) Version

Windows : 20H2 (en_windows_10_iot_enterprise_version_20h2_arm64_dvd_fe0947da.iso)
NXP BSP : W1809 (W1809_1_1_0_imx-firmware.tgz, W1809_1_1_0_imx-iotcore.zip)

Released Image

20220412

Build Environment on Host

Currently, we adopt Docker as build environment.

You can get the advrisc/u14.04-410clbv1 Docker image for developing WoA projects.

Docker command:

$ docker pull advrisc/u14.04-410clbv1

Run Docker example

Step1 Run docker container (example)

sudo docker run -it --name <CONTAINER_NAME> -v <PATH_TO_BSP>:/home/adv/BSP:rw advrisc/u14.04-410clbv1 /bin/bash

Step2 In container, change the user. (example)

 adv@7cc0fa834366:~$ sudo chown adv:adv -R BSP

Install Dependency Packages

$ sudo apt-get update
$ sudo apt-get install -y attr build-essential python python-dev python-crypto python-wand device-tree-compiler bison flex swig iasl uuid-dev wget git bc libssl-dev zlib1g-dev python3-pip

New for 1903 UEFI

$ sudo apt-get install -y gcc g++ make python3 mono-devel

Upgrade Python 3.6

$ wget https://www.python.org/ftp/python/3.9.0/Python-3.6.3.tgz
$ tar -xvf Python-3.6.3.tgz
$ cd Python-3.6.3
$ sudo ./configure --enable-optimizations --with-ensurepip=install
$ make -j 8
$ sudo make altinstall

Configure python alternatives

$ sudo update-alternatives --install /usr/bin/python python /usr/bin/python2.7 1
$ sudo update-alternatives --install /usr/bin/python python /usr/bin/python3.4 1
$ sudo update-alternatives --install /usr/bin/python python /usr/local/bin/python3.6 2
$ sudo pip3.6 install --upgrade pip
$ pip install pycryptodome

Upgrade Git 2.25 (> 2.11)

$ sudo apt-get install -y tcl build-essential tk gettext
$ wget https://github.com/git/git/archive/v2.25.0.tar.gz
$ tar zxvf v2.25.0.tar.gz
$ cd git-2.25.0/
$ make configure
$ ./configure --prefix=/usr
$ make all
$ sudo make install

ToolChain

$ cd ~
$ wget https://releases.linaro.org/components/toolchain/binaries/7.2-2017.11/aarch64-linux-gnu/gcc-linaro-7.2.1-2017.11-x86_64_aarch64-linux-gnu.tar.xz
$ tar xf gcc-linaro-7.2.1-2017.11-x86_64_aarch64-linux-gnu.tar.xz
$ rm gcc-linaro-7.2.1-2017.11-x86_64_aarch64-linux-gnu.tar.xz

Getting Source Code

Set up bootloader / UEFI source code

W1809_1_1_0_imx-firmware.tgz
W1809_1_1_0_imx-iotcore.zip
RTENOTITLE
RTENOTITLE

Extract BSP files

$ mkdir <new bsp folder>
$ unzip W*_imx-iotcore*.zip -d <new bsp folder>
$ tar -xf W*_imx-firmware*.tgz -C <new bsp folder>

Add more additional files

$ git clone https://AIM-Linux@dev.azure.com/AIM-Linux/ms-iot-ent/_git/adv-build
$ cp -a adv-build/adv-buildme64.sh <new bsp folder>
$ cp -a adv-build/enterprise <new bsp folder>
$ cp -a adv-build/ROM5720_iMX8M_2GB <new bsp folder>/imx-iotcore/build/board/

Update UEFI

$ cd <new bsp folder>
$ rm -rf mu_platform_nxp
$ git clone https://AIM-Linux@dev.azure.com/AIM-Linux/ms-iot-ent/_git/mu_platform_nxp
$ cd mu_platform_nxp
$ sudo pip install -r requirements.txt --upgrade
$ cp -a /usr/local/lib/python3.6/site-packages/*  /home/adv/.local/lib/python3.6/site-packages/

Update U-Boot

$ cd ../u-boots
$ rm -rf u-boot-imx_arm64
$ git clone https://AIM-Linux@dev.azure.com/AIM-Linux/ms-iot-ent/_git/u-boot-imx_arm64

All of files are collected on git server. please check following.

$ cd ~/BSP
$ mkdir WoA
$ cd WoA
$ git config --global user.name "Your Name"
$ git config --global user.email you@example.com
$ ../repo/repo init -u https://AIM-Linux@dev.azure.com/AIM-Linux/ms-iot-ent/_git/manifest -m W1809_1_1_0.xml
$ ../repo/repo sync

Build Firmware / UEFI

$ export AARCH64_TOOLCHAIN_PATH=~/gcc-linaro-7.2.1-2017.11-x86_64_aarch64-linux-gnu/bin/aarch64-linux-gnu-
$ ./adv-buildme64.sh -b 5720 -t all -bc DEBUG

PS: Before build ROM-5720, there are something have done first.
1).Replace keyword 'python3' with 'python' in adv-buildme64.sh.
2).The path of AARCH64_TOOLCHAIN_PATH must be in the HOME path.
3).Build EVK configuration first.

$ ./adv-buildme64.sh -b 8M -t all -bc DEBUG

4).for ROM-5720 bootloader setting, the soc.mak have to be modified.
RTENOTITLE

The firmware will be generated in the following

<PROJECT_BSP>/imx-iotcore/build/board/<BOARD_NAME>/Package/BootLoader/flash.bin

The uefi will be generated in the following

<PROJECT_BSP>/imx-iotcore/build/board/<BOARD_NAME>/Package/BootFirmware/uefi.fit

Build Driver

Set up build environment

Make sure the project name in ROM5720_iMX8M_2GB_Package.vcxproj

<ProjectName>ROM5720_iMX8M_2GB</ProjectName>

Right click "Board Packages" -> Add -> Exist Project in the Solution Explorer panel

<BSP>\imx-iotcore\build\board\ROM5720_iMX8M_2GB\Package\ROM5720_iMX8M_2GB_Package.vcxproj

RTENOTITLE

Right click "GenerateBSP" and select 'properties' Click NMake -> Build Command Line -> Edit, and added following setting

call ..\..\..\tools\BuildBSP.bat iMX8 ROM5720_iMX8M_2GB

Build

Open Visual Studio as administrator Open solution file

<BSP>/imx-iotcore/build/solution/iMXPlatform/iMXPlatform.sln

Right click 'GenerateBSP' and select 'build'

RTENOTITLE

If get any errors about Hal*,
The specified timestamp server either could not be reached or… HalExtiMXDma
please remove following projects
RTENOTITLE

Go to following path, add those three projects back

<BSP>\imx-iotcore\components\NXP.SignedDrivers\VsProjects

Build each hal* project and build 'GenerateBSP' again The build result will be in the

<BSP>\imx-iotcore\BSP\ROM5720_iMX8M_2GB\

Flash Image

Make OS Installer

Extract install.wim from Windows IoT image

en_windows_10_iot_enterprise_version_20h2_arm64_dvd_fe0947da.iso/sources/

Extract Windows IoT for NXP - IoTEntOnNXP.v1.3.zip and put the install.wim in the 'image' folder Build WinPE Image
Using v1.3 make-winpe-enterprise-windebug.cmd

c:\>cd IoTEntOnNXP.v1.3
c:\IoTEntOnNXP.v1.3>make-winpe-enterprise-windebug.cmd /testbin /image ..\image\install.wim /splitwim /windebug /winpedebug

Get SD card number
1).Open command line as administrator
2).Check number by enter following (SD card 16GB)

C:\Windows\system32>diskpart
DISKPART> list disk
  Disk ###  Status         Size     Free     Dyn  Gpt
  --------  -------------  -------  -------  ---  ---
  Disk 0    Online          465 GB  1024 KB        *
  Disk 1    Online           14 GB      0 B        *

Flash image to SD card

c:\IoTEntOnNXP>make-winpe-enterprise-windebug.cmd /apply 1

Flash EMMC

To flash image to EMMC via SD card, please refer to HERE.