Rhomb.io buildroot process

Introduction

Buildroot is a tool that simplifies and automates the process of building a complete Linux system for an embedded system, using cross-compilation. In this article I will explain how to use buildroot to generate and compile u-boot, Linux 4.8 kernel and minimal filesystem for Rhomb.io. These steps are successfully tested on the Gaia board.

System requirements

Your system, need to accomplish the requirements needed for buildroot. Please, check this link:

https://buildroot.uclibc.org/downloads/manual/manual.html#requirement

Procedure to build

How to build everything

Login to linux and open terminal. Clone the Build-Root repository to your local machine

git clone https://github.com/Rhomb-io/buildroot-rhomb.git

Change working directory to Build-Root repository directory

cd buildroot-rhomb/

Run below command

sudo ./build.sh all

Note: This command will take little long for the first time run as it downloads all the packages and then compile. It will generated zImage (dtb appended ) and rootfs.tar in "<buidroot_rhomb>/output/images/".

How to rebuild kernel

If you make some changes on the kernel sourcecode, you can rebuild the kernel instead of doing the entire process.

You can use this command, instead of sudo ./build.sh all.

sudo ./build.sh linux

Note: This command rebuild linux kernel with latest changes and install kernel image (zImage with dtb appended) in "<buidroot_rhomb>/output/images/".

How to rebuild u-boot

To rebuild u-boot

sudo ./build.sh uboot

Note: This command rebuild uboot with latest changes and install uboot image in "<buidroot_rhomb>/output/images/".

How to rebuild root filesystem

To rebuild rootfs

sudo ./build.sh rootfs

Note: This command rebuild rootfs with latest changes in "<buidroot_rhomb>/output/images/".

Procedure to flash

How to flash SD

Insert a SD card to you computer.

Check the name that Linux puts to the SD card. You can use the next command before, and after SD insertion to compare the output and know what is the name of SD card.

lsblk

Buildrootpartiton.png

After you know the correct device name for SD card, run this command

sudo ./prepare_sd.sh sdb

Note: If necessary, change the name of "sdb" by the name that linux grants to your SD card (see lsblk output at previous step).

The process starts to copy all the needed files to SD card. When the process finishes, you can see this text:

SD card prepared
Insert sd card into board
Set below bootargs in board and bootloader prompt and then boot
setenv bootargs 'console=tty1 console=ttySAC1,115200 mem=1023M root=/dev/mmcblk0p1 rootwait rw'
Good luck!

How to flash emmc

First of all, you need to follow the previous steps at "Procedure to build and flash SD card".

Insert the generated SD card in the board card reader.

Insert an emmc Rhomb.io module at the board module socket.

Set the DIP Switch in Gaia to boot from SD Card.

Sddipok.jpg

Connect the Gaia board to PC via the Quad USB to UART board.

2016-09-28 09 48 47-Primeros pasos con Rhomb Rev 0.35 - Word.png

Open Putty, select serial connection and set the proper COM port and 115200 baudrate. Press open.

Note: To know the name of the proper COM port see the Windows device manager (at COM ports section) after and before of connecting the Quad USB-UART board.

Puttyconnect.jpg

Once the boot process finishes, you can see this text:

Welcome to Buildroot
buildroot login:

Write the word "root" and hit enter key. After that, issue this commands:

cd /opt/
tar -xf images.tar
cd images
./emmc_fusing.sh mmcblk1

This script will ask user if "/dev/mmcblk1p1" already formatted with ext4 filesystem as below

/dev/mmcblk1p1 contains a ext4 file system
last mounted on / on Thu Jan  1 00:00:02 1970
Proceed anyway? (y,N)
       

Enter 'y' if it asked first time. For next time onwards user can enter 'N'. The process will start. When the process finishes OK, you can see this message:

eMMC flashed
Power off the board
Set emmc boot mode boot board
Good luck!

Now, turn off the board. Remove the SD card if you like. Set the DIP Switch to EMMC bootmode, and boot the board. Now the board is booting from the EMMC.

Now, you can operate your system using the buildroot command line.

Procedure to boot

Boot from SD

Now, you have an SD card with u-boot, minimal filesystem, rhomb.io kernel based on 4.8 Linux kernel.

Insert the SD card in the PCB card reader.

Set the DIP Switch in Gaia to boot from SD Card.

Sddipok.jpg

Connect the board to PC via the Quad USB to UART board.

2016-09-28 09 48 47-Primeros pasos con Rhomb Rev 0.35 - Word.png

Open Putty, select serial connection and set the proper COM port and 115200 baudrate. Press open.

Note: To know the name of the proper COM port see the Windows device manager (at COM ports section) after and before of connecting the Quad USB-UART board.

See image

Apply 5V-2A power supply to Gaia and press the power on button for any seconds. Wait for the boot process finishes.

Now, you can operate your system using the buildroot command line.

Boot from eMMC

Now, you have an SD card or an EMMC Rhomb.io module with u-boot, minimal filesystem, rhomb.io kernel based on 4.8 Linux kernel.

Insert an EMMC Rhomb.io module in the module socket of the PCB.

Set the DIP Switch in Gaia to boot from EMMC.

Emmc boot dip.png

Connect the board to PC via the Quad USB to UART board.

2016-09-28 09 48 47-Primeros pasos con Rhomb Rev 0.35 - Word.png

Open Putty, select serial connection and set the proper COM port and 115200 baudrate. Press open.

Note: To know the name of the proper COM port see the Windows device manager (at COM ports section) after and before of connecting the Quad USB-UART board.

Puttyconnect.jpg

Apply 5V-2A power supply to Gaia and press the power on button for any seconds. Wait for the boot process finishes.

Now, you can operate your system using the buildroot command line.