8,367
edits
Changes
→Compile the linux kernel
# Run the '''build.sh''' script, remember to add sudo permissions
::{| class="wikitable" style="width:800px;"
|-
|
test@test:~/orangepi-build$ '''sudo ./build.sh'''
|}
<ol start="2" style="list-style-type: decimal;">
<li>Select '''Kernel package''' and press Enter</li></ol>
<div class="figure">
[[File:zero2w-img281.png]]
</div></ol>
<ol start="3" style="list-style-type: decimal;">
<li>Then you will be prompted whether you need to display the kernel configuration interface. If you do not need to modify the kernel configuration, select the first one. If you need to modify the kernel configuration, select the second one.</li></ol>
[[File:zero2w-img282.png]]
</ol>
<ol start="4" style="list-style-type: decimal;">
<li>Then select the model of the development board</li></ol>
[[File:zero2w-img275.png]]
</ol>
<ol start="5" style="list-style-type: decimal;">
<li>Then select the branch type of the kernel source code</li></ol>
::b. The next branch will compile the linux6.1 kernel source code</blockquote>[[File:zero2w-img276.png]]
::[[File:zero2w-img276.png]]
</ol>
<ol start="6" style="list-style-type: decimal;">
<li>If you choose to display the kernel configuration menu (the second option) in step 3), the kernel configuration interface opened through '''make menuconfig''' will pop up. At this time, you can directly modify the kernel configuration. After modification, save and exit. Yes, compilation of the kernel source code will begin after exiting.</li></ol>
[[File:zero2w-img283.png]]
<ol style="list-style-type: lower-alpha;">
<li>If you do not need to modify the kernel configuration options, when running the build.sh script, pass '''KERNEL_CONFIGURE=no''' to temporarily block the pop-up of the kernel configuration interface.</li></ol>{| class="wikitable" style="width:800px;" |-|
test@test:~/orangepi-build$ '''sudo ./build.sh KERNEL_CONFIGURE=no'''
|}</ol>
<ol start="2" style="list-style-type: lower-alpha;">
<li><p>b. You can also set '''KERNEL_CONFIGURE=no''' in the orangepi-build/userpatches/config-default.confconfiguration file to permanently disable this function.</p></li>
<li><p>If the following error is prompted when compiling the kernel, it is because the Ubuntu PC terminal interface is too small, causing the make menuconfig interface to be unable to be displayed. Please increase the Ubuntu PC terminal to the maximum size, and then rerun the build.sh script.</p></li></ol>
[[File:zero2w-img284.png]]
</ol></ol>
<ol start="7" style="list-style-type: decimal;">
<li><p>Part of the information prompted when compiling the next branch kernel source code is explained as follows:</p>
<ol style="list-style-type: lower-alpha;">
<li>Version of the linux kernel source code</li></ol></li></ol>{| class="wikitable" style="width:800px;" |-|
[ o.k. ] Compiling current kernel [ '''6.1.31''' ]
|}</ol>
<ol start="2" style="list-style-type: lower-alpha;">
<li>The version of the cross-compilation tool chain used</li></ol>{| class="wikitable" style="width:800px;" |-|
[ o.k. ] Compiler version [ '''aarch64-linux-gnu-gcc 11''' ]
|}</ol>
<ol start="3" style="list-style-type: lower-alpha;">
<li>The default configuration file used by the kernel and the path where it is stored are as follows</li></ol>{| class="wikitable" style="width:800px;" |-|
[ o.k. ] Using kernel config file [ '''orangepi-build/external/config/kernel/linux-6.1-sun50iw9-next.config''' ]
|}</ol>
<ol start="4" style="list-style-type: lower-alpha;">
<li>The path to the kernel-related deb package generated by compilation</li></ol>{| class="wikitable" style="width:800px;" |-|
[ o.k. ] Target directory [ '''output/debs/''' ]
|}</ol>
<ol start="5" style="list-style-type: lower-alpha;">
<li>The package name of the kernel image deb package generated by compilation</li></ol>{| class="wikitable" style="width:800px;" |-|
[ o.k. ] File name [ '''linux-image-next-sun50iw9_x.x.x_arm64.deb''' ]
|}</ol>
<ol start="6" style="list-style-type: lower-alpha;">
<li>Compilation time</li></ol>{| class="wikitable" style="width:800px;" |-|
[ o.k. ] Runtime [ '''10 min''' ]
|}</ol>
<ol start="7" style="list-style-type: lower-alpha;">
<li>Finally, the compilation command to repeatedly compile the last selected kernel will be displayed. Use the following command without selecting through the graphical interface, and you can directly start compiling the kernel source code.</li></ol>{| class="wikitable" style="width:800px;" |-|
[ o.k. ] Repeat Build Options [ '''sudo ./build.sh BOARD=orangepizero2w BRANCH=next BUILD_OPT=kernel KERNEL_CONFIGURE=no''' ]
|}</ol></li></ol>
<ol start="8" style="list-style-type: decimal;">
<li><p>View the kernel-related deb package generated by compilation</p>
<li><p>'''linux-dtb-next-sun50iw9_x.x.x_arm64.deb''' Contains dtb files used by the kernel</p></li>
<li><p>'''linux-headers-next-sun50iw9_x.x.x_arm64.deb''' Contains kernel header files</p></li>
<li><p>'''linux-image-next-sun50iw9_x.x.x_arm64.deb''' Contains kernel images and kernel modules</p></li></ol></li></ol>{| class="wikitable" style="width:800px;" |-|
test@test:~/orangepi-build$ '''ls output/debs/linux-*'''
output/debs/linux-image-next-sun50iw9_x.x.x_arm64.deb
|}
</ol>
</li></ol>
<ol start="9" style="list-style-type: decimal;">
<li>When the orangepi-bulid compilation system compiles the linux kernel source code, it will first synchronize the linux kernel source code with the linux kernel source code of the github server. Therefore, if you want to modify the linux kernel source code, you first need to turn off the update function of the source code ('''it needs to be completely compiled once This function can only be turned off after obtaining the Linux kernel source code, otherwise it will prompt that the source code of the Linux kernel cannot be found'''), otherwise the modifications will be restored. The method is as follows:</li>
test@test:~/orangepi-build$ '''vim userpatches/config-default.conf'''
IGNORE_UPDATES="'''<span style="color:#FF0000">yes</span>'''"|}</ol>
<ol start="10" style="list-style-type: decimal;">
<li><p>If the kernel is modified, you can use the following method to update the kernel and kernel module of the development board Linux system</p>
<ol style="list-style-type: lower-alpha;">
<li>Upload the compiled deb package of the Linux kernel to the Linux system of the development board</li></ol></li></ol>{| class="wikitable" style="width:800px;" |-|
test@test:~/orangepi-build$ '''cd output/debs'''
'''linux-image-next-sun50iw9_x.x.x_arm64.deb [email protected]:/root'''
|}</ol>
<ol start="2" style="list-style-type: lower-alpha;">
<li>Install the deb package of the new linux kernel just uploaded.</li></ol>{| class="wikitable" style="width:800px;" |-|
orangepi@orangepi:~$ '''sudo dpkg -i linux-image-next-sun50iw9_x.x.x_arm64.deb'''
|}</ol>
<ol start="3" style="list-style-type: lower-alpha;">
<li>Then restart the development board and check whether the kernel-related modifications have taken effect.</li></ol>{| class="wikitable" style="width:800px;" |-|
orangepi@orangepi:~$ '''sudo''' '''reboot'''
|}
</ol>
</li></ol>
<span id="compile-rootfs"></span>
== Compile rootfs ==