Embedded Linux Training. Lab Book. Free Electrons

Size: px
Start display at page:

Download "Embedded Linux Training. Lab Book. Free Electrons"

Transcription

1 Lab Book Free Electrons December 25, 2017

2 About this document Updates to this document can be found on This document was generated from LaTeX sources found on training-materials. More details about our training sessions can be found on Copying this document , Free Electrons, This document is released under the terms of the Creative Commons CC BY-SA 3.0 license. This means that you are free to download, distribute and even modify it, under certain conditions. Corrections, suggestions, contributions and translations are welcome! Free Electrons, CC BY-SA license

3 Training setup Download files and directories used in practical labs Install lab data For the different labs in this course, your instructor has prepared a set of data (kernel images, kernel configurations, root filesystems and more). Download and extract its tarball from a terminal: cd wget tar xvf embedded-linux-labs.tar.xz Lab data are now available in an embedded-linux-labs directory in your home directory. For each lab there is a directory containing various data. This directory will also be used as working space for each lab, so that the files that you produce during each lab are kept separate. You are now ready to start the real practical labs! Install extra packages Feel free to install other packages you may need for your development environment. In particular, we recommend to install your favorite text editor and configure it to your taste. The favorite text editors of embedded Linux developers are of course Vim and Emacs, but there are also plenty of other possibilities, such as GEdit, Qt Creator, CodeBlocks, Geany, etc. It is worth mentioning that by default, Ubuntu comes with a very limited version of the vi editor. So if you would like to use vi, we recommend to use the more featureful version by installing the vim package. More guidelines Can be useful throughout any of the labs Read instructions and tips carefully. Lots of people make mistakes or waste time because they missed an explanation or a guideline. Always read error messages carefully, in particular the first one which is issued. Some people stumble on very simple errors just because they specified a wrong file path and didn t pay enough attention to the corresponding error message. Never stay stuck with a strange problem more than 5 minutes. Show your problem to your colleagues or to the instructor. You should only use the root user for operations that require super-user privileges, such as: mounting a file system, loading a kernel module, changing file ownership, configuring the network. Most regular tasks (such as downloading, extracting sources, compiling...) can be done as a regular user Free Electrons, CC BY-SA license 3

4 If you ran commands from a root shell by mistake, your regular user may no longer be able to handle the corresponding generated files. In this case, use the chown -R command to give the new files back to your regular user. Example: chown -R myuser.myuser linux/ If you are using Gnome Terminal (the default terminal emulator in Ubuntu 16.04), you can use tabs to have multiple terminals in the same window. There s no more menu option to create a new tab, but you can get one by pressing the [Ctrl] [Shift] [t] keys Free Electrons, CC BY-SA license

5 Building a cross-compiling toolchain Objective: Learn how to compile your own cross-compiling toolchain for the uclibc C library After this lab, you will be able to: Configure the crosstool-ng tool Execute crosstool-ng and build up your own cross-compiling toolchain Setup Go to the $HOME/embedded-linux-labs/toolchain directory. Install needed packages Install the packages needed for this lab: sudo apt-get install autoconf automake libtool-bin libexpat1-dev \ libncurses5-dev bison flex patch curl cvs texinfo git bc \ build-essential subversion gawk python-dev gperf unzip \ pkg-config help2man wget Tip: instead of typing all the above package names, fetch the electronic version of these instructions and copy/paste the long command line! Getting Crosstool-ng Let s download the sources of Crosstool-ng, through its git source repository, and switch to a version that we have tested: git clone cd crosstool-ng/ git checkout crosstool-ng Installing Crosstool-ng We can either install Crosstool-ng globally on the system, or keep it locally in its download directory. We ll choose the latter solution. As documented in docs/2 - Installing crosstool- NG.txt, do: autoreconf./configure --enable-local make make install Then you can get Crosstool-ng help by running./ct-ng help Free Electrons, CC BY-SA license 5

6 Configure the toolchain to produce A single installation of Crosstool-ng allows to produce as many toolchains as you want, for different architectures, with different C libraries and different versions of the various components. Crosstool-ng comes with a set of ready-made configuration files for various typical setups: Crosstool-ng calls them samples. They can be listed by using./ct-ng list-samples. We will use the arm-cortexa5-linux-uclibcgnueabihf sample. It can be loaded by issuing:./ct-ng arm-cortexa5-linux-uclibcgnueabihf Then, to refine the configuration, let s run the menuconfig interface:./ct-ng menuconfig In Path and misc options: Change Maximum log level to see to DEBUG so that we can have more details on what happened during the build in case something went wrong. In Toolchain options: Set Tuple's alias to arm-linux. This way, we will be able to use the compiler as armlinux-gcc instead of arm-cortexa5-linux-uclibcgnueabihf-gcc, which is much longer to type. In C-library: Enable IPv6 support. That s because of Buildroot (which we will use later, which doesn t accept to use toolchains without IPv6 support. In Debug facilities: Remove all options. Some of these options will be useful in a real toolchain, but in our labs, we will do debugging work with another toolchain anyway. Hence, not compiling debugging features here will reduce toolchain building time. Explore the different other available options by traveling through the menus and looking at the help for some of the options. Don t hesitate to ask your trainer for details on the available options. However, remember that we tested the labs with the configuration described above. You might waste time with unexpected issues if you customize the toolchain configuration. Produce the toolchain Nothing is simpler:./ct-ng build The toolchain will be installed by default in $HOME/x-tools/. That s something you could have changed in Crosstool-ng s configuration. And wait! Free Electrons, CC BY-SA license

7 Known issues Source archives not found on the Internet It is frequent that Crosstool-ng aborts because it can t find a source archive on the Internet, when such an archive has moved or has been replaced by more recent versions. New Crosstool-ng versions ship with updated URLs, but in the meantime, you need work-arounds. If this happens to you, what you can do is look for the source archive by yourself on the Internet, and copy such an archive to the src directory in your home directory. Note that even source archives compressed in a different way (for example, ending with.gz instead of.bz2) will be fine too. Then, all you have to do is run./ct-ng build again, and it will use the source archive that you downloaded. Testing the toolchain You can now test your toolchain by adding $HOME/x-tools/arm-cortexa5-linux-uclibcgnueabihf/ bin/ to your PATH environment variable and compiling the simple hello.c program in your main lab directory with arm-linux-gcc. You can use the file command on your binary to make sure it has correctly been compiled for the ARM architecture. Cleaning up Do this only if you have limited storage space. In case you made a mistake in the toolchain configuration, you may need to run Crosstool-ng again. Keeping generated files would save a significant amount of time. To save about 7 GB of storage space, do a./ct-ng clean in the Crosstool-NG source directory. This will remove the source code of the different toolchain components, as well as all the generated files that are now useless since the toolchain has been installed in $HOME/x-tools Free Electrons, CC BY-SA license 7

8 Bootloader - U-Boot Objectives: Set up serial communication, compile and install the U-Boot bootloader, use basic U-Boot commands, set up TFTP communication with the development workstation. As the bootloader is the first piece of software executed by a hardware platform, the installation procedure of the bootloader is very specific to the hardware platform. There are usually two cases: The processor offers nothing to ease the installation of the bootloader, in which case the JTAG has to be used to initialize flash storage and write the bootloader code to flash. Detailed knowledge of the hardware is of course required to perform these operations. The processor offers a monitor, implemented in ROM, and through which access to the memories is made easier. The Xplained board, which uses the SAMA5D3 SoCs, falls into the second category. The monitor integrated in the ROM reads the MMC/SD card to search for a valid bootloader before looking at the internal NAND flash for a bootloader. In case nothing is available, it will operate in a fallback mode, that will allow to use an external tool to reflash some bootloader through USB. Therefore, either by using an MMC/SD card or that fallback mode, we can start up a SAMA5D3-based board without having anything installed on it. Downloading Atmel s flashing tool Go to the ~/embedded-linux-labs/bootloader directory. We re going to use that fallback mode, and its associated tool, sam-ba. We first need to download this tool, from Atmel s website 1. wget unzip sam-ba_2.15.zip Setting up serial communication with the board Plug the USB-to-serial cable on the Xplained board. The blue end of the cable is going to GND on J23, red on RXD and green on TXD. When plugged in your computer, a serial port should appear, /dev/ttyusb0. 1 In case this website is down, you can also find this tool on Free Electrons, CC BY-SA license

9 You can also see this device appear by looking at the output of dmesg. To communicate with the board through the serial port, install a serial communication program, such as picocom: sudo apt-get install picocom You also need to make your user belong to the dialout group to be allowed to write to the serial console: sudo adduser $USER dialout You need to log out and in again for the group change to be effective. Run picocom -b /dev/ttyusb0, to start serial communication on /dev/ttyusb0, with a baudrate of You can now power-up the board by connecting the micro-usb cable to the board, and to your PC at the other end. If a system was previously installed on the board, you should be able to interact with it through the serial line. If you wish to exit picocom, press [Ctrl][a] followed by [Ctrl][x]. AT91Bootstrap Setup The boot process is done in two steps with the ROM monitor trying to execute a first piece of software, called AT91Bootstrap, from its internal SRAM, that will initialize the DRAM, load U-Boot that will in turn load Linux and execute it. As far as bootloaders are concerned, the layout of the NAND flash will look like: Free Electrons, CC BY-SA license 9

10 Offset 0x0 for the first stage bootloader is dictated by the hardware: the ROM code of the SAMA5D3 looks for a bootloader at offset 0x0 in the NAND flash. Offset 0x40000 for the second stage bootloader is decided by the first stage bootloader. This can be changed by changing the AT91Bootstrap configuration. Offset 0xc0000 of the U-Boot environment is decided by U-Boot. This can be changed by modifying the U-Boot configuration. The first item to compile is AT91Bootstrap that you can fetch from Atmel s GitHub account: git clone cd at91bootstrap git checkout v3.8.9 Then, we first need to configure the build system for our setup. We re going to need a few pieces of information for this: Which board you want to run AT91Bootstrap on Which device should AT91Bootstrap will be stored on What component you want AT91Boostrap to load You can get the list of the supported boards by listing the board directory. You ll see that in each of these folders, we have a bunch of defconfig files, that are the supported combinations. In our case, using the Atmel SAMA5D3 Xplained board, we will load U-Boot, from NAND flash on (nf in the defconfig file names). After finding the right defconfig file, load it using make <defconfig_filename> (just the file name, without the directory part). In recent versions of AT91Bootstrap, you can now run make menuconfig to explore options available in this program. The next thing to do is to specific the cross-compiler prefix (the part before gcc in the crosscompiler executable name): export CROSS_COMPILE=arm-linux Free Electrons, CC BY-SA license

11 You can now start compiling using make 2. At the end of the compilation, you should have a file called sama5d3_xplained-nandflashbootuboot-*.bin, in the binaries folder. In order to flash it, we need to do a few things. First, remove the NAND CS jumper on the board. It s next to the pin header closest to the Micro-USB plug. Now, press the RESET button. On the serial port, you should see RomBoot. Put the jumper back. Then, start sam-ba (or sam-ba_64 if using a 64 bit installation of Ubuntu). Run the executable from where it was extracted. You ll get a small window. Select the ttyacm0 connection, and the at91sama5d3x-xplained board. Hit Connect. You need to: Hit the NANDFlash tab In the Scripts choices, select Enable NandFlash and hit Execute Select Erase All, and execute the command Then, select and execute Enable OS PMECC parameters in order to change the NAND ECC parameters to what RomBOOT expects. Finally, send the image we just compiled using the command Send Boot File AT91Bootstrap should be flashed now, keep sam-ba open, and move to the next section. U-Boot setup Download U-Boot: wget ftp://ftp.denx.de/pub/u-boot/u-boot tar.bz2 More recent versions may also work, but we have not tested them. Extract the source archive and get an understanding of U-Boot s configuration and compilation steps by reading the README file, and specifically the Building the Software section. Basically, you need to: Set the CROSS_COMPILE environment variable; Run make <NAME>_defconfig, where the list of available configurations can be found in the configs/ directory. There are two flavors of the Xplained configuration: one to run from the SD card (sama5d3_xplained_mmc) and one to run from the NAND flash (sama5d3_ xplained_nandflash). Since we re going to boot on the NAND, use the latter. Now that you have a valid initial configuration, you can now run make menuconfig to further edit your bootloader features. In recent versions of U-Boot and for some boards, you will need to have the Device Tree compiler: sudo apt-get install device-tree-compiler Finally, run make, which should build U-Boot. 2 You can speed up the compiling by using the -jx option with make, where X is the number of parallel jobs used for compiling. Twice the number of CPU cores is a good value Free Electrons, CC BY-SA license 11

12 Shrinking U-Boot Look at the size of the u-boot.bin binary. According to the above flash layout, the U-Boot binary is supposed to fit between flash offset 0x40000 and offset 0xc00000, corresponding to a maximum size of bytes. Is u-boot.bin bigger than this maximum? The first offset is what AT91Bootstrap expects (though it can be changed in AT91Bootstrap s configuration. The second one, corresponding to where U-Boot stores its environment settings, is board dependent but but apparently cannot be changed through make menuconfig. To avoid recompiling AT91Bootstrap, we propose to compile U-Boot with less features, to make its binary small. That s probably something you will do too during real-life projects. So, in U-Boot sources, run make menuconfig, look for and disable the below options: ext4 options nfs options EFI options imxtract support bootelf command Regular expression support dm support loadb support mii commands Now, recompile U-Boot and check that u-boot.bin is smaller than our maximum size. Flashing U-Boot Now, in sam-ba, in the Send File Name field, set the path to the u-boot.bin that was just compiled, and set the address to 0x Click on the Send File button. You can now exit sam-ba. Testing U-Boot Reset the board and check that it boots your new bootloaders. You can verify this by checking the build dates: AT91Bootstrap (Mon Oct :09:08 (UTC+0100)) NAND: ONFI flash detected NAND: Manufacturer ID: 0x2c Chip ID: 0xda NAND: Page Bytes: 2048, Spare Bytes: 64 NAND: ECC Correctability Bits: 4, ECC Sector Bytes: 512 NAND: Disable On-Die ECC NAND: Initialize PMECC params, cap: 4, sector: 512 NAND: Image: Copy 0xa0000 bytes from 0x40000 to 0x26f00000 NAND: Done to load image <debug_uart> Free Electrons, CC BY-SA license

13 U-Boot (Oct :20: ) CPU: SAMA5D36 Crystal frequency: 12 MHz CPU clock : 528 MHz Master clock : 132 MHz DRAM: 256 MiB NAND: 256 MiB MMC: Atmel mci: 0, Atmel mci: 1 *** Warning - bad CRC, using default environment In: serial@ffffee00 Out: serial@ffffee00 Err: serial@ffffee00 Net: Error: ethernet@f address not set. No ethernet found. Hit any key to stop autoboot: 0 Interrupt the countdown to enter the U-Boot shell: => In U-Boot, type the help command, and explore the few commands available. Setting up Ethernet communication Later on, we will transfer files from the development workstation to the board using the TFTP protocol, which works on top of an Ethernet connection. To start with, install and configure a TFTP server on your development workstation, as detailed in the bootloader slides. With a network cable, connect the Ethernet port labelled ETH0/GETH of your board to the one of your computer. If your computer already has a wired connection to the network, your instructor will provide you with a USB Ethernet adapter. A new network interface should appear on your Linux system. To configure this network interface on the workstation side, click on the Network Manager tasklet on your desktop, and select Edit Connections Free Electrons, CC BY-SA license 13

14 Select Wired connection 1 and press the Edit button. In the IPv4 Settings tab, choose the Manual method to make the interface use a static IP address, like (of course, make sure that this address belongs to a separate network segment from the one of the main company network). You can use 24 as Netmask, and leave the Gateway field untouched (if you click on the Gateway box, you will have to type a valid IP address, otherwise you won t be allowed to click on the Save button). Now, configure the network on the board in U-Boot by setting the ipaddr and serverip envi Free Electrons, CC BY-SA license

15 ronment variables: setenv ipaddr setenv serverip The first time you use your board, you also need to set the MAC address in U-boot: setenv ethaddr 12:34:56:ab:cd:ef In case the board was previously configured in a different way, we also turn off automatic booting after commands that can be used to copy a kernel to RAM: setenv autostart no To make these settings permanent, save the environment: saveenv Now reset your board 3. You can then test the TFTP connection. First, put a small text file in the directory exported through TFTP on your development workstation. Then, from U-Boot, do: tftp 0x textfile.txt The tftp command should have downloaded the textfile.txt file from your development workstation into the board s memory at location 0x You can verify that the download was successful by dumping the contents of the memory: md 0x We will see in the next labs how to use U-Boot to download, flash and boot a kernel. Rescue binaries If you have trouble generating binaries that work properly, or later make a mistake that causes you to loose your bootloader binaries, you will find working versions under data/ in the current lab directory. 3 Resetting your board is needed to make your ethaddr permanent, for obscure reasons. If you don t, U-boot will complain that ethaddr is not set. 4 This location is part of the board DRAM. If you want to check where this value comes from, you can check the Atmel SAMA5D3 datasheet at following the Documents link. It s a big document (more than 1,800 pages). In this document, look for Memory Mapping and you will find the SoC memory map. You will see that the address range for the memory controller (DDRC S) starts at 0x and ends at 0x3fffffff. This shows that the 0x address is within the address range for RAM. You can also try with other values in the same address range, knowing that our board only has 256 MB of RAM (that s 0x , so the physical RAM probably ends at 0x ) Free Electrons, CC BY-SA license 15

16 Kernel sources Objective: Learn how to get the kernel sources and patch them. After this lab, you will be able to: Get the kernel sources from the official location Apply kernel patches Setup Create the $HOME/embedded-linux-labs/kernel directory and go into it. Get the sources Go to the Linux kernel web site ( and identify the latest stable version. Just to make sure you know how to do it, check the version of the Linux kernel running on your machine. We will use linux-4.14.x, which this lab was tested with. To practice with the patch command later, download the full 4.13 sources. Unpack the archive, which creates a linux-4.13 directory. Remember that you can use wget <URL> on the command line to download files. Apply patches Download the patch files corresponding to the latest 4.14 stable release: a first patch to move from 4.13 to 4.14 and if one exists, a second patch to move from 4.14 to 4.14.x. Without uncompressing them (!), apply the patches to the Linux source directory. View one of the 2 patch files with vi or gvim (if you prefer a graphical editor), to understand the information carried by such a file. How are described added or removed files? Rename the linux-4.13 directory to linux-4.14.<x> Free Electrons, CC BY-SA license

17 Kernel - Cross-compiling Objective: Learn how to cross-compile a kernel for an ARM target platform. After this lab, you will be able to: Set up a cross-compiling environment Configure the kernel Makefile accordingly Cross compile the kernel for the Atmel SAMA5D3 Xplained ARM board Use U-Boot to download the kernel Check that the kernel you compiled starts the system Setup Go to the $HOME/embedded-linux-labs/kernel directory. Install the qt5-default package which is needed for the xconfig kernel configuration interface. Target system We are going to cross-compile and boot a Linux kernel for the Atmel SAMA5D3 Xplained board. Kernel sources We will re-use the kernel sources downloaded and patched in the previous lab. Cross-compiling environment setup To cross-compile Linux, you need to have a cross-compiling toolchain. We will use the crosscompiling toolchain that we previously produced, so we just need to make it available in the PATH: export PATH=$HOME/x-tools/arm-cortexa5-linux-uclibcgnueabihf/bin:$PATH Also, don t forget to either: Define the value of the ARCH and CROSS_COMPILE variables in your environment (using export) Or specify them on the command line at every invocation of make, i.e: make ARCH=... CROSS_COMPILE=... <target> Free Electrons, CC BY-SA license 17

18 Linux kernel configuration By running make help, find the proper Makefile target to configure the kernel for the Xplained board (hint: the default configuration is not named after the board, but after the SoC name). Once found, use this target to configure the kernel with the ready-made configuration. Don t hesitate to visualize the new settings by running make xconfig afterwards! In the kernel configuration, as an experiment, change the kernel compression from Gzip to XZ. This compression algorithm is far more efficient than Gzip, in terms of compression ratio, at the expense of a higher decompression time. Cross compiling You re now ready to cross-compile your kernel. Simply run: make and wait a while for the kernel to compile. Don t forget to use make -j<n> if you have multiple cores on your machine! Look at the end of the kernel build output to see which file contains the kernel image. You can also see the Device Tree.dtb files which got compiled. Find which.dtb file corresponds to your board. Copy the linux kernel image and DTB files to the TFTP server home directory. Load and boot the kernel using U-Boot We will use TFTP to load the kernel image on the Xplained board: On your workstation, copy the zimage and DTB files to the directory exposed by the TFTP server. On the target (in the U-Boot prompt), load zimage from TFTP into RAM at address 0x : tftp 0x zimage Now, also load the DTB file into RAM at address 0x : tftp 0x at91-sama5d3_xplained.dtb Boot the kernel with its device tree: bootz 0x x You should see Linux boot and finally panicking. working root filesystem for our device yet. This is expected: we haven t provided a You can now automate all this every time the board is booted or reset. Reset the board, and specify a different bootcmd: setenv bootcmd 'tftp 0x zimage; tftp 0x at91-sama5d3_xplained.dtb; bootz 0x x ' saveenv Flashing the kernel and DTB in NAND flash In order to let the kernel boot on the board autonomously, we can flash the kernel image and DTB in the NAND flash available on the Xplained board Free Electrons, CC BY-SA license

19 After storing the first stage bootloader, U-boot and its environment variables, we will keep special areas in NAND flash for the DTB and Linux kernel images: So, let s start by erasing the corresponding 128 KiB of NAND flash for the DTB: nand erase 0x x20000 (NAND offset) (size) Then, let s erase the 5 MiB of NAND flash for the kernel image: nand erase 0x x Then, copy the DTB and kernel binaries from TFTP into memory, using the same addresses as before. Then, flash the DTB and kernel binaries: nand write 0x x x20000 (RAM addr) (NAND offset) (size) nand write 0x x x Power your board off and on, to clear RAM contents. We should now be able to load the DTB and kernel image from NAND and boot with: nand read 0x x x20000 (RAM addr) (offset) (size) nand read 0x x x bootz 0x x Write a U-Boot script that automates the DTB + kernel download and flashing procedure. You are now ready to modify bootcmd to boot the board from flash. But first, save the settings for booting from tftp: setenv bootcmdtftp ${bootcmd} This will be useful to switch back to tftp booting mode later in the labs. Finally, using editenv bootcmd, adjust bootcmd so that the Xplained board starts using the kernel in flash. Now, reset the board to check that it boots in the same way from NAND flash. Check that this is really your own version of the kernel that s running 5 5 Look at the kernel log. You will find the kernel version number as well as the date when it was compiled. That s very useful to check that you re not loading an older version of the kernel instead of the one that you ve just compiled Free Electrons, CC BY-SA license 19

20 Tiny embedded system with Busy- Box Objective: making a tiny yet full featured embedded system After this lab, you will: be able to configure and build a Linux kernel that boots on a directory on your workstation, shared through the network by NFS. be able to create and configure a minimalistic root filesystem from scratch (ex nihilo, out of nothing, entirely hand made...) for the Xplained board understand how small and simple an embedded Linux system can be. be able to install BusyBox on this filesystem. be able to create a simple startup script based on /sbin/init. be able to set up a simple web interface for the target. Lab implementation While (s)he develops a root filesystem for a device, a developer needs to make frequent changes to the filesystem contents, like modifying scripts or adding newly compiled programs. It isn t practical at all to reflash the root filesystem on the target every time a change is made. Fortunately, it is possible to set up networking between the development workstation and the target. Then, workstation files can be accessed by the target through the network, using NFS. Unless you test a boot sequence, you no longer need to reboot the target to test the impact of script or application updates. Setup Go to the $HOME/embedded-linux-labs/tinysystem/ directory Free Electrons, CC BY-SA license

21 Kernel configuration We will re-use the kernel sources from our previous lab, in $HOME/embedded-linux-labs/kernel/. In the kernel configuration built in the previous lab, verify that you have all options needed for booting the system using a root filesystem mounted over NFS, and if necessary, enable them and rebuild your kernel. Setting up the NFS server Create a nfsroot directory in the current lab directory. This nfsroot directory will be used to store the contents of our new root filesystem. Install the NFS server by installing the nfs-kernel-server package if you don t have it yet. Once installed, edit the /etc/exports file as root to add the following line, assuming that the IP address of your board will be : /home/<user>/embedded-linux-labs/tinysystem/nfsroot (rw,no_root_squash,no_subtree_check) Make sure that the path and the options are on the same line. Also make sure that there is no space between the IP address and the NFS options, otherwise default options will be used for this IP address, causing your root filesystem to be read-only. Then, restart the NFS server: sudo service nfs-kernel-server restart Booting the system First, boot the board to the U-Boot prompt. Before booting the kernel, we need to tell it that the root filesystem should be mounted over NFS, by setting some kernel parameters. Use the following U-Boot command to do so, in just 1 line setenv bootargs console=ttys0, root=/dev/nfs ip= :::::eth0 nfsroot= :/home/<user>/embedded-linux-labs/tinysystem/nfsroot rw Of course, you need to adapt the IP addresses to your exact network setup. Save the environment variables (with saveenv). You will later need to make changes to the bootargs value. Don t forget you can do this with the editenv command. Now, boot your system. The kernel should be able to mount the root filesystem over NFS: VFS: Mounted root (nfs filesystem) on device 0:14. If the kernel fails to mount the NFS filesystem, look carefully at the error messages in the console. If this doesn t give any clue, you can also have a look at the NFS server logs in /var/log/syslog. However, at this stage, the kernel should stop because of the below issue: [ ] devtmpfs: error mounting -2 This happens because the kernel is trying to mount the devtmpfs filesystem in /dev/ in the root filesystem. To address this, create a dev directory under nfsroot and reboot. Now, the kernel should complain for the last time, saying that it can t find an init application: Kernel panic - not syncing: No working init found. See Linux Documentation/init.txt for guidance. Try passing init= option to kernel Free Electrons, CC BY-SA license 21

22 Obviously, our root filesystem being mostly empty, there isn t such an application yet. In the next paragraph, you will add Busybox to your root filesystem and finally make it usable. Root filesystem with Busybox Download the sources of the latest BusyBox 1.27.x release. To configure BusyBox, we won t be able to use make xconfig, which is currently broken for BusyBox in Ubuntu 16.04, because of Qt library dependencies. We are going to use make gconfig this time. Before doing this, install the required packages: sudo apt-get install libglade2-dev Now, configure BusyBox with the configuration file provided in the data/ directory (remember that the Busybox configuration file is.config in the Busybox sources). If you don t use the BusyBox configuration file that we provide, at least, make sure you build BusyBox statically! Compiling Busybox statically in the first place makes it easy to set up the system, because there are no dependencies on libraries. Later on, we will set up shared libraries and recompile Busybox. Build BusyBox using the toolchain that you used to build the kernel. Going back to the BusyBox configuration interface specify the installation directory for Busy- Box 6. It should be the path to your nfsroot directory. Now run make install to install BusyBox in this directory. Try to boot your new system on the board. You should now reach a command line prompt, allowing you to execute the commands of your choice. Virtual filesystems Run the ps command. You can see that it complains that the /proc directory does not exist. The ps command and other process-related commands use the proc virtual filesystem to get their information from the kernel. From the Linux command line in the target, create the proc, sys and etc directories in your root filesystem. Now mount the proc virtual filesystem. Now that /proc is available, test again the ps command. Note that you can also now halt your target in a clean way with the halt command, thanks to proc being mounted 7. System configuration and startup The first user space program that gets executed by the kernel is /sbin/init and its configuration file is /etc/inittab. In the BusyBox sources, read details about /etc/inittab in the examples/inittab file. Then, create a /etc/inittab file and a /etc/init.d/rcs startup script declared in /etc/ inittab. In this startup script, mount the /proc and /sys filesystems. 6 You will find this setting in Install Options -> BusyBox installation prefix. 7 halt can find the list of mounted filesystems in /proc/mounts, and unmount each of them in a clean way before shutting down Free Electrons, CC BY-SA license

23 Any issue after doing this? Starting the shell in a proper terminal Before the shell prompt, you probably noticed the below warning message: /bin/sh: can't access tty; job control turned off This happens because the shell specified in the /etc/inittab file in started by default in /dev/ console: ::askfirst:/bin/sh When nothing is specified before the leading ::, /dev/console is used. However, while this device is fine for a simple shell, it is not elaborate enough to support things such as job control ([Ctrl][c] and [Ctrl][z]), allowing to interrupt and suspend jobs. So, to get rid of the warning message, we need init to run /bin/sh in a real terminal device: ttys0::askfirst:/bin/sh Reboot the system and the message will be gone! Switching to shared libraries Take the hello.c program supplied in the lab data directory. dynamically-linked with the libraries, and run it on the target. Cross-compile it for ARM, You will first encounter a very misleading not found error, which is not because the hello executable is not found, but because something else is not found using the attempt to execute this executable. What s missing is the ld-uclibc.so.0 executable, which is the dynamic linker required to execute any program compiled with shared libraries. Using the find command (see examples in your command memento sheet), look for this file in the toolchain install directory, and copy it to the lib/ directory on the target. Then, running the executable again and see that the loader executes and finds out which shared libraries are missing. If you still get the same error message, work, just try again a few seconds later. Such a delay can be needed because the NFS client can take a little time (at most seconds) before seeing the changes made on the NFS server. Similarly, find the missing libraries in the toolchain and copy them to lib/ on the target. Once the small test program works, we are going to recompile Busybox without the static compilation option, so that Busybox takes advantages of the shared libraries that are now present on the target. Before doing that, measure the size of the busybox executable. Then, build Busybox with shared libraries, and install it again on the target filesystem. Make sure that the system still boots and see how much smaller the busybox executable got. Implement a web interface for your device Replicate data/www/ to the /www directory in your target root filesystem. Now, run the BusyBox http server from the target command line: Free Electrons, CC BY-SA license 23

24 /usr/sbin/httpd -h /www/ It will automatically background itself. If you use a proxy, configure your host browser so that it doesn t go through the proxy to connect to the target IP address, or simply disable proxy usage. Now, test that your web interface works well by opening on the host. See how the dynamic pages are implemented. Very simple, isn t it? Free Electrons, CC BY-SA license

25 Filesystems - Block file systems Objective: configure and boot an embedded Linux system relying on block storage After this lab, you will be able to: Manage partitions on block storage. Produce file system images. Configure the kernel to use these file systems Use the tmpfs file system to store temporary files Goals After doing the A tiny embedded system lab, we are going to copy the filesystem contents to the MMC flash drive. The filesystem will be split into several partitions, and your sama5d3 X-plained board will be booted with this MMC card, without using NFS anymore. Setup Throughout this lab, we will continue to use the root filesystem we have created in the $HOME/ embedded-linux-labs/tinysystem/nfsroot directory, which we will progressively adapt to use block filesystems. Filesystem support in the kernel Recompile your kernel with support for SquashFS and ext3 8. Update your kernel image in NAND flash. Boot your board with this new kernel and on the NFS filesystem you used in this previous lab. Now, check the contents of /proc/filesystems. You should see that ext3 and SquashFS are now supported. Prepare the MMC card We re going to use an MMC card for our block device. Plug the MMC card your instructor gave you on your workstation. Type the dmesg command to see which device is used by your workstation. In case the device is /dev/mmcblk0, you will see something like [ ] mmc0: new high speed SDHC card at address 0007 [ ] mmcblk0: mmc0:0007 SD16G 14.5 GiB 8 Basic configuration options for these filesystems will be sufficient. No need for things like extended attributes Free Electrons, CC BY-SA license 25

26 The device file name may be different (such as /dev/sdb if the card reader is connected to a USB bus (either inside your PC or using a USB card reader). In the following instructions, we will assume that your MMC/SD card is seen as /dev/mmcblk0 by your PC workstation. Type the mount command to check your currently mounted partitions. If MMC/SD partitions are mounted, unmount them: $ sudo umount /dev/mmcblk0* Then, clear possible MMC/SD card contents remaining from previous training sessions (only the first megabytes matter): $ sudo dd if=/dev/zero of=/dev/mmcblk0 bs=1m count=256 Now, let s use the cfdisk command to create the partitions that we are going to use: $ sudo cfdisk /dev/mmcblk0 If cfdisk asks you to Select a label type, choose dos. This corresponds to traditional partitions tables that DOS/Windows would understand. gpt partition tables are needed for disks bigger than 2 TB. In the cfdisk interface, delete existing partitions, then create three primary partitions, starting from the beginning, with the following properties: One partition, 64MB big, with the FAT16 partition type. One partition, 8 MB big 9, that will be used for the root filesystem. Due to the geometry of the device, the partition might be larger than 8 MB, but it does not matter. Keep the Linux type for the partition. One partition, that fills the rest of the MMC card, that will be used for the data filesystem. Here also, keep the Linux type for the partition. Press Write when you are done. To make sure that partition definitions are reloaded on your workstation, remove the MMC card and insert it again. Data partition on the MMC disk Using the mkfs.ext3 create a journaled file system on the third partition of the MMC disk: sudo mkfs.ext3 -L data -E nodiscard /dev/mmcblk0p3 -L assigns a volume name to the partition -E nodiscard disables bad block discarding. While this should be a useful option for cards with bad blocks, skipping this step saves long minutes in MMC/SD cards. Now, mount this new partition and move the contents of the /www/upload/files directory (in your target root filesystem) into it. The goal is to use the third partition of the MMC card as the storage for the uploaded images. Connect the MMC disk to your board. You should see the MMC partitions in /proc/partitions. 9 For the needs of our system, the partition could even be much smaller, and 1 MB would be enough. However, with the 8 GB SD cards that we use in our labs, 8 MB will be the smallest partition that cfdisk will allow you to create Free Electrons, CC BY-SA license

27 Mount this third partition on /www/upload/files. Once this works, modify the startup scripts in your root filesystem to do it automatically at boot time. Reboot your target system and with the mount command, check that /www/upload/files is now a mount point for the third MMC disk partition. Also make sure that you can still upload new images, and that these images are listed in the web interface. Adding a tmpfs partition for log files For the moment, the upload script was storing its log file in /www/upload/files/upload.log. To avoid seeing this log file in the directory containing uploaded files, let s store it in /var/log instead. Add the /var/log/ directory to your root filesystem and modify the startup scripts to mount a tmpfs filesystem on this directory. You can test your tmpfs mount command line on the system before adding it to the startup script, in order to be sure that it works properly. Modify the www/cgi-bin/upload.cfg configuration file to store the log file in /var/log/upload. log. You will lose your log file each time you reboot your system, but that s OK in our system. That s what tmpfs is for: temporary data that you don t need to keep across system reboots. Reboot your system and check that it works as expected. Making a SquashFS image We are going to store the root filesystem in a SquashFS filesystem in the second partition of the MMC disk. In order to create SquashFS images on your host, you need to install the squashfs-tools package. Now create a SquashFS image of your NFS root directory. Finally, using the dd command, copy the file system image to the second partition of the MMC disk. Booting on the SquashFS partition In the U-boot shell, configure the kernel command line to use the second partition of the MMC disk as the root file system. Also add the rootwait boot argument, to wait for the MMC disk to be properly initialized before trying to mount the root filesystem. Since the MMC cards are detected asynchronously by the kernel, the kernel might try to mount the root filesystem too early without rootwait. Check that your system still works. Congratulations if it does! Store the kernel image and DTB on the MMC card You ll first need to format the first partition, using: sudo mkfs.vfat -F 16 -n boot /dev/mmcblk0p1 It will create a new FAT16 partition, called boot. Remove and plug the MMC card. You can now copy the kernel image and Device Tree to it Free Electrons, CC BY-SA license 27

28 You can now copy the zimage kernel image and DTB to the first partition of the MMC card and adjust the bootcmd of U-Boot so that it loads the kernel and DTB from the MMC card instead of loading them from the NAND. In U-boot, you can load a file from a FAT filesystem using a command like fatload mmc 0:1 0x filename Which will load the file named filename from the first partition of the first MMC device to the system memory at the address 0x Going further At this point our board still uses the bootloaders (at91bootstrap and U-Boot) stored in the NAND flash. Let s try to have everything on our MMC card. The ROM code can load the first stage bootloader from an SD card, from a file named BOOT.BIN located in the first FAT partition of an MMC card. For this you will need to recompile at91bootstrap to support booting from an MMC card. When testing, do not forget to remove the NAND CS jumper! Free Electrons, CC BY-SA license

29 Filesystems - Flash file systems Objective: Understand flash and flash file systems usage and their integration on the target After this lab, you will be able to: Prepare filesystem images and flash them. Define partitions in embedded flash storage. Setup Stay in $HOME/embedded-linux-labs/tinysystem. Install the mtd-utils package, which will be useful to create UBIFS and UBI images. Goals Instead of using an external MMC card as in the previous lab, we will make our system use its internal flash storage. We will create an MTD partition to be attached to the UBI layer (the partitions previously used to store the kernel image and the DTB should be merged with this UBI partition). The kernel and DTB images will be stored in two separate static (read-only) UBI volumes. The root filesystem will be a UBI volume storing a UBIFS filesystem mounted read-only, the web server upload data will be stored in another UBI volume storing a UBIFS filesystem mounted read/write. These volumes will be dynamic volumes and will be 16 MiB large. Which gives the following layout: Enabling NAND flash and filesystems First, make sure your kernel has support for UBI and UBIFS, and also the option allowing us to pass the partition table through the command line: (CONFIG_MTD_CMDLINE_PARTS) Free Electrons, CC BY-SA license 29

30 Recompile your kernel if needed. We will update your kernel image on flash in the next section. Filesystem image preparation To prepare filesystem images, we won t use what you stored on the MMC/SD card during the previous lab. We will get back to the filesystem sources that you have in $HOME/embeddedlinux-labs/tinysystem/nfsroot. To run mkfs.ubifs, you will need to find the Logical Erase Block (LEB) size that UBI will use. A solution to get such information is to list default MTD partitions on the target (cat /proc/ mtd), and attach the last partition to UBI. In case, the last partition is mtd5, you will run: ubiattach -m 5 /dev/ubi_ctrl Doing this, you will get details in the kernel log about the MTD minimum I/O size and the LEB size that UBI will use 10. Knowing that the data and rootfs UBI volumes will be 16 MiB big, you can now divide their total size by the LEB size, to compute the maximum of LEBs that they will contain. That s the last parameter (-c) that you need to pass to mkfs.ubifs. You can now prepare a UBIFS filesystem image containing the files stored in the www/upload/ files directory. Modify the etc/init.d/rcs file under nfsroot to mount a UBI volume called data 11 on www/ upload/files. Once done, create a UBIFS image of your root filesystem. UBI image preparation Create a ubinize config file where you will define the 4 volumes described above, then use the ubinize tool to generate your UBI image. Warning: do not use the autoresize flag (vol_flags=autoresize): U-Boot corrupts the UBI metadata when trying to expand the volume. Remember that some of these volumes are static (read-only) and some are not. MTD partitioning and flashing Look at the default MTD partitions in the kernel log. They do not match the way we wish to organize our flash storage. Therefore, we will define our own partitions at boot time, on the kernel command line. Redefine the partitions in U-Boot using the mtdids and mtdparts environment variables. Once done, execute the mtdparts command and check the partition definitions. You can now safely erase the UBI partition without risking any corruption on other partitions. Download the UBI image (using tftp) you have created in the previous section and flash it on the UBI partition. 10 Note that this command could fail if you accidently wrote to the corresponding flash blocks. If this happens, go back to U-Boot and erase NAND sectors from the starting offset of this partition: nand erase 0x xF9A We will create it when running ubinize in the next section Free Electrons, CC BY-SA license

31 When flashing the UBI image, use the trimffs version of the command nand write 12. Loading kernel and DTB images from UBI and booting it From U-Boot, retrieve the kernel and DTB images from their respective UBI volumes and try to boot them. If it works, you can modify your bootcmd accordingly. Set the bootargs variable so that: The mtdparts environment variable contents are passed to the kernel through its command line. The UBI partition is automatically attached to the UBI layer at boot time The root filesystem is mounted from the root volume, and is mounted read-only (kernel parameter ro). Boot the target, and check that your system still works as expected. Your root filesystem should be mounted read-only, while the data filesystem should be mounted read-write, allowing you to upload data using the web server. Going further Using squashfs for the root filesystem Root filesystems are often a sensitive part of your system, and you don t want it to be corrupted, hence some people decide to use a read-only file system for their rootfs and use another file system to store their auxiliary data. squashfs is one of these read-only file systems. However, squashfs expects to be mounted on a block device. Use the ubiblk layer to emulate a read-only block device on top of a static UBI volume to mount a squashfs filesystem as the root filesystem: First create a squashfs image with your rootfs contents Then create a new static volume to store your squashfs and update it with your squashfs image Enable and setup the ubiblk layer Boot on your new rootfs Atomic update UBI also provides an atomic update feature, which is particularly useful if you need to safely upgrade sensitive parts of your system (kernel, DTB or rootfs). Duplicate the kernel volume and create a U-Boot script to fallback on the second kernel volume if the first one is corrupted: 12 The command nand write.trimffs skips the blank sectors instead of writing them. It is needed because the algorithm used by the hardware ECC for the SAMA5D3 SoC generates a checksum with bytes different from 0xFF if the page is blank. Linux only checks the page, and if it is blank it doesn t erase it, but as the OOB is not blank it leads to ECC errors. More generally it is not recommended writing more than one time on a page and its OOB even if the page is blank Free Electrons, CC BY-SA license 31

Embedded Linux System Development. Practical Labs.

Embedded Linux System Development. Practical Labs. Practical Labs http://bootlin.com August 15, 2018 About this document Updates to this document can be found on http://bootlin.com/doc/training/embedded-linux- 4d/. This document was generated from LaTeX

More information

Embedded Linux Training. Lab Book. Free Electrons

Embedded Linux Training. Lab Book. Free Electrons Lab Book Free Electrons http://free-electrons.com March 29, 2014 About this document Updates to this document can be found on http://free-electrons.com/doc/training/ embedded-linux/. This document was

More information

Cross-compilation with Buildroot

Cross-compilation with Buildroot Instituto Superior de Engenharia do Porto Mestrado em Engenharia Eletrotécnica e de Computadores Arquitetura de Computadores Cross-compilation with Buildroot Introduction Buildroot is a tool that can be

More information

Embedded Linux system development training 5-day session

Embedded Linux system development training 5-day session Embedded Linux system development training 5-day session Title Embedded Linux system development training Overview Bootloaders Kernel (cross) compiling and booting Block and flash filesystems C library

More information

400AP Application Note Uploading Firmware Images to 400AP NAND Flash Models

400AP Application Note Uploading Firmware Images to 400AP NAND Flash Models June 2014 400AP Application Note Uploading Firmware Images to 400AP NAND Flash Models Author: Thomas W. Heck, Sr. Design Engineer Janus Remote Communications Table of Contents Overview..................................................................................

More information

SparkGate7 Quick startup guide

SparkGate7 Quick startup guide SparkGate7 Quick startup guide Thank you for buying a SparkGate and SPARK-501 SOM. More information on both can be found at www.shiratech.com. The Shiratech team. In the box: The evaluation kit you have

More information

Kernel configuration The kernel configuration and build system is based on multiple Make files. All Makefiles inside the sub directories in kernel source interacts with the main Makefile which is present

More information

Raspberry Pi Network Boot

Raspberry Pi Network Boot Raspberry Pi Network Boot @Phenomer October 22, 2014 1 Raspberry Pi SD initrd 2 /srv/pxe ( ) /srv/pxe /srv/pxe/tftp - TFTP /srv/pxe/tftp/pxelinux.cfg - /srv/pxe/repo - /srv/pxe/initrd - initrd % sudo mkdir

More information

Lab2 - Bootloader. Conventions. Department of Computer Science and Information Engineering National Taiwan University

Lab2 - Bootloader. Conventions. Department of Computer Science and Information Engineering National Taiwan University Lab2 - Bootloader 1 / 20 Cross-compile U-Boot. Connect to Raspberry Pi via an USB-TTL cable. Boot Raspberry Pi via U-Boot. 2 / 20 Host Machine OS: Windows Target Machine Raspberry Pi (2 or 3) Build Machine

More information

Use U-Boot. U-Boot Main Commands. U-Boot script capability

Use U-Boot. U-Boot Main Commands. U-Boot script capability Use U-Boot U-Boot Main Commands setenv this command is used to set variables saveenv this command saves variables previously set in the environment permanent storage space printenv this command print the

More information

MCAM335x Linux User's Guide

MCAM335x Linux User's Guide Pag. 1 of 17 MCAM335x Linux User's Guide Pag. 2 of 17 Contents MCAM335x Linux User's Guide... 1 About this Manual... 4 Installation... 4 Introduction... 4 Prerequisites... 4 Install LSP packages... 5 U

More information

Linux. For BCT RE2G2. User Guide. Document Reference: BCTRE2G2 Linux User Guide. Document Issue: Associated SDK release: 1.

Linux. For BCT RE2G2. User Guide. Document Reference: BCTRE2G2 Linux User Guide. Document Issue: Associated SDK release: 1. Linux For BCT RE2G2 User Guide Document Reference: BCTRE2G2 Linux User Guide Document Issue: 1.05 Associated SDK release: 1.04 Author: D Robinson Contents Introduction... 3 Environment Setup... 3 Required

More information

1. Conventions in this tutorial Introduction Check and change configuration settings as needed Start Digi ESP...

1. Conventions in this tutorial Introduction Check and change configuration settings as needed Start Digi ESP... This tutorial introduces the power and features of Digi ESP for Embedded Linux as a development environment. It shows how to create a simple Linux application, transfer it to a target development board,

More information

Zephyr Kernel Installation & Setup Manual

Zephyr Kernel Installation & Setup Manual Zephyr Kernel Installation & Setup Manual Zephyr kernel is a small footprint Single address space OS, i.e, it combines application specific code with a custom kernel to create a monolithic image that gets

More information

Bootloader D. Balakrishna, Research Associate, IIIT-H Bootloaders are important when we are developing embedded systems, depending on the capabilities of the board and processor on which an embedded system

More information

Getting Started U-boot

Getting Started U-boot Getting Started U-boot Document Description Keywords Abstract U-boot, lpc2294 This document is a simple user guide for how to use u-boot on lpc2294 mcu: setup u-boot and toolkit; make and program the image

More information

LTIB for i.mx28, a step-by-step guide

LTIB for i.mx28, a step-by-step guide LTIB for i.mx28, a step-by-step guide Note: This guide shows how to get a target system building and running on an i.mx28 EVK board. Install LTIB Configure and build First time configuration LTIB configuration

More information

OMAP3530 has 256MB NAND flash in PoP (PoP: Package-On-Package implementation for Memory Stacking) configuration.

OMAP3530 has 256MB NAND flash in PoP (PoP: Package-On-Package implementation for Memory Stacking) configuration. 1 of 7 04/18/09 15:39 BeagleBoardNAND From elinux.org This page is about using (booting/running from) NAND (http://en.wikipedia.org/wiki/flash_memory#nand_flash) memory on BeagleBoard. Parts of this page

More information

phycore -XScale/PXA270 Development Kit (KPCM-027) Loading a Linux Image (demo.img)

phycore -XScale/PXA270 Development Kit (KPCM-027) Loading a Linux Image (demo.img) phycore -XScale/PXA270 Development Kit (KPCM-027) Loading a Linux Image (demo.img) This Application Note provides instructions on how to start-up the phycore-pxa270, download U-Boot to the phycore-pxa270

More information

How to Dual-Boot OS X and Ubuntu

How to Dual-Boot OS X and Ubuntu How to Dual-Boot OS X and Ubuntu Nailen Matschke - nailen@caltech.edu 10/3/2015 What you need: 1. A USB drive with at least 2 GB of space, that you don t mind wiping 2. A copy of Ubuntu (available here),

More information

Installing Ubuntu Server

Installing Ubuntu Server CHAPTER 1 Installing Ubuntu Server You probably chose Ubuntu as a server solution because of either your gratifying experience using it on the desktop or the raves you ve heard from others about its user-friendly

More information

Mars ZX3 Android manual. Antmicro

Mars ZX3 Android manual. Antmicro Mars ZX3 Android manual Antmicro Sep 27, 2017 Contents 1 Introduction 1 1.1 Acknowledgements..................................... 1 1.2 Version information..................................... 1 2 Compiling

More information

Q7M EVK (Q7M120

Q7M EVK (Q7M120 Q7M120-120-EVK (Q7M120 and Q7B120) BSP Linux User s Manual Disclaimers This manual has been carefully checked and believed to contain accurate information. Axiomtek Co., Ltd. assumes no responsibility

More information

Getting Started with BeagleBoard xm

Getting Started with BeagleBoard xm Getting Started with BeagleBoard xm by Getting Started with BeagleBoard-xM 1. Beagleboard-xM BeagleBoard.org ก Texas Instruments DM3730 1 GHz ก ARM Cortex-A8 (DSP) (PowerVR) (RAM) 512 MB Serial Port, USB

More information

SCM EVK (SCM120

SCM EVK (SCM120 SCM120-120-EVK (SCM120 and SCB120) BSP Linux User s Manual Disclaimers This manual has been carefully checked and believed to contain accurate information. Axiomtek Co., Ltd. assumes no responsibility

More information

MV 4412 Android 4.0 Compilation

MV 4412 Android 4.0 Compilation MV 4412 Android 4.0 Compilation Microvision Co., Ltd. Document Information Version 1.0 File Name MV4412 Android Compilation.doc Date 2012. 7. 12 Satus Working Revision History Date Version Update Descriptions

More information

Raspberry Pi Kernel Install. By: Daniel Rizko

Raspberry Pi Kernel Install. By: Daniel Rizko Raspberry Pi Kernel Install By: Daniel Rizko Introduction In this presentation I will be demonstrating three things. 1. Building a cross compiler from scratch using crosstool-ng for Raspberry Pi hardware.

More information

Formatting 1. Commands starting with $ are Linux console commands on the host PC:

Formatting 1. Commands starting with $ are Linux console commands on the host PC: Custom Kernel Guide by Arrvindh Shriraman Last update: April 1, 2016 This document guides the user through: 1. Downloading and compiling the Linux kernel's source code. 2. Running a custom kernel inside

More information

2 Installing the Software

2 Installing the Software INSTALLING 19 2 Installing the Software 2.1 Installation Remember the hour or two of slogging through software installation I promised (or warned) you about in the introduction? Well, it s here. Unless

More information

User Guide Linux for AT91CAP9-STK Version 1.1. User Guide LINUX FOR AT91CAP9-STK VERSION: 1.1 1/11

User Guide Linux for AT91CAP9-STK Version 1.1. User Guide LINUX FOR AT91CAP9-STK VERSION: 1.1 1/11 User Guide LINUX FOR AT91CAP9-STK VERSION: 1.1 1/11 History of Changes Revision Issue Date Descripion Author Ver 1.0 2009-04-24 First version of the document Olivier Arnal Ver 1.1 2009-04-27 Minor modification

More information

Embedded Systems Programming

Embedded Systems Programming Embedded Systems Programming OS Linux - Toolchain Iwona Kochańska Gdansk University of Technology Embedded software Toolchain compiler and tools for hardwaredependent software developement Bootloader initializes

More information

Pengwyn Documentation

Pengwyn Documentation Pengwyn Documentation Release 1.0 Silica October 03, 2016 Contents 1 Introduction 3 1.1 Platforms................................................. 3 1.2 Hardware requirements.........................................

More information

MV V310 Android 4.0 Compilation

MV V310 Android 4.0 Compilation MV V310 Android 4.0 Compilation Microvision Co., Ltd. Document Information Version 1.0 File Name MVV310 Android Compilation.doc Date 2012. 4. 17 Satus Working Revision History Date Version Update Descriptions

More information

Quickstart. with F&S Development Machine Fedora 23. Version 1.2 ( )

Quickstart. with F&S Development Machine Fedora 23. Version 1.2 ( ) Quickstart with F&S Development Machine Fedora 23 Version 1.2 (2017-05-05) F&S Elektronik Systeme GmbH Untere Waldplätze 23 D-70569 Stuttgart Germany Phone: +49(0)711-123722-0 Fax: +49(0)711-123722-99

More information

D1 - Embedded Linux. Building and installing an embedded and real-time Linux platform. Objectives. Course environment.

D1 - Embedded Linux. Building and installing an embedded and real-time Linux platform. Objectives. Course environment. Training Embedded Linux: Building and installing an embedded and real-time Linux platform - Operating Systems: Linux D1 - Embedded Linux Building and installing an embedded and real-time Linux platform

More information

LINUXBUILD User's Manual

LINUXBUILD User's Manual . LEON Linux Linux for LEON processors 2017 User's Manual The most important thing we build is trust LINUXBUILD User's Manual Linux build environment for LEON systems 1 www.cobham.com/gaisler Table of

More information

User s Manual for the Boundary Devices Nitrogen R board

User s Manual for the Boundary Devices Nitrogen R board 1 User s Manual for the Boundary Devices Nitrogen R board July 6, 2010 2 1 Revision History Date Revision Description 2010-06-17 1.0 First (rough) draft 2010-06-25 1.1 Still rough. Additional details on

More information

How I survived to a SoC with a terrible Linux BSP

How I survived to a SoC with a terrible Linux BSP How I survived to a SoC with a terrible Linux BSP Working with jurassic vendor kernels, missing pieces and buggy code Luca Ceresoli AIM Sportline luca@lucaceresoli.net http://lucaceresoli.net ELC-E 2017

More information

Building CircuitPython

Building CircuitPython Building CircuitPython Created by Dan Halbert Last updated on 2018-05-18 03:47:12 AM UTC Guide Contents Guide Contents Introduction Linux Setup Install a Real or Virtual Linux Machine Native Linux Linux

More information

SANOG VI IP Services Workshop: FreeBSD Install

SANOG VI IP Services Workshop: FreeBSD Install SANOG VI IP Services Workshop: FreeBSD Install FreeBSD is designed to be a server operating system. This becomes apparent during the installation process. The FreeBSD installer is a console-based (not

More information

Adding hardware support to Buildroot

Adding hardware support to Buildroot Adding hardware support to Buildroot Pierre Ficheux (pierre.ficheux@openwide.fr) CTO Open Wide / OS4I 08/07/2010 1 Several ways to get a distribution Using commercial product (Wind River, MV, ) => / $$$

More information

AT91SAM9G45-EVK Linux. User Manual

AT91SAM9G45-EVK Linux. User Manual AT91SAM9G45-EVK Linux User Manual Revision History Rev Date Description 1.0 2011-02-10 Initial version Catalogue 1. BUILD THE DEVELOPMENT PLATFORM... 1 1.1Create the working directory... 1 1.2 Cross compilation

More information

This is Lab Worksheet/Installation 7

This is Lab Worksheet/Installation 7 This is Lab Worksheet/Installation 7 This Lab Worksheet/Installation contains essential installation work needed for your upcoming Assignments. You do not have to hand in this Lab Worksheet, but there

More information

ECE 550D Fundamentals of Computer Systems and Engineering. Fall 2017

ECE 550D Fundamentals of Computer Systems and Engineering. Fall 2017 ECE 550D Fundamentals of Computer Systems and Engineering Fall 2017 The Operating System (OS) Prof. John Board Duke University Slides are derived from work by Profs. Tyler Bletsch and Andrew Hilton (Duke)

More information

Setup Macronix NAND Flash on Freescale i.mx28 EVK

Setup Macronix NAND Flash on Freescale i.mx28 EVK Setup Macronix NAND Flash on Freescale i.mx28 EVK The procedures defined in this document are verified by Linux kernel 2.6.31 and 2.6.35.3 version. You may need to setup hardware environment first. Then

More information

Developing Environment for Intel Mainstone Board

Developing Environment for Intel Mainstone Board Developing Environment for Intel Mainstone Board Outline Introduction Board Bring-up Running Linux Kernel Building Your Own Linux Kernel Developing Your Own App 1 Introduction :: PXA27x XScale PXA27x Architecture

More information

Linux Files and the File System

Linux Files and the File System Linux Files and the File System 1. Files a. Overview A simple description of the UNIX system, also applicable to Linux, is this: "On a UNIX system, everything is a file; if something is not a file, it

More information

Bootloader commands - Openmoko

Bootloader commands - Openmoko Wiki Docs Planet Projects Lists Bootloader commands From Openmoko English عربي Български Česky Deutsch Eesti Español فارسی suomi Français Ελληνικά עברית Magyar Italiano 日本語 한국어 Nederlands Polski Português

More information

Flash filesystem benchmarks

Flash filesystem benchmarks Embedded Linux Conference Europe 21 Flash filesystem benchmarks Michael Opdenacker Free Electrons Copyright 21, Free Electrons. 1 Free FreeElectrons Electrons Free embedded Linux and kernel materials http://free

More information

u-root: / with the convenience of scripting and the performance of compilation

u-root: / with the convenience of scripting and the performance of compilation u-root: / with the convenience of scripting and the performance of compilation Ron Minnich Google Andrey Mirtchovski Cisco Outline What u-root is Why we re doing it How it all works Try it! sudo docker

More information

Oxalis Getting Started

Oxalis Getting Started Oxalis Getting Started Document: Document: Getting Started Content of the document: Version: 001 First steps to power up, the board, to run uboot, Creator: ANT/MSB build kernel and boot linux. Date: 01.12.2018

More information

How To Reinstall Grub In Windows 7 Without Losing Data And Programs

How To Reinstall Grub In Windows 7 Without Losing Data And Programs How To Reinstall Grub In Windows 7 Without Losing Data And Programs So if I install Windows 7 using CD again, will I lose Ubuntu? then yes you will lose Ubuntu, however if you reinstall Windows without

More information

RETROPIE INSTALLATION GUIDE

RETROPIE INSTALLATION GUIDE RETROPIE INSTALLATION GUIDE CONTENTS THE FOLLOWING GUIDE WILL COVER THE INSTALLATION, SETUP AND CONFIGURATION OF THE RASPBERRY PI, RASPBIAN OS AND RETROPIE Author: http://rpiarcadebuild.wordpress.com/

More information

Operating System. Hanyang University. Hyunmin Yoon Operating System Hanyang University

Operating System. Hanyang University. Hyunmin Yoon Operating System Hanyang University Hyunmin Yoon (fulcanelli86@gmail.com) 2 ubuntu Linux Download https://www.ubuntu.com/download/desktop http://gofile.me/3qiyp/pj6fzmojf 2 3 VMware Workstation Player (optional) Download https://www.vmware.com/products/workstation-player/workstation-player-evaluation.html

More information

V Workstation Imaging

V Workstation Imaging V Workstation Imaging The following sections provide information on Novell ZENworks Desktop Management Workstation Imaging procedures and features. Chapter 50, Common Imaging Deployment Strategies, on

More information

Parallella Linux - quickstart guide. Antmicro Ltd

Parallella Linux - quickstart guide. Antmicro Ltd Parallella Linux - quickstart guide Antmicro Ltd June 13, 2016 Contents 1 Introduction 1 1.1 Xilinx tools.......................................... 1 1.2 Version information.....................................

More information

Intel Do-It-Yourself Challenge Rebuild (with) Yocto Nicolas Vailliet

Intel Do-It-Yourself Challenge Rebuild (with) Yocto Nicolas Vailliet Intel Do-It-Yourself Challenge Rebuild (with) Yocto Nicolas Vailliet www.intel-software-academic-program.com paul.guermonprez@intel.com Intel Software 2014-02-01 Why? Should I? Yocto? Is Yocto a distribution?

More information

1 Installation (briefly)

1 Installation (briefly) Jumpstart Linux Bo Waggoner Updated: 2014-09-15 Abstract A basic, rapid tutorial on Linux and its command line for the absolute beginner. Prerequisites: a computer on which to install, a DVD and/or USB

More information

This is Worksheet and Assignment 12. Disks, Partitions, and File Systems

This is Worksheet and Assignment 12. Disks, Partitions, and File Systems This is Worksheet and Assignment 12 This is a combined Worksheet and Assignment.. Quizzes and tests may refer to work done in this Worksheet and Assignment; save your answers. You will use a checking program

More information

This is Lab Worksheet 7 - not an Assignment

This is Lab Worksheet 7 - not an Assignment This is Lab Worksheet 7 - not an Assignment This Lab Worksheet contains some practical examples that will prepare you to complete your Assignments. You do not have to hand in this Lab Worksheet. Make sure

More information

FILE SYSTEMS. CS124 Operating Systems Winter , Lecture 23

FILE SYSTEMS. CS124 Operating Systems Winter , Lecture 23 FILE SYSTEMS CS124 Operating Systems Winter 2015-2016, Lecture 23 2 Persistent Storage All programs require some form of persistent storage that lasts beyond the lifetime of an individual process Most

More information

Once your USB drive is formatted for the FAT32 file system it can be mounted and tested on the GESBC To do this, use the following command:

Once your USB drive is formatted for the FAT32 file system it can be mounted and tested on the GESBC To do this, use the following command: GESBC-9302 Development With a USB Drive Paul H. Muller - Documatrix www.documatrix-usa.com ulx@linuxmail.org Disclaimer: The programs and procedures described here have been tested and are thought to be

More information

Embedded System Design

Embedded System Design Embedded System Design Lecture 10 Jaeyong Chung Systems-on-Chips (SoC) Laboratory Incheon National University Environment Variables Environment variables are a set of dynamic named values that can affect

More information

ELE409 SPRING2018 LAB0

ELE409 SPRING2018 LAB0 ELE409 SPRING2018 LAB0 Getting familiar with the LXDE system Objectives: Pre-Lab: 1. Burn the linux system onto a micro-sd card 2. Get familiar with basic linux commands 3. Be able to communicate with

More information

Embedded System Design Lab 3: Peripherals and Device Drivers

Embedded System Design Lab 3: Peripherals and Device Drivers csee 4840 Embedded System Design Lab 3: Peripherals and Device Drivers Stephen A. Edwards Columbia University Spring 2019 Implement on the fpga a memory-mapped peripheral that can receive communication

More information

Setting Up a Linux Operating System

Setting Up a Linux Operating System Name: Setting Up a Linux Operating System We will be using the Linux operating system for most of our practical work in this class. Knoppix is a live CD distribution of Linux, based on the Debian distribution.

More information

Xinu on Intel Galileo User Manual

Xinu on Intel Galileo User Manual Xinu on Intel Galileo User Manual Table of Contents Page 1.0 Firmware Update for the Intel Galileo board 2 2.0 Console connection on the Intel Galileo 2 2.1 Background 2 2.2 Serial cable setup for the

More information

Lab 4: Interrupts and Realtime

Lab 4: Interrupts and Realtime Lab 4: Interrupts and Realtime Overview At this point, we have learned the basics of how to write kernel driver module, and we wrote a driver kernel module for the LCD+shift register. Writing kernel driver

More information

Linux U-Boot and Kernel Users Guide

Linux U-Boot and Kernel Users Guide Linux U-Boot and Kernel Users Guide 1 Table of Contents Overview... 4 General Information... 4 Getting the U-Boot and Kernel Source Code (SDK)... 4 Preparing to Build... 4 Compiler... 5 Device Trees...

More information

INTRODUCTION TO LINUX

INTRODUCTION TO LINUX INTRODUCTION TO LINUX REALLY SHORT HISTORY Before GNU/Linux there were DOS, MAC and UNIX. All systems were proprietary. The GNU project started in the early 80s by Richard Stallman Goal to make a free

More information

LotOS Framework. Getting Started Guide for Banana Pi. Copyright (C) 2015 ilbers GmbH Revision 1.1,

LotOS Framework. Getting Started Guide for Banana Pi. Copyright (C) 2015 ilbers GmbH Revision 1.1, LotOS Framework Getting Started Guide for Banana Pi Copyright (C) 2015 ilbers GmbH Revision 1.1, 2015-10-20 Mango hypervisor and LotOS framework are copyright (C) 2014 2015 ilbers GmbH. All rights reserved.

More information

ECEN 449: Microprocessor System Design Department of Electrical and Computer Engineering Texas A&M University

ECEN 449: Microprocessor System Design Department of Electrical and Computer Engineering Texas A&M University ECEN 449: Microprocessor System Design Department of Electrical and Computer Engineering Texas A&M University Prof. Sunil P. Khatri Lab exercise created and tested by: Abbas Fairouz, Ramu Endluri, He Zhou,

More information

Lab 0: Intro to running Jupyter Notebook on a Raspberry Pi

Lab 0: Intro to running Jupyter Notebook on a Raspberry Pi Lab 0: Intro to running Jupyter Notebook on a Raspberry Pi Nick Antipa, Li-Hao Yeh, based on labs by Jon Tamir and Frank Ong January 24, 2018 This lab will walk you through setting up your Raspberry Pi

More information

What is version control? (discuss) Who has used version control? Favorite VCS? Uses of version control (read)

What is version control? (discuss) Who has used version control? Favorite VCS? Uses of version control (read) 1 For the remainder of the class today, I want to introduce you to a topic we will spend one or two more classes discussing and that is source code control or version control. What is version control?

More information

SmartCash SmartNode SCRIPT Setup Guide v2.2. Windows 10. Date: 20/02/2018. By (Jazz) yoyomonkey

SmartCash SmartNode SCRIPT Setup Guide v2.2. Windows 10. Date: 20/02/2018. By (Jazz) yoyomonkey SmartCash SmartNode SCRIPT Setup Guide v2.2 Date: Introduction Welcome to this step by step guide that will take you through the process of creating your own SmartCash SmartNode. This guide is aimed at

More information

A pragmatic guide to boot-time optimization

A pragmatic guide to boot-time optimization A pragmatic guide to boot-time optimization Chris Simmonds Embedded Linux Conference Europe 2017 A pragmatic guide to boot-time optimization 1 Copyright 2011-2017, 2net Ltd License These slides are available

More information

Die Brummbeere Documentation

Die Brummbeere Documentation Die Brummbeere Documentation Release 0.0.1 Peter Bouda February 21, 2016 Contents 1 owncloud Music Player 1 2 Contents 3 2.1 Compile for desktop........................................... 3 2.2 Embedded

More information

Development Environment Embedded Linux Primer Ch 1&2

Development Environment Embedded Linux Primer Ch 1&2 Development Environment Embedded Linux Primer Ch 1&2 Topics 1) Systems: Host and Target 2) Host setup 3) Host-Target communication CMPT 433 Slides #3 Dr. B. Fraser 18-05-05 2 18-05-05 1 Host & Target Host

More information

ADS U-boot User's Manual. Applied Data Systems Old Columbia Road Columbia MD, USA

ADS U-boot User's Manual. Applied Data Systems Old Columbia Road Columbia MD, USA ADS U-boot User's Manual ADS document # 110010-40011 Applied Data Systems www.applieddata.net 10260 Old Columbia Road Columbia MD, 21046 USA 301-490-4007 c2005 ADS August 11, 2005 ADS U-boot Bootloader

More information

TDDC88 Lab 4 Software Configuration Management

TDDC88 Lab 4 Software Configuration Management TDDC88 Lab 4 Software Configuration Management Introduction "Version control is to programmers what the safety net is to a trapeze artist. Knowing the net is there to catch them if they fall, aerialists

More information

Installing Ubuntu 8.04 for use with ESP-r 8 May 2009 Jon W. Hand, ESRU, Glasgow, Scotland

Installing Ubuntu 8.04 for use with ESP-r 8 May 2009 Jon W. Hand, ESRU, Glasgow, Scotland Installing Ubuntu 8.04 for use with ESP-r 8 May 2009 Jon W. Hand, ESRU, Glasgow, Scotland Introduction These notes apply to Ubuntu version 8.04. There are different disk layouts discussed as well as two

More information

3 Connection, Shell Serial Connection over Console Port SSH Connection Internet Connection... 5

3 Connection, Shell Serial Connection over Console Port SSH Connection Internet Connection... 5 Contents 1 Description 2 2 Supported Devices 3 3 Connection, Shell 4 3.1 Serial Connection over Console Port...................... 4 3.2 SSH Connection................................. 4 3.3 Internet Connection...............................

More information

In this video, I will be covering DM385 IPNC RDK out of box demo-- Here, I'll be showing flashing the uboot using prebuilt binaries available in RDK--

In this video, I will be covering DM385 IPNC RDK out of box demo-- Here, I'll be showing flashing the uboot using prebuilt binaries available in RDK-- MANISHA AGRAWAL: Hi. My name is Manisha Agrawal. I am with Texas Instruments Video Security team. In this video, I will be covering DM385 IPNC RDK out of box demo-- Part 3. Here, I'll be showing flashing

More information

D1S - Embedded Linux with Ac6 System Workbench

D1S - Embedded Linux with Ac6 System Workbench Formation Embedded Linux with Ac6 System Workbench: Implementing Linux on Embedded Systems - Systèmes d'exploitation: Linux D1S - Embedded Linux with Ac6 System Workbench Implementing Linux on Embedded

More information

Why You Should Not Use Arch

Why You Should Not Use Arch Why You Should Not Use Arch A new users guide to highly personalized, low maintenance operating system. Artur Frącek CC BY-NC-ND 4.0 1 Intro Arch is a very good Linux distribution so it is not a surprise

More information

Renesas Koelsch Hardware Setup and Software Installation

Renesas Koelsch Hardware Setup and Software Installation Renesas Koelsch Hardware Setup and Software Installation Table of content Introduction Master GDP-ivi10 GDP-ivi9 GDP-ivi7 Software setup Pre-built binaries Quick Start Obtain and Install Renesas Graphics

More information

CPU6901. PCI-104 ARM9 CPU Card. Software Manual (V1.0) 健昇科技股份有限公司 JS AUTOMATION CORP.

CPU6901. PCI-104 ARM9 CPU Card. Software Manual (V1.0) 健昇科技股份有限公司 JS AUTOMATION CORP. CPU6901 PCI-104 ARM9 CPU Card Software Manual (V1.0) 健昇科技股份有限公司 JS AUTOMATION CORP. 新北市汐止區中興路 100 號 6 樓 6F., No.100, Zhongxing Rd., Xizhi Dist., New Taipei City, Taiwan TEL:+886-2-2647-6936 FAX:+886-2-2647-6940

More information

Setting up a Chaincoin Masternode

Setting up a Chaincoin Masternode Setting up a Chaincoin Masternode Introduction So you want to set up your own Chaincoin Masternode? You ve come to the right place! These instructions are correct as of April, 2017, and relate to version

More information

Rootfs made easy with Buildroot

Rootfs made easy with Buildroot Kernel Recipes 2013 Rootfs made easy with Buildroot How kernel developers can finally solve the rootfs problem. Thomas Petazzoni Free Electrons thomas.petazzoni@free-electrons.com Free Electrons. Kernel,

More information

PL-I Assignment Broup B-Ass 5 BIOS & UEFI

PL-I Assignment Broup B-Ass 5 BIOS & UEFI PL-I Assignment Broup B-Ass 5 BIOS & UEFI Vocabulary BIOS = Basic Input Output System UEFI = Unified Extensible Firmware Interface POST= Power On Self Test BR = Boot Record (aka MBR) BC =Boot Code (aka

More information

Disk Imaging with Knoppix

Disk Imaging with Knoppix Introduction This document explains how to use the CD-ROM bootable version of Linux, named Knoppix, to make and restore images of computer hard drives. Knoppix makes a very good system recovery tool for

More information

How I survived to a SoC with a terrible Linux BSP

How I survived to a SoC with a terrible Linux BSP How I survived to a SoC with a terrible Linux BSP Working with jurassic vendor kernels, missing pieces and buggy code Luca Ceresoli luca@lucaceresoli.net http://lucaceresoli.net FOSDEM 2017 About me Open

More information

Adding SD card to WRT54GL

Adding SD card to WRT54GL 1 of 7 04/08/2012 06:57 AM Adding SD card to WRT54GL From ivc wiki The WRT54GL is a cool little router based on Linux (GPL) and Open Source, thus allowing for extension of the core functions via software

More information

HOW TO CLONE A LARGE NUMBER OF PCs

HOW TO CLONE A LARGE NUMBER OF PCs HOW TO CLONE A LARGE NUMBER OF PCs András Keszthelyi (Budapest Tech Polytechnical Institution) kea@turul.banki.hu Computer sciences are taught in all kinds of schools from elementary grade to universities

More information

Glomation. Embedded Single Board Computer GESBC-3130S User s Manual

Glomation. Embedded Single Board Computer GESBC-3130S User s Manual Glomation Embedded Single Board Computer GESBC-3130S User s Manual Table of Contents Chapter 1 Introducing the GESBC-3130S Single Board Computer... 4 GESBC-3130S Overview... 4 Advanced Features... 4 LPC-3130...

More information

GadgetPC Single Board Computer. System Restore Guide. Document Revision: 1.04 Date: 31 January, 2010

GadgetPC Single Board Computer. System Restore Guide. Document Revision: 1.04 Date: 31 January, 2010 GadgetPC Single Board Computer System Restore Guide Document Revision: 1.04 Date: 31 January, 2010 BiPOM Electronics, Inc. 16301 Blue Ridge Road, Missouri City, Texas 77489 Telephone: 1-713-283-9970 Fax:

More information

ENCM 339 Fall 2017: Editing and Running Programs in the Lab

ENCM 339 Fall 2017: Editing and Running Programs in the Lab page 1 of 8 ENCM 339 Fall 2017: Editing and Running Programs in the Lab Steve Norman Department of Electrical & Computer Engineering University of Calgary September 2017 Introduction This document is a

More information

Configuring Ubuntu to Code for the OmniFlash or OmniEP

Configuring Ubuntu to Code for the OmniFlash or OmniEP Configuring Ubuntu to Code for the OmniFlash or OmniEP Table of Contents Introduction...2 Assumptions...2 Getting Started...2 Getting the Cross Compiler for ARM...2 Extracting the contents of the compressed

More information

Current Challenges in UBIFS

Current Challenges in UBIFS Richard Weinberger sigma star gmbh /me Richard Weinberger Co-founder of sigma star gmbh Linux kernel developer and maintainer Strong focus on Linux kernel, lowlevel components, virtualization, security

More information

U-boot quick start guide

U-boot quick start guide Rev. 01 15 February 2007 User guide Document information Info Keywords Abstract Content U-boot, LPC2294, LPC2292, LPC2290/01, LPC2220, LPC2214, LPC2212, LPC2210/01 This document is a simple user guide

More information