element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet & Tria Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • About Us
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
Single-Board Computers
  • Products
  • Dev Tools
  • Single-Board Computers
  • More
  • Cancel
Single-Board Computers
Forum BBB - Building the Linux Kernel
  • Blog
  • Forum
  • Documents
  • Files
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Join Single-Board Computers to participate - click to join for free!
Actions
  • Share
  • More
  • Cancel
Forum Thread Details
  • Replies 29 replies
  • Subscribers 59 subscribers
  • Views 4209 views
  • Users 0 members are here
  • beaglebone_black
  • bbb
  • bb_black
  • beagle_bone_black
Related

BBB - Building the Linux Kernel

shabaz
shabaz over 12 years ago

Hi, I've added a step-by-step guide to building the Linux kernel for the BBB at the elinux wiki, so we can all edit it to improve the process. Particular thanks to Vlad Ungureanu for helping with debugging.

 

It took a while to get the steps ironed out. I still need to figure out how how to build the rest of the file system (there is a file system supplied

with TI's SDK) and getting it NFS-mounted.

 

These are the current steps documented (hopefully these links work):

 

  • 1 Beaglebone Black – Building Images
    • 1.1 Introduction
      • 1.1.1 Is it difficult?
      • 1.1.2 What is required?
      • 1.1.3 What steps are involved?
    • 1.2 Getting started - Folders
    • 1.3 Installing the build tools (toolchain)
      • 1.3.1 3. 1 Compile tools
      • 1.3.2 3.2 Some miscellaneous items
      • 1.3.3 3.3 U-boot
    • 1.4 Downloading and building the Linux Kernel
    • 1.5 Transferring the image to the BBB via TFTP
    • 1.6 Appendix: Installing and configuring the TFTP server
    • 1.7 Appendix: Installing and using Minicom
  • Sign in to reply
  • Cancel

Top Replies

  • bwelsby
    bwelsby over 12 years ago in reply to shabaz +1
    If you want a RHL/Centos style distro then you could try installing this root file system to go with your kernel from http://www.redsleeve.org/ no idea if it will work (in theory it should) but I will…
  • bwelsby
    bwelsby over 12 years ago in reply to shabaz +1
    Me too, when I was in gainfull employment I used nothing but Centos and RHEL. I only got into Debian and Ubuntu because of the R-Pi. It looks like a package repository is being built mainly for R-Pi but…
  • Former Member
    Former Member over 12 years ago in reply to shabaz +1
    shabaz wrote: ~/kernel/kernel$ make ARCH=arm CROSS_COMPILE=arm-angstrom-linux-gnueabi- INSTALL_MOD_PATH=$HOME/kernel/kernel/rootfs modules_install I'm not sure what it does, I'll try it. Does it create…
  • bwelsby
    bwelsby over 12 years ago in reply to shabaz

    I was working with Arch linux earlier and had the exact same errors, it turned out I was running kernel 3.8.13-3-ARCH and when I looked in /usr/lib/modules I saw a subdirectory 3.8.13-1-ARCH  I forced an update of kernel and modules and the subdirectory was replaced to match the kernel...  and all the errors went away. image

     

    You need a step in your instructions for installing the modules.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • shabaz
    shabaz over 12 years ago in reply to bwelsby

    Hi Brian,

     

    I see on this site this instruction, which I seem to be missing:

    ~/kernel/kernel$ make ARCH=arm CROSS_COMPILE=arm-angstrom-linux-gnueabi- INSTALL_MOD_PATH=$HOME/kernel/kernel/rootfs modules_install

    I'm not sure what it does, I'll try it. Does it create a file system containing the modules that I will need to tftp do you think?

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • bwelsby
    bwelsby over 12 years ago in reply to shabaz

    If you want a RHL/Centos style distro then you could try installing this root file system to go with your kernel from  http://www.redsleeve.org/ no idea if it will work (in theory it should) but I will give it a try when I get chance.

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • Cancel
  • shabaz
    shabaz over 12 years ago in reply to bwelsby

    That's great!! I'm looking forward to trying it.

    I would be extremely happy with this on the BBB!!

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • Former Member
    Former Member over 12 years ago in reply to bwelsby

    Brian Welsby wrote:

     

    I take it these systemd[1]  boot errors are because the correct kernel modules have not been installed in /usr/lib/modules/

    Hmm..  effectively they're due to systemd trying to do all sorts of unnecessary "I'm-a-resource-hungry-desktop-app" nonesense. A huge chunk of what systemd does could easily be considered a simple waste of precious resources on a small embedded system.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • bwelsby
    bwelsby over 12 years ago in reply to shabaz

    Me too, when I was in gainfull employment I used nothing but Centos and RHEL. I only got into Debian and Ubuntu because of the R-Pi.

    It looks like a package repository is being built mainly for R-Pi but at least with RH/Centos the package source RPMs are easily available.

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • Cancel
  • Former Member
    Former Member over 12 years ago in reply to shabaz

    shabaz wrote:

     

    ~/kernel/kernel$ make ARCH=arm CROSS_COMPILE=arm-angstrom-linux-gnueabi- INSTALL_MOD_PATH=$HOME/kernel/kernel/rootfs modules_install

    I'm not sure what it does, I'll try it. Does it create a file system containing the modules that I will need to tftp do you think?

    building and installing (or packaging) a kernel needs you to do a set of things:

     

    1. make menuconfig (or make oldconfig if you have an appropriate .config already)
    2. make  (compile everything)
    3. make install (install just the kernel, but be careful with this as it may not do what you expect)
    4. make modules_install (install the modules)
    5. make headers_install (install the development headers into /usr/include/linux)

     

    and possibly clone git://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git or parts of it into /lib/firmware

     

    The obvious problems start when you find out that by default, modules get installed into /lib/modules/<KERNELVER> on the build system. Largely this isn't what you want, especially if you're cross compiling (or packaging the result for a system that's not the build system).

     

    There are other complications if you use the available features to seperate the source directory from the build directory so that you can use the same source for many different targets.

     

    INSTALL_MOD_PATH lets you specify a prefix for the install location which means you can set it to something like /tmp/kernel-3.8.13 and your files end up under that directory instead of trampling all over the build system.

    You can also do:

    make headers_install INSTALL_HDR_PATH=/tmp/kernel-3.8.13/usr

    in order to get the headers without trashing your build system.

     

    What I do is to install all of the eventual kernel files into a temp directory, then create a tarball of that. This lets me compile once, and deploy that tarball to many different systems.

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • Cancel
  • bwelsby
    bwelsby over 12 years ago in reply to Former Member

    selsinork wrote:

     

    Brian Welsby wrote:

     

    I take it these systemd[1]  boot errors are because the correct kernel modules have not been installed in /usr/lib/modules/

    Hmm..  effectively they're due to systemd trying to do all sorts of unnecessary "I'm-a-resource-hungry-desktop-app" nonesense. A huge chunk of what systemd does could easily be considered a simple waste of precious resources on a small embedded system.

    Yes one of the first things I did with Angstrom was use systemctl to disable/remove unnecessary stuff,  just like MS Windoze really .. (sorry for swearing).

    I too hate systemd.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • bwelsby
    bwelsby over 12 years ago in reply to Former Member

    selsinork wrote:

    directory instead of trampling all over the build system.

    You can also do:

    make headers_install INSTALL_HDR_PATH=/tmp/kernel-3.8.13/usr
    in order to get the headers without trashing your build system.

     

     

    I always make sure I am not logged in as root or with root privs when cross compiling kernels, I made that mistake once.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • Former Member
    Former Member over 12 years ago in reply to bwelsby

    Brian Welsby wrote:

     

    I always make sure I am not logged in as root or with root privs when cross compiling kernels, I made that mistake once.

    building kernels isn't really that hard, unfortunately there's many traps and assumptions in the process that can catch out the unwary..

     

    like you'll always be building for the running system, and that /lib/modules/'uname -r'/build is a sensible place to be looking for anything.

     

    I almost always do build as root, partially for historic reasons, partially because that's how my build machines are setup. I do have a set of build scripts that have been carefully crafted to deal with the pitfalls though and I currently build about 15 target variations from a single source tree using the O= feature to create seperate build directories. So it's important to get it right or else I'd end up in all sorts of trouble very quickly.

     

    The Kbuild system has lots of useful options to make your life easier, sadly they're not well understood as evidenced by the uname -r hackery that seems all to common.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
<>
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2025 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube