Commit 252b078d authored by Angus Ainslie's avatar Angus Ainslie Committed by Angus Ainslie (Purism)

README.org : add instructions for flashing u-boot

parent 348bf5e0
......@@ -66,7 +66,7 @@ you can e.g. create via Debian's deboostrap.
For that to work the *BOOT MODE* switch needs to be set to *eMMC* (instead of *USB*).
* Installing a minimal Linux the eMMC
You can dd a prebuil image on there or you can just debootstrap from
You can dd a prebuilt image on there or you can just debootstrap from
scratch, this can be useful if you don't want that many services
starting up by default:
......@@ -83,7 +83,144 @@ pulling kernel and device tree via tftp though:
setenv emmcboot "setenv bootargs ${args_common} debug root=/dev/mmcblk0p2; dhcp ${loadaddr} Image-librem5-devkit; dhcp ${fdt_addr} librem5-devkit.dtb; booti ${loadaddr} - ${fdt_addr}"
#+END_SRC
* TODO Flash uboot
* Install uuu
** By hand
The NXP mfgtool uuu is required to boot a board that has no bootloader or is otherwise "bricked". Either download, build and install uuu :
#+BEGIN_SRC
git clone https://github.com/NXPmicro/mfgtools
cd mfgtools
cmake ./
make
sudo make install
#+END_SRC
** Using the handy script
#+BEGIN_SRC
scripts/build_uuu.sh -i
#+END_SRC
* Download Target Binaries
You can manually download or build the required binaries. There is also a convenience script to download prebuilt binaries from the Purism servers.
#+BEGIN_SRC
scripts/fetch_latest.sh -xk
#+END_SRC
* Flash uboot
** Using SDP
The uboot that gets flashed is files/u-boot-devkit-recovery.imx . Put the "Boot Mode" switch in the USB position.
#+BEGIN_SRC
sudo uuu uuu_scripts/u-boot_flash_librem5-devkit.lst
#+END_SRC
You can also just boot to u-boot without flashing anything
#+BEGIN_SRC
sudo uuu uuu_scripts/u-boot_librem5-devkit.lst
#+END_SRC
** From u-boot using tftp
You must have a tftp server setup for this
#+BEGIN_SRC
setenv ipaddr <tftp server ip>
setenv serverip <target ip addr>
tftp 0x43000000 u-boot-devkit-recovery.imx
mmc write 0x43000000 0x42 0x800
#+END_SRC
** From the kernel command line
Download the u-boot binary u-boot-devkit-recovery.imx
#+BEGIN_SRC
dd if=u-boot-devkit-recovery.imx of=/dev/mmcblk0 bs=1024 seek=33
#+END_SRC
* Flash eMMC
** Using SDP
The eMMC that gets flashed is files/devkit.img . Put the "Boot Mode" switch in the USB position.
THIS WILL ERASE EVERYTHING ON YOUR eMMC.
#+BEGIN_SRC
sudo uuu uuu_scripts/flash_librem5-devkit.lst
#+END_SRC
* Create test initramfs
** Download the latest image and kernel
Download the latest kernel and RS9116 out of tree modules.
#+BEGIN_SRC
./scripts/fetch_latest.sh -k
#+END_SRC
** Extract the kernel
The kernel needs to be extracted from the deb for the SDP boot.
#+BEGIN_SRC
./scripts/extract_kernel.sh
#+END_SRC
** Build the test filesystem tarball
This will create a minimal debian rootfs tarball to be used to create an initramfs. If you need additional packages you can add them to the packages variable in the script.
#+BEGIN_SRC
./scripts/create_tarball.sh
#+END_SRC
** Create the initramfs
This will take the tarball created above and customize it to be able to flash the RS9116 module and also adds some test scripts.
#+BEGIN_SRC
./scripts/create_initramfs.sh -t build/test_rootfs.tgz -o files/test_initramfs.img
#+END_SRC
You can include a locally generated kernel, modules and devicetree as well
#+BEGIN_SRC
./scripts/create_initramfs.sh -t build/test_rootfs.tgz -o files/test_initramfs.img -i <path to kernel>
#+END_SRC
** Boot the initramfs
The initramfs can be booted on a board with an empty eMMC for testing and RS9116 flashing. Ensure the boot mode switch is switched to USB boot. Run the command below and then plug in the USB C port of the devkit.
#+BEGIN_SRC
sudo uuu uuu_scripts/test_librem5.lst
#+END_SRC
** Reflash the RS9116
By default no rsi_* modules get loaded. The modules without firmware are in "/lib/modules/<kernel_ver>/drivers/net/wireless/rsi" . The create_initramfs script above adds the rsi firmware and reflash modules in "/usr/src".
There is a convenience script "flash_rsi.sh" that wiil perform the necessary steps. What the script does is it backs up the rsi modules in /lib/modules, copies the firmware into lib firmware and the modprobes the rsi flashing modules. It replaces the original modules when it's done.
Run the script on the target to reflash.
#+BEGIN_SRC
root@pureos-test:~# flash_rsi.sh
#+END_SRC
** RS9116 normal operation
To use the RS9116 without flashing just load the modules by hand.
#+BEGIN_SRC
root@pureos-test:~# modprobe rsi_sdio
#+END_SRC
* Hardware Components
** LCD Panel
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment