Difference between revisions of "Kernel Build"
(Main website is up to date so just add hints and tips to this entry) |
Ashcharles (Talk | contribs) |
||
(4 intermediate revisions by one other user not shown) | |||
Line 1: | Line 1: | ||
− | This wiki entry | + | There are [https://github.com/gumstix/yocto-manifest/wiki/Kernel,-Device-Tree-and-u-boot updated instructions] for standalone compilation of u-boot and linux. Yocto users may also find [https://github.com/gumstix/yocto-manifest/wiki/Kernel-Compilation this] useful. |
+ | |||
+ | This wiki entry has some older details on building the Gumstix Linux kernel and bootloader from source. | ||
Start by installing the [http://wiki.gumstix.org/index.php?title=Toolchain toolchain]. | Start by installing the [http://wiki.gumstix.org/index.php?title=Toolchain toolchain]. | ||
Line 10: | Line 12: | ||
The most usual way to pull the source code is using git: | The most usual way to pull the source code is using git: | ||
− | $ git clone --branch omap-3.6 git://github.com/gumstix/linux.git | + | $ git clone --branch omap-3.6 git://github.com/gumstix/linux.git linux |
− | will clone the entire source tree to your machine and checkout the omap-3.6 branch into the "linux" directory. There are plenty of guides online to using git but a few timesaving methods are worth mentioning: | + | will clone the entire source tree to your machine and checkout the omap-3.6 branch into the "linux" directory. You can also use <tt>https</tt> instead of <tt>git</tt>. There are plenty of guides online to using git but a few timesaving methods are worth mentioning: |
=== Cloning a shallow tree === | === Cloning a shallow tree === | ||
Line 28: | Line 30: | ||
(this will do a 301 redirect so be aware of this - you might get a very small file with html in it!) | (this will do a 301 redirect so be aware of this - you might get a very small file with html in it!) | ||
− | For the 3.6 branch, this will | + | For the 3.6 branch, this will pull approximately 123MB from the github server. |
+ | |||
+ | === Subtleties === | ||
There is absolutely no difference in result aside from the presence of the ".git" directory, but this has a few subtle consequences. If you build with the zip file, you will get kernel and module versions stamped "3.6.0". If you build from the git repository, the make process: | There is absolutely no difference in result aside from the presence of the ".git" directory, but this has a few subtle consequences. If you build with the zip file, you will get kernel and module versions stamped "3.6.0". If you build from the git repository, the make process: | ||
Line 39: | Line 43: | ||
You can override the version modification by setting LOCALVERSION (to anything) before running make. | You can override the version modification by setting LOCALVERSION (to anything) before running make. | ||
+ | |||
+ | |||
+ | == U-Boot == | ||
+ | |||
+ | The source for U-Boot is held in [https://github.com/gumstix/u-boot github]. The branch that the Yocto recipes are using is currently 2013.07 (although there is a 2013.10 branch too). You can checkout the branch with: | ||
+ | |||
+ | $ git clone --branch v2013.07 git://github.com/gumstix/u-boot.git | ||
+ | |||
+ | or some variation of same (see above). You can also pull the zip file directly in the same way as above. You can configure U-Boot for: | ||
+ | |||
+ | Overo: | ||
+ | $ make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- omap3_overo_config | ||
+ | |||
+ | Duovero: | ||
+ | $ make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- omap4_duovero_config | ||
+ | |||
+ | Then build u-boot: | ||
+ | $ make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- all | ||
+ | |||
+ | This should create MLO, u-boot.bin and u-boot.img in your u-boot directory. |
Latest revision as of 15:36, 1 April 2016
There are updated instructions for standalone compilation of u-boot and linux. Yocto users may also find this useful.
This wiki entry has some older details on building the Gumstix Linux kernel and bootloader from source.
Start by installing the toolchain.
You will also need the U-boot 'mkimage' utility. Debian and Ubuntu users can install it from their respective repositories. It's also compiled when U-boot is built if you can't get it otherwise. On top of that you will need 'git' and 'make'.
$ sudo apt-get install uboot-mkimage git make
The official kernel build instructions are the best source to describe building a kernel and are up to date. The gumstix kernels are stored on github and are in different branches for differing platforms. There is a table of branches against platforms on the gumstix.org website.
The most usual way to pull the source code is using git:
$ git clone --branch omap-3.6 git://github.com/gumstix/linux.git linux
will clone the entire source tree to your machine and checkout the omap-3.6 branch into the "linux" directory. You can also use https instead of git. There are plenty of guides online to using git but a few timesaving methods are worth mentioning:
Cloning a shallow tree
You can clone just the tip of the relevant branch using a shallow clone. This has some restrictions but saves time and bandwidth:
$ git clone --depth 1 --branch omap-3.6 https://github.com/gumstix/linux.git omap-3.6
As of November 2013, this will pull 190MB from the server instead of over a gigabyte.
You can also pull a zip file of this branch, either using the website or by finding the appropriate link (use the website!) and using curl or wget.
$ wget https://github.com/gumstix/linux/archive/omap-3.6.zip
(this will do a 301 redirect so be aware of this - you might get a very small file with html in it!)
For the 3.6 branch, this will pull approximately 123MB from the github server.
Subtleties
There is absolutely no difference in result aside from the presence of the ".git" directory, but this has a few subtle consequences. If you build with the zip file, you will get kernel and module versions stamped "3.6.0". If you build from the git repository, the make process:
- detects the git repository presence
- see that the checkout is not stamped with a tag (eg: "3.6.0").
- adds a + to all versions to show that the repository is not officially 3.6.0.
Thus you will get kernel and module version stamped with "3.6.0+". If you try and load a 3.6.0+ module into a 3.6.0 kernel, it will fail with an "invalid module format" error. You can force it with "modprobe -f" but that isn't really a recommended action generally. The normal procedure is to install the kernel and modules together (see the website for details.
You can override the version modification by setting LOCALVERSION (to anything) before running make.
U-Boot
The source for U-Boot is held in github. The branch that the Yocto recipes are using is currently 2013.07 (although there is a 2013.10 branch too). You can checkout the branch with:
$ git clone --branch v2013.07 git://github.com/gumstix/u-boot.git
or some variation of same (see above). You can also pull the zip file directly in the same way as above. You can configure U-Boot for:
Overo:
$ make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- omap3_overo_config
Duovero:
$ make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- omap4_duovero_config
Then build u-boot:
$ make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- all
This should create MLO, u-boot.bin and u-boot.img in your u-boot directory.