TipsAndTricks/LinuxKernelAndSDKs: Difference between revisions

From Yocto Project
Jump to navigationJump to search
(Created page with "<strong> This is the start of what I hope becomes a longer article. This early stage is to answer a particular question. </strong> == Kernel Building w/o Bitbake == Suppose y...")
 
No edit summary
Line 9: Line 9:
** if you need to build it do  
** if you need to build it do  
*** <code>$ bitbake core-image-minimal && bitbake core-image-minimal -c populate_sdk </code>
*** <code>$ bitbake core-image-minimal && bitbake core-image-minimal -c populate_sdk </code>
*** you would only need to do this <strong>ONCE</strong>
**** you would only need to do this <strong>ONCE</strong>
**** 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
**** 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.
* install the sdk <code>$. poky-glibc-x86_64-core-image-sato-core2-64-toolchain-2.2.1.sh </code> for example. Or, you could use the one you built.  
* install the sdk <code>$. poky-glibc-x86_64-core-image-sato-core2-64-toolchain-2.2.1.sh </code> 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.
** 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.

Revision as of 23:41, 9 March 2017

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.
  • 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.