In the kernel build post, we build pcDuino kernel on a X86 PC with cross-compilation. In this post, we are going to show something interesting by building kernel on pcDuino itself. Besides the time it takes to build, another issue is the storage space on pcDuino. There are two ways to get around: one is to use a large SD card, and the other one is to use NFS to make an external storage area to pcDuino.
Extra Space provided by SD card:
Let’s look at first option, ‘extra space provided by SD card’. We use a 16G SD card and boot from this SD card. The detail steps to use large SD card can be found at: http://learn.linksprite.com/?p=919
Note: If we build the kernel in this way, it will take a long time. We just show that this is possible, but it is not recommended. We recommend to build kernel on x86-64.
In this work, we need to login as root user:
$sudo su
First, we need to download source files of kernel:
For your convenience, we hosted the kernel source files for pcDuino also at amazon cloud. We are going to work at at directory “ /lib/modules/3.4.29+”.
$cd /lib/modules/3.4.29+
root@ubuntu:/lib/modules/3.4.29+#wget https://s3.amazonaws.com/linksprite/pcduino/kernel/linux-sunxi.tar.bz2
root@ubuntu:/lib/modules/3.4.29+#wget https://s3.amazonaws.com/linksprite/pcduino/kernel/sun4i_defconfig
root@ubuntu:/lib/modules/3.4.29+#tar jxf linux-sunxi.tar.bz2
We create a directory named ‘build’ under “/lib/modules/3.4.29+”, and we copy ‘
sun4i_defconfig’ to the directory ‘build’, and rename as ‘.config’.
root@ubuntu:/lib/modules/3.4.29+#mkdir build
root@ubuntu:/lib/modules/3.4.29+#cp sun4i_defconfig ./build/.config
Before we build the kernel, we need to install some necessary packages:
root@ubuntu:/lib/modules/3.4.29+#sudo apt-get install u-boot-tools libncurses5 libsysfs-dev libncurses5-dev
Now we need to configure the kernel:
root@ubuntu:/lib/modules/3.4.29+/linux-sunxi#make menuconfig O=../build
It takes sometime for the menu to pop up:
The menu looks like the following:
We select “Load an Alternative Configuration file” to load “/lib/modules/3.4.29+/build/.config”.
We also need to enter into ‘General setup —>’ by moving the cursor to that line and press ‘ENTER’:
As shown on the above figure, we locate the line “Initial RAM filesystem and RAM disk (initramfas/initrd) support, and press ‘ENTER’ to remove the asterisk ‘*’.
Return to the previous interface by navigate to ‘Exit’, and save the new configuration:
Change into the ‘build’ directory, and build the kernel:
root@ubuntu:/lib/modules/3.4.29+/build#make
The above process will take about 4 hours. Please wait patiently.
Leave a Reply
You must be logged in to post a comment.