Presentation is loading. Please wait.

Presentation is loading. Please wait.

Implementation of Embedded OS

Similar presentations


Presentation on theme: "Implementation of Embedded OS"— Presentation transcript:

1 Implementation of Embedded OS
Lab1 - Build Environment and Uboot / 18

2 Experimental Goal Set up the build environment. Build U-Boot for RPi2.
Boot RPi2 via U-Boot. / 18

3 Environment Host System Build System Target System Windows
Ubuntu (or above) 64-bit Target System Raspberry Pi 2 / 18

4 Software Required Host System Build System
PL2303 Driver PuTTY Build System VirtualBox Ubuntu U-Boot source code Prebuilt Raspberry Pi firmware Raspberry Pi bootloader configuration (config.txt) GCC cross-compiler targeting arm-linux-gnueabihf GParted You may download them from IEOS Course Software. / 18

5 Hardware Checklist Raspberry Pi 2 Power supply
Micro SD card and card reader USB-TTL cable / 18

6 Set up the Build System Install VirtualBox. Create a virtual machine.
Disk space: 30GB RAM: 2GB Network: NAT Install Ubuntu in the VM. / 18

7 Set up the ARM Cross-Compiler
In the build system, install all required packages for later compilation. % sudo apt-get update % sudo apt-get install build-essential lzop u-boot-tools bc curl libncurses5-dev % sudo apt-get install lib32z1 lib32ncurses5 lib32bz lib32stdc # ignore lib32bz2-1.0 in Ubuntu 16.04 Install the GCC cross-compiler toolchain. % sudo apt-get install gcc-arm-linux-gnueabihf Set environment variables. % export ARCH=arm % export CROSS_COMPILE=arm-linux-gnueabihf- / 18

8 Check the Cross-Compiler
The target is arm-linux-gnueabihf. Version above 4.9.x is required. (Ubuntu has a GCC.) Execute the following command to check. % arm-linux-gnueabihf-gcc -v / 18

9 Build U-Boot Download and extract the U-Boot source code.
Configure and start compiling. % cd u-boot % make clean % make rpi_2_defconfig % make # You may append –j<n> to accelerate. For example, you execute “make –j4” if you have 4 CPUs. After the process finishes, you get the U-Boot image named u-boot.bin. / 18

10 Access the SD Card Plug the SD card into the build system and find out the device name. E.g. /dev/sdc. Ensure the device name in your case. We will later erase all data on the device. If your build system is a VM, click the following button to capture the SD card. / 18

11 Format the SD card (1) Install and launch GParted.
% sudo apt-get install gparted % sudo gparted Unmount and than delete the original partitions. / 18

12 Format the SD card (2) Create two partitions.
1st partition: filesystem = fat32, size = 64MiB, label = boot 2nd partition: filesystem = ext4, size = all remained space, label = root / 18

13 Format the SD card (3) Apply all operations. / 18

14 Set up the Boot Partition (1)
Download and extract the Raspberry Pi firmware. Copy the U-Boot image to the boot directory and rename it. % cp u-boot /u-boot.bin firmware /boot/uboot.img Download config.txt to the boot directory. Replace the line “#kernel=” with “kernel=uboot.img”. The value of the “kernel” variable should match the filename of the U-Boot image (i.e. uboot.img without quotes). / 18

15 Set up the Boot Partition (2)
Copy all files in the boot directory to the 1st partition of the SD card. Now your SD card is bootable. Eject the SD card and plug it to RPi. / 18

16 Plug the USB-TTL Cable There are several modules of USB-TTL. The one we use is PL2303. In the host system, download and install the PL2303 driver. Plug the USB-TTL cable between RPi and the host system. USB-TTL GND (black)  GPIO GND (pin6) USB-TTL RX (white)  GPIO TXD0 (pin8) USB-TTL TX (green)  GPIO RXD0 (pin10) / 18

17 Connect to Raspberry Pi
If you have installed the PL2303 driver, you will find a new COM port in the device manager after you plug the USB-TTL cable. Launch PuTTY. Enter the following options and click open. There is nothing output yet since the RPi is not on. Connection type = Serial Serial port = the COM port Speed = / 18

18 Boot Successfully Plug the RPi power supply to turn on RPi. You will see the message in PuTTY. Hit any key to stop autoboot in 2 seconds, and you will drop into the U-Boot command line. / 18


Download ppt "Implementation of Embedded OS"

Similar presentations


Ads by Google