User Tools

Site Tools


developers:env_buildtest

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
developers:env_buildtest [2018/11/15 17:59]
mick
developers:env_buildtest [2019/04/12 19:20] (current)
mick [Cross-compile OpenSBI]
Line 48: Line 48:
 </​code>​ </​code>​
  
 +===== Cross-compile OpenSBI =====
 +
 +A more recent and better maintained alternative to BBL, meant to be the reference SBI implementation,​ is OpenSBI. It can be used both as a library to be used by boot loaders and as a standalone Linux boot loader. It supports various targets including QEMU.
 +
 +<​code>​
 +git clone --depth=1 https://​github.com/​riscv/​opensbi.git <osbi sources dir>
 +cd <osbi sources dir>
 +CROSS_COMPILE=riscv64-unknown-linux-gnu- PLATFORM_RISCV_XLEN=<​32 or 64> \
 +make PLATFORM=<​target name, e.g. qemu/​virt>​
 +</​code>​
 +
 +You may also specify a built-in payload like on BBL, using the FW_PAYLOAD_PATH env variable during make.
 +
 +<​code>​
 +CROSS_COMPILE=riscv64-unknown-linux-gnu- PLATFORM_RISCV_XLEN=<​32 or 64> \
 +make PLATFORM=<​target name, e.g. qemu/​virt>​ FW_PAYLOAD_PATH=<​linux sources dir>/​arch/​riscv/​boot/​Image
 +</​code>​
 +
 +In the first case the resulting binary will be called //​fw_jump.elf//​ and in the second case //​fw_payload.elf//,​ also .bin files with the same names will be generated, for using them directly on hw boards (QEMU only supports loading ELFs). These files are available at <osbi sources dir>/​platform/<​platform name>/​firmware/​.
  
 ===== Prepare a simple initramfs for testing ===== ===== Prepare a simple initramfs for testing =====
Line 65: Line 84:
 ==== Cross-compile busybox ==== ==== Cross-compile busybox ====
  
-[[https://​busybox.net/​about.html | Busybox]] is a set of common UNIX tools and services combined together on a single program, that can also be statically compiled to provide a system-in-a-box,​ without any external dependencies. Since it's a whole suite of tools, its configuration process is similar to that of the kernel. You may use //make menuconfig//​ and work your way through, use //make defconfig// to get a full-featured build or you may grab {{ :​developers:​busybox-config.gz |}} and use that instead. Remember to edit the configuration and properly set CONFIG_PREFIX to <rootfs dir>.+[[https://​busybox.net/​about.html | Busybox]] is a set of common UNIX tools and services combined together on a single program, that can also be statically compiled to provide a system-in-a-box,​ without any external dependencies. Since it's a whole suite of tools, its configuration process is similar to that of the kernel. You may use //make menuconfig//​ and work your way through, use //make defconfig// to get a full-featured build (remember to edit the configuration and properly set CONFIG_PREFIX to <rootfs dir>​), ​or you may grab {{ :​developers:​busybox-config.gz |}} and use that instead.
  
 <​code>​ <​code>​
Line 132: Line 151:
 Copy the initramfs.img file from /tmp to anywhere you want, you may now test your Bootloader + Linux kernel + initramfs setup with an [[developers:​env_emul|emulator]]. Copy the initramfs.img file from /tmp to anywhere you want, you may now test your Bootloader + Linux kernel + initramfs setup with an [[developers:​env_emul|emulator]].
  
-====== Alternatives ====== +<WRAP info>
 ==== BusyBear ==== ==== BusyBear ====
  
 BusyBear is a small Linux environment that utilizes BusyBox and Dropbear. The build process will do most of the above for you, you may follow the instructions [[https://​github.com/​michaeljclark/​busybear-linux | here]] BusyBear is a small Linux environment that utilizes BusyBox and Dropbear. The build process will do most of the above for you, you may follow the instructions [[https://​github.com/​michaeljclark/​busybear-linux | here]]
 +</​WRAP>​
developers/env_buildtest.1542297554.txt.gz · Last modified: 2018/11/15 17:59 by mick