Difference between revisions of "User:RemDogKap/SandBox/Build U-Boot and OpenSBI From Source"
(Created page with "Placeholder intro and explanation, I'm tired don't want to write now, contributions welcome Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident,...") |
(set up compilation environment and build u-boot sections written) |
||
Line 5: | Line 5: | ||
==Preparing the Build Environment== | ==Preparing the Build Environment== | ||
Fist, | Fist, install the cross-compiler and if not already installed, git. | ||
sudo apt update && sudo apt install gcc-riscv64-linux-gnu | $ sudo apt update && sudo apt install gcc-riscv64-linux-gnu git | ||
<span class="mw-customtoggle-gcc-version-toggle" style="text-decoration:underline;color:#0645ad">[Optional] Check the version of the <code>riscv64-linux-gnu-gcc</code> compiler.</span> | <span class="mw-customtoggle-gcc-version-toggle" style="text-decoration:underline;color:#0645ad">[Optional] Check the version of the <code>riscv64-linux-gnu-gcc</code> compiler.</span> | ||
<div class="mw-collapsible mw-collapsed" id="mw-customcollapsible-gcc-version-toggle"> | |||
riscv64-linux-gnu-gcc -v | $ riscv64-linux-gnu-gcc -v | ||
The output should looks something like: | |||
<pre> | <pre> | ||
Using built-in specs. | Using built-in specs. | ||
COLLECT_GCC=riscv64-linux-gnu-gcc | COLLECT_GCC=riscv64-linux-gnu-gcc | ||
Line 21: | Line 21: | ||
gcc version 10.2.1 20210110 (Debian 10.2.1-6) | gcc version 10.2.1 20210110 (Debian 10.2.1-6) | ||
</pre> | </pre> | ||
</div> | |||
Create or enter the directory where the files used in this guide will be stored. This tutorial will be using the Linux home directory. | |||
<span class="mw-customtoggle-home-directory-example" style="text-decoration:underline;color:#0645ad">Home Directory Example</span> | |||
<div class="mw-collapsible mw-collapsed" id="mw-customcollapsible-home-directory-example"> | |||
$ cd ~ | |||
</div> | |||
<span class="mw-customtoggle-new-directory-example" style="text-decoration:underline;color:#0645ad">New Directory Example</span> | |||
<div class="mw-collapsible mw-collapsed" id="mw-customcollapsible-new-directory-example"> | |||
$ mkdir ~/Star64-Firmware | |||
$ cd ~/Star64-Firmware | |||
</div> | |||
==U-Boot== | |||
Clone the U-Boot GitHub repository. The entire history is not needed (<code>--depth 1</code>) and we want the Star64 branch (<code>-b Star64</code>). | |||
$ git clone --depth 1 -b Star64 <nowiki>https://github.com/Fishwaldo/u-boot.git</nowiki> | |||
Enter the U-Boot directory. | |||
$ cd u-boot | |||
Select the U-Boot configuration for the Star64, marking the architecture as RISC-V and using the cross-compiler installed earlier. | |||
$ make pine64_star64_defconfig ARCH=riscv CROSS_COMPILE=riscv64-linux-gnu- | |||
Finally, compile U-Boot. | |||
$ make ARCH=riscv CROSS_COMPILE=riscv64-linux-gnu- | |||
This should create three files. | |||
# The U-Boot binary, later packaged as an OpenSBI payload, located at <code>/u-boot/u-boot.bin</code>. | |||
# The device tree blob (binary), which contains information on the characteristics of the device and is passed to the operating system instead of hard-coding device configurations into the operating system, and is located at <code>/u-boot/arch/riscv/dts/pine64_star64.dtb</code>. | |||
# The U-Boot secondary program loader which will later be packaged into the <code>u-boot-spl.bin.normal.out</code> file and is located at <code>/u-boot/spl/u-boot-spl.bin</code>. | |||
== | |||
==Credits== | |||
https://doc-en.rvspace.org/VisionFive2/SWTRM/VisionFive2_SW_TRM/compiling_u-boot_and_kernel%20-%20vf2.html | |||
https://wiki.pine64.org/wiki/User:Vitali/Create_a_bootable_Debian/Linux_SDCard_for_the_Pine64/Star64_from_scratch |
Revision as of 23:02, 25 June 2023
Placeholder intro and explanation, I'm tired don't want to write now, contributions welcome
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
- Must use linux, can use wsl
Preparing the Build Environment
Fist, install the cross-compiler and if not already installed, git.
$ sudo apt update && sudo apt install gcc-riscv64-linux-gnu git
[Optional] Check the version of the riscv64-linux-gnu-gcc
compiler.
$ riscv64-linux-gnu-gcc -v
The output should looks something like:
Using built-in specs. COLLECT_GCC=riscv64-linux-gnu-gcc COLLECT_LTO_WRAPPER=/usr/lib/gcc-cross/riscv64-linux-gnu/10/lto-wrapper Target: riscv64-linux-gnu Configured with: ../src/configure -v --with-pkgversion='Debian 10.2.1-6' --with-bugurl=file:///usr/share/doc/gcc-10/README.Bugs --enable-languages=c,ada,c++,go,d,fortran,objc,obj-c++,m2 --prefix=/usr --with-gcc-major-version-only --program-suffix=-10 --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-libitm --disable-libsanitizer --disable-libquadmath --disable-libquadmath-support --enable-plugin --enable-default-pie --with-system-zlib --enable-libphobos-checking=release --without-target-system-zlib --enable-multiarch --disable-werror --disable-multilib --with-arch=rv64imafdc --with-abi=lp64d --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=riscv64-linux-gnu --program-prefix=riscv64-linux-gnu- --includedir=/usr/riscv64-linux-gnu/include --with-build-config=bootstrap-lto-lean --enable-link-mutex Thread model: posix Supported LTO compression algorithms: zlib gcc version 10.2.1 20210110 (Debian 10.2.1-6)
Create or enter the directory where the files used in this guide will be stored. This tutorial will be using the Linux home directory.
Home Directory Example
$ cd ~
New Directory Example
$ mkdir ~/Star64-Firmware $ cd ~/Star64-Firmware
U-Boot
Clone the U-Boot GitHub repository. The entire history is not needed (--depth 1
) and we want the Star64 branch (-b Star64
).
$ git clone --depth 1 -b Star64 https://github.com/Fishwaldo/u-boot.git
Enter the U-Boot directory.
$ cd u-boot
Select the U-Boot configuration for the Star64, marking the architecture as RISC-V and using the cross-compiler installed earlier.
$ make pine64_star64_defconfig ARCH=riscv CROSS_COMPILE=riscv64-linux-gnu-
Finally, compile U-Boot.
$ make ARCH=riscv CROSS_COMPILE=riscv64-linux-gnu-
This should create three files.
- The U-Boot binary, later packaged as an OpenSBI payload, located at
/u-boot/u-boot.bin
. - The device tree blob (binary), which contains information on the characteristics of the device and is passed to the operating system instead of hard-coding device configurations into the operating system, and is located at
/u-boot/arch/riscv/dts/pine64_star64.dtb
. - The U-Boot secondary program loader which will later be packaged into the
u-boot-spl.bin.normal.out
file and is located at/u-boot/spl/u-boot-spl.bin
.
==