TipsAndTricks/LinuxKernelAndSDKs
From Yocto Project
Jump to navigationJump to search
This is the start of what I hope becomes a longer article. This early stage is to answer a particular question.
Kernel Building w/o Bitbake
Suppose you'd like to build a kernel but you don't care about having it packed into a wic image. Maybe you are loading the kernel on the command line in qemu, or maybe you are netbooting it. But, you'd like to use the Yocto toolchains to insure that it will work with an eventual Yocto image... How do you do that?
- make the sdk or download it.
- if you are targeting a release, you can download the sdk from http://downloads.yoctoproject.org/
- For example for YP 2.2.1 you could use http://downloads.yoctoproject.org/releases/yocto/yocto-2.2.1/toolchain/x86_64/poky-glibc-x86_64-core-image-sato-core2-64-toolchain-2.2.1.sh
- if you need to build it do
$ bitbake core-image-minimal && bitbake core-image-minimal -c populate_sdk
- you would only need to do this ONCE
- the result will be in tmp/deploy/sdk/ and will be named something like poky-glibc-x86_64-core-image-minimal-core2-64-toolchain-2.2+snapshot.sh
- This assumes you have set your MACHINE to whatever your target is (for example MACHINE=qemux86-64, in your conf/local.conf) to get the correct cross toolchains.
- if you are targeting a release, you can download the sdk from http://downloads.yoctoproject.org/
- install the sdk
$. poky-glibc-x86_64-core-image-sato-core2-64-toolchain-2.2.1.sh
for example. Or, you could use the one you built.- Since we are focused on the kernel, the image that the toolchain was built for isn't important, we want to use the cross toolchains.
- from here on, we'll assume you installed it into /opt/poky/2.2
- source the environment for the sdk from a fresh shell (i.e. not from the shell that has all the bitbake variables set in it).
$. /opt/poky/2.2/environment-setup-x86_64-poky-linux
- then just do
$ make bzImage
in your kernel directory. The kernel Makefile respects the env variables that were set in the environment script your sourced.
But, I want the config that linux-yocto would use...
- If you want to start with the config that linux-yocto would use, do
$ bitbake -c kernel_configme linux-yocto
- The resulting .config file will be somewhere like tmp/work/qemux86_64-poky-linux/linux-yocto/...
- honestly, it's easier to do
$ find . -name .config| grep linux-yocto
- then just cp that .config file to your kernel tree and make like above. You should probably to a
make oldconfig
if you aren't using the linux-yocto kernel source itself.
Kernel Modules
- Addressed Later