TIL - U-Boot support for HTTP
TIL, Today I Learned, is more of a "I just figured this out: here are my notes, you may find them useful too" rather than a full blog post
Until now, U-Boot did only support UDP and were limited to protocols that are based on that. In practice it meant that you were only able to use TFTP and NFS for network file transfer.
Ying-Chun Liu has recently added support for HTTP [1] and the wget [2] command which opens up for a range of new protocols.
Setup
I do currenty test TCP/HTTP by using it on my i.MX8 eval kit and it works pretty well.
If you just want to test the functionality, you can do it virtually with qemu. It requires that you have both qemu and a cross toolchain for aarch64 installed on your host system.
Clone the repository:
https://github.com/u-boot/u-boot.git
Use qemu_arm64_defconfig as base:
make qemu_arm64_defconfig
Enable the following configurations in order to support TCP and HTTP:
- CONFIG_CMD_WGET=y
- CONFIG_PROT_TCP=y
Build U-Boot:
make CROSS_COMPILE=aarch64-linux-gnu-
Start qemu:
qemu-system-aarch64 -machine virt -cpu cortex-a57 -bios u-boot.bin
Assuming that you already have a HTTP server up and running on your host, you can now fetch the image with wget:
wget $loadaddr 192.168.1.84:/uImage
Or by using serverip:
setenv serverip 192.168.1.84 wget $loadaddr /uImage
Conclusion
This is a great step in the right direction!
Only HTTP is supported for now, which makes it unsuitable for any public website, but HTTPS integreated with UEFI will follows and then we have a standardised way to download boot images!