element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • Members
    Members
    • Benefits of Membership
    • Achievement Levels
    • Members Area
    • Personal Blogs
    • Feedback and Support
    • What's New on element14
  • Learn
    Learn
    • Learning Center
    • eBooks
    • 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
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Dev Tools
    • Manufacturers
    • Raspberry Pi
    • RoadTests & Reviews
    • Avnet Boards Community
    • Product Groups
  • 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
RIoTboard
  • Products
  • Dev Tools
  • Single-Board Computers
  • RIoTboard
  • More
  • Cancel
RIoTboard
Blog Linux on the RIoTBoard Part 2: Kernel
  • Blog
  • Forum
  • Documents
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
RIoTboard requires membership for participation - click to join
Blog Post Actions
  • Subscribe by email
  • More
  • Cancel
  • Share
  • Subscribe by email
  • More
  • Cancel
Group Actions
  • Group RSS
  • More
  • Cancel
Engagement
  • Author Author: radiatortwo
  • Date Created: 18 Sep 2014 5:21 PM Date Created
  • Views 925 views
  • Likes 1 like
  • Comments 9 comments
Related
Recommended

Linux on the RIoTBoard Part 2: Kernel

radiatortwo
radiatortwo
18 Sep 2014

This series of blog posts contains the following parts:

1. The bootloader U-Boot

2. The Kernel (This part)

3. Debian Root File System

4. Flashing with MFGTool in Windows

5.Creating an SDCard Image

 

Part 2: Kernel

 

In this part we will be creating the kernel, the device tree as well as the modules and kernel headers from the mainline source code.

 

The build environment will be the same as the one for building u-boot.

So if you didn´t already do that, then you should do "Step 1. Essentials and Compiler" from Part 1.

 

1. Get the source code

 

If you´re not already in the right folder, cd into the folder you will be saving the code.

You should already have one i f you followed Part 1 of this series.

In my case:

 

cd /home/riotboard/linux
          

 

And now we´ll get the code from Linus Torvalds original Linux repository.

 

git clone git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
cd linux

 

 

2. Compile the Kernel

 

Before compiling make sure the environment variables are set correctly. (As described in Part 1)

Also make sure the OUTPUT variable is set to the correct folder.

 

export ARCH=arm
export CROSS_COMPILE=arm-linux-gnueabihf-
export OUTPUT=/home/riotboard/linux/output
          

 

First write the config to compile the kernel for our RIoTBoard.

(We now can use the config that´s integrated into the mainline code.)

 

make imx_v6_v7_defconfig
          

 

If you need to change the config. Like activating support for specific drivers or similar, you can execute menuconfig to edit the config file with a dialog.

(This is optional)

 

make menuconfig
          

 

Now we can compile the Kernel

(Adjust the parameter j to the number of threads it should use. Most likely one for each CPU.)

 

make -j4 bzImage
          

 

Now in the folder arch/arm/boot we have the Kernel file zImage

 

Copy that file into our Output boot folder.

 

mkdir $OUTPUT/boot
cp arch/arm/boot/zImage $OUTPUT/boot/zImage
          

 

3. Device Tree Blob

 

Next we need the Device Tree Blob file.

With the following command all DTB files will be created. But we copy only the one we need.

 

make dtbs
cp arch/arm/boot/dts/imx6dl-riotboard.dtb $OUTPUT/boot/imx6dl-riotboard.dtb
          

 

4. Modules and Headers

 

Now we need to create the modules.

And then copy them into our output folder.

 

make modules -j4
make modules_install INSTALL_MOD_PATH=$OUTPUT
          

 

Now the same thing for the Kernel headers.

This is optional, but sometimes you´ll need them to compile additional drivers on the board for example.

So let´s integrate them too. They belong into the usr folder.

 

make headers_install INSTALL_HDR_PATH=$OUTPUT/usr
          

 

Last thing to do now is just to pack everything into a tarball and remove the unneeded folders.

 

cd $OUTPUT
tar cvzf linux-kernel.tgz boot lib usr
rm -rf boot lib usr

 

That´s it for this part.

 

In the next part we will be creating a debian root file system from scratch.

 

Continue with Step 3

  • Sign in to reply
  • tusharp
    tusharp over 6 years ago in reply to Former Member

    try this:

    Linux 4.1 + Ubuntu 14.04 on RIoTboard

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • Former Member
    Former Member over 6 years ago

    I wish this could get updated.  I have spent days here trying to recompile a bootable kernel using newer gcc's, and embdebian doesn't exist anymore, things don't just work like when all the info was current.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • radiatortwo
    radiatortwo over 7 years ago in reply to toonamo

    You can't generalize what dependencies to install.

    Depend's on your build system.

     

    Only thing you always have to install are the build-essentials which will install most stuff you'll need.

     

    But If then something is missing the Compiler will tell you what it is.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • toonamo
    toonamo over 7 years ago

    in case your make fails try installing lzop

    apt-get install lzop

    can anyone recommend any other dependencies?

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • schneebutzli
    schneebutzli over 7 years ago in reply to radiatortwo

    Ok thanks you

     

    I thought I should find this file somewhere in the internet and forgot to look in the folder ....

    The only thing I have to do is make imx_v6_v7_defconfig instead of make riot_deconfig

     

    Thanks you very much

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • 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 © 2023 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

  • Facebook
  • Twitter
  • linkedin
  • YouTube