Kernel compilation
The following takes linux-6.6 as an example to introduce how to compile your own kernel for Bianbu, supporting cross-compilation (fast) and local compilation (convenient).
Download source code
git clone https://gitee.com/bianbu-linux/linux-6.6 ~/linux-6.
Cross-compilation
Development environment
Run the command sudo apt-get install asciidoc xmlto
to install asciidoc xmlto .
Compiler
Address: http://archive.spacemit.com/toolchain/
- Download the cross compiler:
For example, spacemit-toolchain-linux-glibc-x86_64-v1.0.0.tar.xz
- Unzip:
sudo tar -Jxf /path/to/spacemit-toolchain-linux-glibc-x86_64-v1.0.0.tar.xz -C /opt
Tip: /opt is the path where you unzipped the files, or you can choose your own path.
- Set the cross compiler environment variable:
export PATH=/path/to/spacemit-toolchain-linux-glibc-x86_64-v1.0.0/bin:$PATH
Tip: /path/to/ is the path where you unzipped the files, such as / opt .
Compile the software package
-
Run the command
cd ~/linux-6.6
to enter the kernel source directory. -
Set the kernel compilation parameters:
export CROSS_COMPILE=riscv64-unknown-linux-gnu-
export ARCH=riscv
export LOCALVERSION=""
-
Run the command
make k1_defconfig
to generate the default configuration. -
Modify the configuration. If you do not want to change, you can skip:
make menuconfig
- To save the modified configuration:
make savedefconfig
mv defconfig arch/riscv/configs/k1_defconfig
- Run the command
make -j$(nproc) bindeb-pkg
to compile the debian package.
When you see the following information, it means that the compilation is successful.
dpkg-genchanges: info: binary-only upload (no source code included)
dpkg-source --after-build .
dpkg-buildpackage: info: binary-only upload (no source included)
The software package is located in the upper directory, commonly used packages:
-
linux-image-6.6.36_6.6.36-*.deb
Kernel Image software package.
-
linux-tools-6.6.36_6.6.36-*.deb
Tool software packages such as perf.
- Copy to the device, install and reboot:
sudo dpkg -i linux-image-6.6.36_6.6.36-*.deb
sudo reboot