User Tools

Site Tools


ubuntu

Getting started with Quimbuntu : Ubuntu on the Quimbrain

This tool is an easy tool to create an image of Ubuntu for the Quimbrain. The purpose is to automate the process of the build of the image. You can find it in the Quimesis git repository: quimbox-tools/quimbuntu

The tools used are :

  • Bootloader: u-boot maintained by Solidrun
  • Kernel : Linux kernel maintained by Solidrun
  • Root filesystem : Ubuntu 16.04 obtained by the Deboostrap Debootstrap tool
  • genimage: tool to create an image

Summarize of the tool

The system will be composed by :

  • Part 1 : SPL, it serves to set-up the boot process
  • Part 2 : u-boot.img, bootloader image
  • Part 3 : rootfs, root filesystem
    • /boot
      • uEnv.txt, text file to modify environment variables of the bootloader
      • imx6dl-hummingboard.dtb, device tree blob
      • zImage, Linux kernel image
    • /lib
      • /modules, kernel modules
      • /firmware, firmware drivers

Directory Hierarchy

/board                      Board specific files
  /quimbrain                Configuration files specific to the Quimbrain 
/src                        Scripts to build the image

Downloaded directories :

/linux-fslc                 Linux kernel 
/u-boot-imx6                Bootloader
/genimage                   Image builder

Created directory :

/rootfs                     Root filesystem created

How to build a image

Prerequisites

The dependencies for the tool can be download thanks to the package manager apt :

sudo apt-get install gcc-arm-linux-gnueabihf-gcc bc lzop qemu-user-static debootstrap dh-autoreconf

Build

In a wonderful world, you can create your image with a simple command after downloading the dependencies :

make

Makefile target

If you want to build/compile a specific part of the process, you can use the different targets of the Makefile

all              Build an image from scratch
kernel           Compile the kernel with the Quimbrain configuration
uboot            Compile the bootloader u-boot with the Quimbrain configuration 
rootfs           Create the root filesystem
compress         Compress the root filesystem in a tar.gz
genimage         Generate the image from the uboot.img, SPL and the root filesystem tar.gz
distclean        Clean every files created during the build of the image but keep the downloaded directories
clean            Clean every files created during the build of the image and the downloaded directories

The target “all” execute the different targets as follow :

  1. uboot
  2. kernel
  3. rootfs
  4. compress
  5. genimage

/!\ Please follow the same order, if the target “all” launch an error or you built a specific part and you want to recreate the image without executing the full process.

/!\ A known problem is that the system stops after the rootfs target, continue with the compress genimage target.

Installing Ubuntu on the SD card

Use a program to write the image on the SD card or the command :

dd bs=4M if=quimbrain.img of=/dev/sdX conv=fsync

How to custom/configure the image

This part will explain how to configure the different bloc of the build process.

U-boot

The configuration to build the bootloader is the default configuration mx6_cubox-i_config. If you want to modify the environment variable of the bootloader, you can modify the file uEnv.txt to add new entries.

To recompile by hand, you can execute :

cd u-boot-imx6
export ARCH=arm
export CROSS_COMPILE=/usr/bin/arm-linux-gnueabi-
make mx6_cubox-i_config
make

A successful build will create two files in the source tree directory, SPL and u-boot.img

  • SPL file is the actual machine detection and initialization and must be flashed on offset 1KByte of the boot micro SD.
  • u-boot.img is the second stage bootloader; it can be flashed at offset 42KByte from the starting of the boot micro SD; or alternatively can be put as-is on the first partition of the micro SD.

Kernel

In this part, we build the zImage (the kernel image), the modules and the firmware drivers and the device tree blob imx6dl-quimbrain.dtb

Modification of the kernel

The kernel configuration is a modified version of the configuration imx_v7_cbi_hb_defconfig from Solidrun. If you want to modify the kernel, you must modify the configuration file /board/quimbrain/quimbrain_defconfig. A good way to modify the configuration is to modify the file from the kernel directory linux-fscl with the make menuconfig command and to copy the new version in the directory board/quimbrain

Configure the cross-compilation :

export ARCH=arm
export CROSS_COMPILE=/usr/bin/arm-linux-gnueabihf-

Modification :

cd linux-fslc
make quimbrain_defconfig:
make menuconfig

Save the new configuration :

make savedefconfig
cp defconfig ../board/quimbrain/quimbrain_defconfig

Compile by hand zImage and modules :

make zImage 
make modules
mkdir -p rootfs
make modules_install INSTALL_MOD_PATH=rootfs

Modification of the device tree

You can modify the device tree and compile it from the kernel directory. However, don't forget to copy the files to the /board/quimbrain directory.

Save the modification from the linux-fslc directory : cp /arch/arm/boot/dts/imx6dl-quimbrain.dts /arch/arm/boot/dts/imx6qdl-quimbrain.dtsi ../board/quimbrain Compilation

make imx6dl-quimbrain.dtb 

/!\ Don't forget to save every file that you change in the directory /board/quimesis because every file will be overwritten by the files in this directory

Root filesystem

The root filesystem is created thanks to the tool Deboostrap. This tool downloads a simple root filesystem. To modify this system, you must create an isolated environment with chroot.

Chroot?

A chroot on Unix operating systems is an operation which changes the root directory. It affects only the current process and its children. The term “chroot” itself can refer either to the chroot(2) system call or the chroot(8) wrapper program.

A program that is re-rooted to another directory cannot access files outside that directory. This provides a convenient way to sandbox an untrusted, untested or otherwise dangerous program. It is also a simple kind of “jail” mechanism.

After that, we can modify this system without problem with our system. To customize the system, the script custom_system.sh is executed in the isolated environment.

Currently, this script does :

* Add the repository Ubuntu to the sources of package manager

* Modify the root user :

 login : root
 password : admin

* Add a new user and add it to groups:

 login : quimesis
 password : password
 groups : audio,sudo

* Update the system and install the wanted packages

* Configure the firmware for the Bluetooth and the wifi

Tests performed

To check the system, some simple tests carried out :

  • Ethernet : plug ethernet cable and test the connexion
  • Wifi : connexion to a wifi and create access point too
  • SimCom module : Power on/off the module and use the GPS. Notice that the /dev/ttyUSB4 was not detected
  • Bus can : communication with the two CAN bus via external board and USB-to-CAN adapter
  • USB port : plug in the 4 ports
  • LED : control via gpio
  • IMU : test with the RTIMULib library
  • Bluetooth : detection by one other device and connexion with it
  • HDMI output : plug HDMI and use it as output sound
  • Jack in/ou : The input was no tested but the output works fine when you send sound to it
  • Sensor temperature/battery : visible on the bus I2C but must be tested to extract the information
  • Multi-Purpose GPIO : control with gpio and check with voltmeter
  • Power to ext. : power on and check if the 24V are present.
  • UART : connexion between computer and Quimbrain

Comments

  • Different problems are present and they are discussed in the README
  • To use the IMU if you use the RTIMULib library, don't forget that you must you a patched version of the library specific for the Quimbrain

Interesting links

ubuntu.txt · Last modified: 2018/05/22 10:33 by 127.0.0.1