基于coolpi 4b ubuntu22系统编译coolpi nano(RV1106)内核
首先需要安装32位arm-gcc编译工具链
coolpi@coolpi:~/kernel/coolpi-kernel$ sudo apt install gcc-arm-linux-gnueabi
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following packages were automatically installed and are no longer required:
aapt adb android-libaapt android-libadb android-libandroidfw android-libbacktrace android-libbase android-libboringssl android-libcrypto-utils android-libcutils android-liblog android-libunwind
android-libutils android-libziparchive android-sdk-platform-tools-common fonts-lyx inotify-tools libboost-dev libboost1.74-dev libexpat1-dev libinotifytools0 libjs-jquery-ui liblbfgsb0 libllvm15
libopenblas-dev libopenblas-pthread-dev libopenblas0 libpython3-dev libpython3.10-dev libqhull-r8.0 libxsimd-dev python-matplotlib-data python3-appdirs python3-beniget python3-cycler
python3-decorator python3-dev python3-fonttools python3-fs python3-gast python3-kiwisolver python3-lz4 python3-matplotlib python3-mpmath python3-numpy python3-packaging python3-ply python3-pyqt5
python3-pyqt5.sip python3-pythran python3-scipy python3-sympy python3-ufolib2 python3-unicodedata2 python3-wheel python3.10-dev unicode-data zlib1g-dev
Use 'sudo apt autoremove' to remove them.
The following additional packages will be installed:
binutils-arm-linux-gnueabi cpp-11-arm-linux-gnueabi cpp-arm-linux-gnueabi gcc-11-arm-linux-gnueabi gcc-11-arm-linux-gnueabi-base gcc-11-cross-base gcc-12-cross-base libasan6-armel-cross
libatomic1-armel-cross libc6-armel-cross libc6-dev-armel-cross libgcc-11-dev-armel-cross libgcc-s1-armel-cross libgomp1-armel-cross libstdc++6-armel-cross libubsan1-armel-cross
linux-libc-dev-armel-cross
Suggested packages:
binutils-doc gcc-11-locales cpp-doc gcc-11-doc autoconf automake libtool gdb-arm-linux-gnueabi gcc-doc
The following NEW packages will be installed:
binutils-arm-linux-gnueabi cpp-11-arm-linux-gnueabi cpp-arm-linux-gnueabi gcc-11-arm-linux-gnueabi gcc-11-arm-linux-gnueabi-base gcc-11-cross-base gcc-12-cross-base gcc-arm-linux-gnueabi
libasan6-armel-cross libatomic1-armel-cross libc6-armel-cross libc6-dev-armel-cross libgcc-11-dev-armel-cross libgcc-s1-armel-cross libgomp1-armel-cross libstdc++6-armel-cross libubsan1-armel-cross
linux-libc-dev-armel-cross
0 upgraded, 18 newly installed, 0 to remove and 42 not upgraded.
Need to get 37.7 MB of archives.
After this operation, 119 MB of additional disk space will be used.
Do you want to continue? [Y/n]
...
然后修改默认编译脚本
coolpi@coolpi:~/kernel/coolpi-kernel$ git diff build-kernel.sh
diff --git a/build-kernel.sh b/build-kernel.sh
index 3eb4d07d8041..4bb6d806ebd8 100755
--- a/build-kernel.sh
+++ b/build-kernel.sh
@@ -69,6 +69,9 @@ if [ "$RV1106" == "1" ]; then
TOOLCHAIN_ARM32=$K_SRC/toolchain32uc/bin
export PATH=$TOOLCHAIN_ARM32:$PATH
fi
+ if [ "$ARCH" == "aarch64" ]; then
+ export CROSS_COMPILE=arm-linux-gnueabi-
+ fi
coolpi@coolpi:~/kernel/coolpi-kernel$
执行nano主板内核编译
coolpi@coolpi:~/kernel/coolpi-kernel$ ./build-kernel.sh cpnano
编译生成目录结构
coolpi@coolpi:~/kernel/coolpi-kernel$ tree out
out
├── extlinux
│ └── extlinux.conf
├── initrd32.img
├── modules.tar.gz
├── rv1106-cpnano.dtb
└── vmlinuz
1 directory, 5 files