diff --git a/docs/rpi3.md b/docs/rpi3.md index 0f08c7a64cd151211a1752a7bdf7e13692c8f99b..7e2ee106777c2275bba6b5f76f2e96fe5c7c1465 100644 --- a/docs/rpi3.md +++ b/docs/rpi3.md @@ -44,7 +44,7 @@ help out making proper upstream patches sooner or later. | Project | Base fork | What to do | |---------|-----------|------------| -| linux | https://github.com/Electron752/linux.git commit: b48d47a32b2f27f55904e7248dbe5f8ff434db0a | Two things here. 1. The base is a fork itself and should be upstreamed. 2. We have cherry picked the patches from [LSK OP-TEE 4.4] | +| linux | https://github.com/Electron752/linux.git commit: b48d47a32b2f27f55904e7248dbe5f8ff434db0a | Three things here. 1. The base is a fork itself and should be upstreamed. 2. Apply patch [arm64: dt: RPI3: Add optee node] 3. We have cherry picked the patches from [LSK OP-TEE 4.4] | | arm-trusted-firmware | https://github.com/96boards-hikey/arm-trusted-firmware commit: bdec62eeb8f3153a4647770e08aafd56a0bcd42b | This should instead be based on the official OP-TEE fork or even better the official ARM repository. The patch itself should also be upstreamed. | | U-boot | https://github.com:linaro-swg/u-boot.git | This is just a mirror of the official U-boot git. The patches should be upstreamed. | | OpenOCD | https://github.com/seqlabs/openocd | The patches should be upstreamed. | @@ -206,44 +206,41 @@ $ sudo rm -rf /srv/nfs/rpi/boot/* ``` ### 5.4 Update uboot.env -We need to make a couple of changes to that file to ensure that it will try to -boot using everything we have prepared. So, start by inserting the UART cable -and open up `/dev/ttyUSB0` +There are two ways to update uboot.env. First, you can edit +`build/rpi3/firmware/uboot.env.txt` file, which is used as simple text source for +generation of uboot.env during build and you can just edit u-boot env via UART +and save new values to uboot.env. By using the second way you can avoid rebuilding +and copying uboot.env to SD card. + +#### 5.4.1 Edit uboot.env.txt +All you need to do is to edit network configuration in `build/rpi3/firmware/uboot.env.txt`. +You have to change value of `serverip` to the IP address of your NFS/TFTP server, +`gatewayip` to your router IP address and `nfspath` to the exported path, where root FS +is stored (`/srv/nfs/rpi`). Then you need to generate new `uboot.env`: +```bash +$ cd /home/jbech/devel/optee_projects/rpi3/boot/ +# clean previous uboot.env +$ make u-boot-env-clean +# generate new +$ make u-boot-jtag-bin +``` +Then you need to copy your newly generated `uboot.env`(it's stored in `../out/uboot.env`) +to the BOOT partition of your SD card. + +#### 5.4.2 Edit u-boot.env via UART +Start by inserting the UART cable and open up `/dev/ttyUSB0` ```bash # sudo apt-get install picocom $ picocom -b 115200 /dev/ttyUSB0 ``` Power up the Raspberry Pi and almost immediately hit any key and you should see -the `U-Boot>` prompt. First add a new variable which will gather all files and -boot up the device. For simplicity I call that variable `optee`. So in the -prompt write (pay attention to the IP's used as described in the beginning of -this section): -``` -U-Boot> setenv optee 'usb start; dhcp ${kernel_addr_r} 192.168.1.100:Image; dhcp ${fdt_addr_r} 192.168.1.100:${fdtfile}; dhcp ${atf_load_addr} 192.168.1.100:${atf_file}; run boot_it' -``` - -Also ensure that you have the variables stored that are used in the `optee` -U-Boot environment variable above. If you don't, then do: - -``` -U-Boot> setenv fdtfile 'bcm2710-rpi-3-b.dtb' -U-Boot> setenv atf_file 'optee.bin' -``` - -Next, we should update the kernel commandline to use NFS, to easier understand -what changes needs to be done I list both the unmodified command line and the -changed and correct one for NFS boot. - -Original -``` -setenv bootargs 'console=ttyS0,115200 root=/dev/mmcblk0p2 rw rootfs=ext4 ignore_loglevel dma.dmachans=0x7f35 rootwait 8250.nr_uarts=1 elevator=deadline fsck.repair=yes smsc95xx.macaddr=b8:27:eb:74:93:b0 bcm2708_fb.fbwidth=1920 bcm2708_fb.fbheight=1080 vc_mem.mem_base=0x3dc00000 vc_mem.mem_size=0x3f000000' -``` - -Updated for NFS boot +the `U-Boot>` prompt. First edit your NFS/TFTP server IP address: ``` -setenv bootargs 'console=ttyS0,115200 root=/dev/nfs rw rootfstype=nfs nfsroot=192.168.1.100:/srv/nfs/rpi,udp,vers=3 ip=dhcp ignore_loglevel dma.dmachans=0x7f35 rootwait 8250.nr_uarts=1 elevator=deadline fsck.repair=yes smsc95xx.macaddr=b8:27:eb:74:93:b0 bcm2708_fb.fbwidth=1920 bcm2708_fb.fbheight=1080 vc_mem.mem_base=0x3dc00000 vc_mem.mem_size=0x3f000000' +U-Boot> setenv serverip '192.168.1.100' ``` +Perform the same steps for `gateway`(your router IP address) and +`nfspath` (the exported path, where root FS is stored, for example `/srv/nfs/rpi`) If you want those environment variables to persist between boots, then type. ``` @@ -259,7 +256,7 @@ the device and kernel, secure side OP-TEE and the entire root fs should be loaded from the network shares. Power up the Raspberry, halt in U-Boot and then type. ``` -U-Boot> run optee +U-Boot> run nfsboot ``` Profit! @@ -458,6 +455,7 @@ improvements, as usual, feel free to contribute. [J-Link debuggers]: https://www.segger.com/jlink_base.html [linaro-vivid-developer-20151215-114.tar.gz]: http://releases.linaro.org/ubuntu/images/developer-arm64/15.12/linaro-vivid-developer-20151215-114.tar.gz [LSK OP-TEE 4.4]: https://git.linaro.org/kernel/linux-linaro-stable.git/log/?h=v4.4/topic/optee +[arm64: dt: RPI3: Add optee node]: https://github.com/linaro-swg/linux/commit/cc225a78910c37d78f8a00c80dcbf59ef7762884 [OpenOCD]: http://openocd.org [OP-TEE prerequisites]: https://github.com/OP-TEE/build#71-pre-requisites [press release]: http://www.sequiturlabs.com/media_portfolio/sequitur-labs-collaborates-with-linaro-to-lower-barriers-to-iot-security-education-for-raspberry-pi-maker-community