-
RPi를 위한 바닐라 커널 빌드하기Raspberry Pi 2013. 10. 18. 13:11
출처: http://myembeddedlinux.blogspot.kr/2013/05/build-vanilla-kernel-for-raspberry-pi.html
Check this post if you're looking for the build instructions.
Check this post if you're looking for the git main commands.
Raspberry Pi's official kernel git repository :
We could have cloned this repository, built it and ran a linux on our Pi.... yes we could, but we are a bit sadistic and as they say in my fitness club : "No pain, no gain". So let's try something fun : cloning the mainline kernel ( the latest stable version ) and adapt it for the Pi.
Our repository is hosted on bitbucket - which is free by the way - and is a clone of the mainline kernel 3.8.9 :
What we need to do first is grabbing the raspberry Pi's defconfig file. Manually configuring the build would take too much time and requires strong technical skills. This method will be experimented later...
Now we got the file, copy it to arch/arm/configs, and run :
make bcmrpi_defconfig
(ARCH and CROSS_COMPILE must be defined)
First build attempt will fail with :
ERROR: "v7wbi_flush_kern_tlb_range" [drivers/staging/zsmalloc/zsmalloc.ko] undefined!
make[1]: *** [__modpost] Error 1
make: *** [modules] Error 2Not surprising, otherwise a git repository dedicated to the Pi would certainly not exist. The next step is to modify our sources to make them build for the Pi.
Generate a patch to merge the vanilla sources with the rpi ones
The following method is not really the best way for the patch generation, you should consider using git format-patch instead, but, if like me you're living in a building with a poor internet connection, you may want to do it like this :
1. Download the official linux rpi-3.8.y archive from github (about 100 MB, not a big deal compared to GBs of data that you have to download using git fetch command with the rpi remote repo)
2. Create a local git repo with your rpi sources :
# Create a directory where you'll store the rpi linux sourcesmkdir rpi-3.8.ycd rpi-3.8.y# Move the archive to the current directorymv /Downloads/linux-rpi-3.8.y.tar.gz .# Extract ittar -xf linux-rpi-3.8.y.tar.gz# Initialize the repositorygit init# Add all elementsgit add .# Commit themgit commit -m "added : rpi-3.8.y sources"3. Let's assume that your vanilla kernel sources are in a directory named linux_vanilla_kernel :
# Add the vanilla kernel git repogit remote add vanilla ../linux_vanilla_kernel/# Fetch the vanilla kernel repogit fetch vanillaAfter a while, you should obtain an output saying that a branch has been created with vanilla kernel sources :
master --> master/vanilla4. Generate the patch
git diff --no-prefix master/vanilla HEAD > patchfile
5. You can now apply the patch to your vanilla kernel sources
# Move the patch to your vanilla kernel working directorymv patchfile ../linux_vanilla_kernel/cd ../linux_vanilla_kernel# Apply the patchpatch -p0 < patchfile6.Build again
make bcmrpi_defconfigmake -j8The build process should end successfully now.
728x90반응형