Linux on a NanoPi: Difference between revisions
No edit summary |
No edit summary |
||
(One intermediate revision by the same user not shown) | |||
Line 11: | Line 11: | ||
You'll need to install the GCC toolchain for aarch64-linux-gnu along with the usual build tools. For Debianish systems: | You'll need to install the GCC toolchain for aarch64-linux-gnu along with the usual build tools. For Debianish systems: | ||
<syntaxhighlight> | <syntaxhighlight lang="text"> | ||
$ sudo apt install gcc-aarch64-linux-gnu binutils-aarch64-linux-gnu build-essential | $ sudo apt install gcc-aarch64-linux-gnu binutils-aarch64-linux-gnu build-essential | ||
</syntaxhighlight> | </syntaxhighlight> | ||
Line 19: | Line 19: | ||
I cheated a bit here, opting to use the provided <code>make.sh</code> script since it depends on multiple random binaries anyway. Assuming you have a directory set aside for this build process: | I cheated a bit here, opting to use the provided <code>make.sh</code> script since it depends on multiple random binaries anyway. Assuming you have a directory set aside for this build process: | ||
<syntaxhighlight> | <syntaxhighlight lang="text"> | ||
$ git clone -b nanopi5 https://github.com/friendlyarm/rkbin.git | $ git clone -b nanopi5 https://github.com/friendlyarm/rkbin.git | ||
$ git clone -b nanopi5-v2017.09 https://github.com/friendlyarm/uboot-rockchip.git | $ git clone -b nanopi5-v2017.09 https://github.com/friendlyarm/uboot-rockchip.git | ||
Line 26: | Line 26: | ||
From here, the build process for uboot is straightforward. Note that <code>make.sh</code> uses the result of <code>nproc</code> to determine how many make jobs to run, so all of your cores will be at full throttle. | From here, the build process for uboot is straightforward. Note that <code>make.sh</code> uses the result of <code>nproc</code> to determine how many make jobs to run, so all of your cores will be at full throttle. | ||
<syntaxhighlight> | <syntaxhighlight lang="text"> | ||
$ cd uboot-rockchip | $ cd uboot-rockchip | ||
$ ./make.sh nanopi5 | $ ./make.sh nanopi5 | ||
Line 36: | Line 36: | ||
== Compiling the kernel == | == Compiling the kernel == | ||
As with U-Boot, grab the BSP kernel sources: | |||
<syntaxhighlight> | <syntaxhighlight lang="text"> | ||
$ git clone -b nanopi5-v5.10.y_opt https://github.com/friendlyarm/kernel-rockchip.git | $ git clone -b nanopi5-v5.10.y_opt https://github.com/friendlyarm/kernel-rockchip.git | ||
</syntaxhighlight> | </syntaxhighlight> | ||
Line 44: | Line 44: | ||
The rest is a standard cross-compilation of Linux, so I won't delve into the details. The commands I used are below: | The rest is a standard cross-compilation of Linux, so I won't delve into the details. The commands I used are below: | ||
<syntaxhighlight> | <syntaxhighlight lang="text"> | ||
$ export ARCH=arm64 | $ export ARCH=arm64 | ||
$ export CROSS_COMPILE=aarch64-linux-gnu- | $ export CROSS_COMPILE=aarch64-linux-gnu- |
Latest revision as of 09:55, 31 January 2023
This article is a work in progress, and is missing the following pieces:
|
The NanoPi R5S and NanoPi R5C don't yet have mainline Linux or U-Boot support, but that doesn't mean we can't finagle a custom distro anyway, right?
Most of the build steps on the official wiki pages assume you're comfortable using the repo utility and their shell scripts. Unlike those, this article assumes the user wants to suffer for little gain.
Pre-Requisites
You'll need to install the GCC toolchain for aarch64-linux-gnu along with the usual build tools. For Debianish systems:
$ sudo apt install gcc-aarch64-linux-gnu binutils-aarch64-linux-gnu build-essential
Compiling U-Boot
I cheated a bit here, opting to use the provided make.sh
script since it depends on multiple random binaries anyway. Assuming you have a directory set aside for this build process:
$ git clone -b nanopi5 https://github.com/friendlyarm/rkbin.git
$ git clone -b nanopi5-v2017.09 https://github.com/friendlyarm/uboot-rockchip.git
From here, the build process for uboot is straightforward. Note that make.sh
uses the result of nproc
to determine how many make jobs to run, so all of your cores will be at full throttle.
$ cd uboot-rockchip
$ ./make.sh nanopi5
$ ./make.sh --idblock --spl # Argument order is important here!
Along with a bunch of other files, you should now have idblock.bin
and uboot.bin
in your current directory.
Compiling the kernel
As with U-Boot, grab the BSP kernel sources:
$ git clone -b nanopi5-v5.10.y_opt https://github.com/friendlyarm/kernel-rockchip.git
The rest is a standard cross-compilation of Linux, so I won't delve into the details. The commands I used are below:
$ export ARCH=arm64
$ export CROSS_COMPILE=aarch64-linux-gnu-
$ make nanopi5_linux_defconfig
$ make -j9
We'll get to installing once we have Debian installed on our image.