[llvmlinux] the Shared kernel in llvm-setup

Behan Webster behanw at converseincode.com
Sat Jul 28 02:42:16 UTC 2012


I had a question this week about the "shared kernel" repo (formerly the 
"local kernel" repo).

In the llvm-setup build system, when you clone a kernel, it first clones 
mainline to arch/all/kernel.git before cloning the kernel tree for your 
target. The question is "why do we clone twice?"

The answer is "to conserve disk space"; the build system checks out the 
kernel in multiple places for various reasons. When it was possible to 
build the kernel out-of-tree, a lot of this wasn't necessary, but that 
capability was removed from the kernel some time ago, and so we have to 
resort to other means. Instead we get a bare clone of mainline 
(arch/all/kernel.git) and then all the other cloned kernels reference 
that clone; it sets up git alternatives to be able to store identical 
objects in another local git repo. It means that even though there are 
several git clones, there is only one copy of an object stored in a 
central place (the shared kernel repo). Make sense?

"Not everyone uses mainline for their target" I hear you say. Well, 
enough of it is the same that the savings in disk space is significant, 
which makes the slight increase in makefile complexity well worth it.

All this may not be a big deal for everyone, but if you're testing 
things in multiple targets in the same llvm-setup tree (like I am), the 
savings in disk space is significant.

I'll be adding this explanation to the wiki as well.

The only caveat to the above is that until this week, the shared kernel 
(which was called the local kernel) was a regular git clone. By that I 
mean it had a working tree checked out in arch/all/kernel. This was 
wasting a lot of unneeded space and was confusing to some. So this week 
Mark Charlebois changed it to a bare clone (Thanks Mark!) I've added 
some logic to change the old cloned local kernel to the new bare shared 
kernel, and hopefully fix your other checked out kernels along the way. 
If it doesn't work for you, you can always remove arch/all/kernel and 
run make for your target which will do the clone all over again for you.

Behan

-- 
Behan Webster
behanw at converseincode.com



More information about the LLVMLinux mailing list