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!Not 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.
make[1]: *** [__modpost] Error 1
make: *** [modules] Error 2
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 :
3. Let's assume that your vanilla kernel sources are in a directory named linux_vanilla_kernel :# 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"
After a while, you should obtain an output saying that a branch has been created with vanilla kernel sources :# Add the vanilla kernel git repogit remote add vanilla ../linux_vanilla_kernel/# Fetch the vanilla kernel repogit fetch vanilla
4. Generate the patchmaster --> master/vanilla
git diff --no-prefix master/vanilla HEAD > patchfile
5. You can now apply the patch to your vanilla kernel sources
6.Build again# Move the patch to your vanilla kernel working directorymv patchfile ../linux_vanilla_kernel/cd ../linux_vanilla_kernel# Apply the patchpatch -p0 < patchfile
The build process should end successfully now.make bcmrpi_defconfigmake -j8
Hello, the access to the repo is not free anymore,please? I could download the mainline kernel from other source but I dont find the bcmrpi_defconfig.
ReplyDeleteHi there,
ReplyDeleteSorry for the inconvenience, the repo access was set to private. I modified it to public.
Try again and let me know if everything is fine now.
Cheers,
Cem
This comment has been removed by the author.
ReplyDeleteI got it work. Thanks Cem!
ReplyDeleteBut whats the point? Instead you can directly use the raspberry pi github source.
ReplyDeleteYou clone vanilla linux and patch it make it as raspberry linux. In which way it is differs with compiling raspberry Pi kernel?