element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • About Us
  • 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 Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • 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
BeagleBoard
  • Products
  • Dev Tools
  • Single-Board Computers
  • BeagleBoard
  • More
  • Cancel
BeagleBoard
Blog Booting BeagleBoneBlack with the mainline uboot and linux kernel
  • Blog
  • Forum
  • Documents
  • Quiz
  • Polls
  • Files
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Join BeagleBoard to participate - click to join for free!
  • Share
  • More
  • Cancel
Group Actions
  • Group RSS
  • More
  • Cancel
Engagement
  • Author Author: aswinvenu
  • Date Created: 16 Jul 2024 9:14 AM Date Created
  • Views 1186 views
  • Likes 5 likes
  • Comments 1 comment
  • beagleboneblack
  • bbb
  • BeagleBone
  • texas_intruments
  • beagleboard
  • beagle_bone_black
  • ti
  • linux
Related
Recommended

Booting BeagleBoneBlack with the mainline uboot and linux kernel

aswinvenu
aswinvenu
16 Jul 2024

BeagleBoneBlack is one of the most loved hacking platform among kernel hackers and newbies. It's still one of the cheapest platform for learning embedded Linux. Even though the board is available in different flavors (like Beagle Board, BeagleBone AI, BeagleBone Blue, BeagleBone wireless, BeagleBone Industrial) BeagleBoneBlack still reigns.

BeagleBoneBlack is based on TI's AM335x series of OMAP processors . It embeds 1x 1GHz Cortex A8 processor with 2x 200MHz Programmable Real-time units (PRUs). The board has 512MB DDR3 RAM and 4GB onboard eMMC. ( More info: https://www.beagleboard.org/boards/beaglebone-black )

BOOT FLOW

BeagleBoneBlack(BBB) boot process starts from the internal ROM Code ( First stage bootloader). This loads MLO ( Memory loader ) and MLO loads u-boot( second stage bootloader ). U-Boot then loads the kernel and pass the device tree information.

SETTING-UP THE ENVIRONMENT

Download the latest GCC cross-compiler toolchain for arm-none-linux-gnueabihf

https://developer.arm.com/downloads/-/arm-gnu-toolchain-downloads

image

https://developer.arm.com/-/media/Files/downloads/gnu/13.2.rel1/binrel/arm-gnu-toolchain-13.2.rel1-x86_64-arm-none-linux-gnueabihf.tar.xz?rev=adb0c0238c934aeeaa12c09609c5e6fc&hash=B119DA50CEFE6EE8E0E98B4ADCA4C55F

Once downloaded and extracted the toolchain add it to the PATH variable.

export PATH=/home/aswin/beagleboneblack/toolchain/arm-gnu-toolchain-13.2.rel1-x86_64-arm-none-linux-gnueabihf/arm-gnu-toolchain-13.2.Rel1-x86_64-arm-none-linux-gnueabihf/bin:$PATH

Note: Path of the toolchain should be changed according to where you have extracted the toolchain

Create an alias with make command with the ARCH and CROSS_COMPILER

alias armmake='make ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabihf-'

PREPARING THE SD CARD

BeagleBoneBlack SD card requires two partitions

  • boot (Bootable and FAT32)
  • rootfs (EXT3)

Use fdisk utility to create two partitions

sudo fdisk /dev/sda


Note : Make sure you have un-mounted the partitions on the SD Card before proceeding.

image

Delete all the existing partitions and create a new partition

Change the type to W95 FAT32 (LBA) and enable the boot flag

image

Now create the second partition for rootfs

image

Format the partitions and add labels

sudo mkfs.vfat -a -F 16 -n boot /dev/sda1
sudo mkfs.ext4 -L rootfs /dev/sda2

image

BUILDING U-BOOT

Download the latest version of u-boot

git clone git://git.denx.de/u-boot.git

build u-boot

cd u-boot
armmake distclean
armmake am335x_evm_defconfig
armmake DEVICE_TREE=am335x-boneblack

On successful build process, Both MLO ( Memory loader ) and u-boot.bin files will get generated

.image

image

Copy both MLO and u-boot.img to the boot partition.

mount /dev/sdb1 to /mnt/boot
cp MLO /mnt/boot
cp u-boot.img /mnt/boot

BUILDING THE LINUX KERNEL

Download the latest stable version of Linux kernel from kernel.org

wget https://cdn.kernel.org/pub/linux/kernel/v6.x/linux-6.8.1.tar.xz

extract the kernel source files

tar xvf linux-6.8.1.tar.xz

Note : If you are using the latest version of Ubuntu for building the kernel, Then you are very likely to encounter compilation error due to unmatched dependencies of libgmp and libmpc so install it before you proceed with the kernel build.

sudo apt install libgmp-dev
sudo apt install libmpc-dev

Now lets build the linux kernel

cd linux-linux-6.8.1
armmake distclean
armmake omap2plus_defconfig
armmake
armmake dtbs
armmake modules_install INSTALL_MOD_PATH=/mnt/rootfs

Now copy the zImage and dtb files to the boot partition

cp arch/arm/boot/zImage /mnt/boot
cp arch/arm/boot/dts/ti/omap/am335x-boneblack.dtb /mnt/boot

Now let's create the bootscript for the u-boot.

mkdir /mnt/boot/extlinux
vim /mnt/boot/extlinux/extlinux.conf

now copy the below content inside

label Linux microSD
    kernel /zImage
    devicetree /am335x-boneblack.dtb
    append console=ttyS0,115200n8 root=/dev/mmcblk0p2 rw rootfstype=ext4 rootwait earlyprintk mem=512M

With the new distro-boot support in u-boot, it looks for extlinux.conf. In its absence a U-Boot specific script called boot.scr or boot.scr.uimg. scanned in the following order SD Card Internal flash External USB storage External server whose local ip frpm DHCP request at the address provided by the ${serverip} environment variable

BUILDING THE ROOTFS

I am using BusyBox for creating the rootfs and init process.

Download the latest version of the BusyBox

wget https://busybox.net/downloads/busybox-1.36.1.tar.bz2
tar xvf busybox-1.36.1.tar.bz2
cd busybox-1.36.1/
armmake defconfig
armmake CONFIG_PREFIX=/mnt/rootfs install

Note: Make sure that you select Build static binary (no shared libs for this build) option from the settings.

image

Now Create directories with the name etc, proc, sys, dev, etc/init.d, usr/lib

cd /mnt/rootfs
mkdir etc proc sys dev etc/init.d usr/lib
mkdir home home/root

Creating the init file

vim etc/init.d/rcS

add the following content

#!bin/sh
mount -t proc none /proc
mount -t sysfs none /sys
mount -t tmpfs none /var
mount -t tmpfs none /dev
echo "/sbin/mdev" > /proc/sys/kernel/hotplug
/sbin/mdev -s
mount -a

Change the permissions to make it executable.

chmod +x etc/init.d/rcS

Create a new file etc/fstab and add the following contents to it.

proc    /proc    proc   defaults  0 0
sysfs   /sys     sysfs  defaults  0 0

BOOTING

image

Now we have successfully booted BeagleBoneBlack with the mainline u-boot and the linux kernel.

Thank you!

  • Sign in to reply
  • DAB
    DAB over 1 year ago

    Nice overview of the process.

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