Lab 11 Department of Computer Science and Information Engineering National Taiwan University Lab11 - Porting 2014/12/9/ 26 1.

Slides:



Advertisements
Similar presentations
Computer System Laboratory
Advertisements

Hands-on with the Sitara Linux SDK This presentation provides a hands-on overview of the Sitara Linux SDK. It focuses on the software and tools found in.
Lab 4 Department of Computer Science and Information Engineering National Taiwan University Lab4 - Bootloader 2014/10/14/ 13 1.
Apache : Installation, Configuration, Basic Security Presented by, Sandeep K Thopucherela, ECE Department.
Buildroot CS-423 Dick Steflik. buildroot uClibc – C library for developing for embedded Linux –much smaller than GNU C tools to make a cross-compilation.
Software Development and Software Loading in Embedded Systems.
Computer System Laboratory
Linux-MVME Targets Using Motorola Board Support
COMPUTER SYSTEM LABORATORY Lab8 - Debugging II. Lab 8 Experimental Goal Learn how to debug Linux in source-level by Domingo and diagnose target boards.
COMPUTER SYSTEM LABORATORY Lab4 - Bootloader. Lab 4 Experimental Goal Learn how to build U-Boot bootloader for PXA /10/8/ 142.
Introduction to The Linaro Toolchain Embedded Processors Training Multicore Software Applications Literature Number: SPRPXXX 1.
1 Introduction to Tool chains. 2 Tool chain for the Sitara Family (but it is true for other ARM based devices as well) A tool chain is a collection of.
Renesas Technology America Inc. 1 M16C/Tiny SKP Tutorial 2 Creating A New Project Using HEW4.
Lab 3 Department of Computer Science and Information Engineering National Taiwan University Lab3 - Cross Tools 2014/10/7/ 20 1.
Computer System Laboratory
COMPUTER SYSTEM LABORATORY Lab10 - Sensor II. Lab 10 Experimental Goal Learn how to write programs on the PTK development board (STM32F207). 2013/11/19/
1 Embedded Linux porting Speaker: Yi-Ji Jheng Date:
Embedded Linux porting Kernel
© 2008, Renesas Technology America, Inc., All Rights Reserved 1 Purpose  This training course describes how to configure the the C/C++ compiler options.
Computer System Laboratory
Lab 1 Department of Computer Science and Information Engineering National Taiwan University Lab1 - Sensor 2014/9/23/ 13 1.
Linux in a Virtual Environment Nagarajan Prabakar School of Computing and Information Sciences Florida International University.
Porting Operating Systems Phan Duy Hùng (PhD) ES Lecturer – Hanoi FPT University.
1 What is a Kernel The kernel of any operating system is the core of all the system’s software. The only thing more fundamental than the kernel is the.
® 2-2 Projects 2.1Projects Overview Bootable Projects and VxWorks Configuration Integrated Simulator Downloadable Projects Build Specifications.
Conventions Department of Computer Science and Information Engineering National Taiwan University Conventions 2014/9/16/ 3 1.
Lab 10 Department of Computer Science and Information Engineering National Taiwan University Lab10 – Debugging II 2014/12/2 1 /16.
COMPUTER SYSTEM LABORATORY Lab6 - Root Filesystem.
Unit - VI. Linux and Real Time: Real Time Tasks Hard and Soft Real Time Tasks Linux Scheduling Latency Kernel Preemption Challenges in Kernel Preemption.
Lab 14 Department of Computer Science and Information Engineering National Taiwan University Lab14 – Camera 2014/12/30 1 /14.
Lab 13 Department of Computer Science and Information Engineering National Taiwan University Lab13 – Interrupt + Timer 2014/12/23 1 /16.
Track Short Course: TrackRT Installation Thomas Herring, MIT Room A
Renesas Technology America Inc. 1 M16C Seminars Lab 3 Creating Projects Using HEW4 14 March 2005 M16C Seminars Lab 3 Creating Projects Using HEW4 Last.
Dissecting the Windows CE Build Process James Y. Wilson Principal Engineer, Windows Embedded MVP CalAmp, Inc. James Y. Wilson Principal Engineer, Windows.
OS Project 0 February 25, Outline  Linux Installation  Linux Kernel Compilation  System Call Development  Kernel Modules / 452.
Implementation of Embedded OS Lab4 Cortex-M3 Programming.
Lab 12 Department of Computer Science and Information Engineering National Taiwan University Lab12 – Driver 2014/12/16 1 /21.
Implementation of Embedded OS Lab3 Porting μC/OS-II.
Lab 5 Department of Computer Science and Information Engineering National Taiwan University Lab5 – Bootloader + OS Kernel 2015/10/27/ 25 1.
Lab 8 Department of Computer Science and Information Engineering National Taiwan University Lab8 - Root Filesystem 2015/11/10/ 22 1.
Lab 9 Department of Computer Science and Information Engineering National Taiwan University Lab9 - Debugging I 2014/11/4/ 28 1.
Lab 3 Department of Computer Science and Information Engineering National Taiwan University Lab3 – μC/OS 2015/10/13/ 13 1.
Implementation of Embedded OS
Lab 7 Department of Computer Science and Information Engineering National Taiwan University Lab7 – uCOS Application 2015/11/10/ 10 1.
Lab 5 Department of Computer Science and Information Engineering National Taiwan University Lab5 - OS Kernel 2014/10/21/ 16 1.
Blackfin buildroot development
OCR A Level F453: The function and purpose of translators Translators a. describe the need for, and use of, translators to convert source code.
Embedded Software Design Week II Linux Intro Linux Kernel.
Building programs LinuxChix-KE. What happens in your CPU? ● It executes a small set of instructions called "machine code" ● Each instruction is just a.
1 Buildroot. Building embedded Linux systems. Buildroot Developer Day.
1 Free Electrons. Kernel, drivers and embedded Linux development, consulting, training and support. http//free-electrons.com The U-boot bootloader Michael.
Operating System Kernel Compilation
Computer System Laboratory
Computer System Laboratory
Implementation of Embedded OS
Computer System Laboratory
Computer System Laboratory
Implementation of Embedded OS
Doing stuff on uClinux EE590 Autumn 2004.
Implementation of Embedded OS
Computer System Laboratory
Operating System Kernel Compilation
Linux-MVME Targets Using Motorola Board Support
Computer System Laboratory
Computer System Laboratory
Computer System Laboratory
Computer System Laboratory
Computer System Laboratory
Lab 2: Terminal Basics.
Operating System Kernel Compilation
Presentation transcript:

Lab 11 Department of Computer Science and Information Engineering National Taiwan University Lab11 - Porting 2014/12/9/ 26 1

Lab 11 Department of Computer Science and Information Engineering National Taiwan University  Understand the basic process of porting and learn how to use Buildroot. 2014/12/9/ 26 2

Lab 11 Department of Computer Science and Information Engineering National Taiwan University  Host System  Windows XP  Build System  VirtualBox + Ubuntu 8.04  Target System  Creator XScale PXA270  Software  DENX U-Boot source code  Buildroot source code  Buildroot pre-downloaded packages  Vitetris  You can download all software from RSWiki CSL Course SoftwareRSWiki CSL Course Software 2014/12/9/ 26 3

Lab 11 Department of Computer Science and Information Engineering National Taiwan University  In software engineering, porting is the process of adapting software so that an executable program can be created for a computing environment that is different from the one for which it was originally designed (e.g. different CPU, operating system, or third party library).  Software is portable when the cost of porting it to a new platform is less than the cost of writing it from scratch.  The lower the cost of porting software, relative to its implementation cost, the more portable it is said to be. 2014/12/9/ 26 4

Lab 11 Department of Computer Science and Information Engineering National Taiwan University  OS porting only needs to modify OS Port layer for the target platform.  Modify the hardware dependent codes, such as GPIO, memory mapping, or interrupt control.  You can see the kernel patch file in Lab5 as an example of OS porting.patch 2014/12/9/ 26 5

Lab 11 Department of Computer Science and Information Engineering National Taiwan University  Buildroot is a set of Makefiles and patches that makes it easy to generate a complete embedded Linux system.  It can generate any or all of a cross-compilation toolchain, a root filesystem, a kernel image and a bootloader image.  It automates the building process of your embedded system and eases the cross-compilation process. Reference: Buildroot: /12/9/ 26 6

Lab 11 Department of Computer Science and Information Engineering National Taiwan University  board/  contains hardware-specific and project-specific files.  boot/  contains config options and recipes for various bootloaders.  toolchain/  contains config options and makefiles to build or import the toolchain.  dl/  contains necessary packages.  Buildroot will automatically download them, but this process is time-consuming. 2014/12/9/ 26 7

Lab 11 Department of Computer Science and Information Engineering National Taiwan University  Compiling process: 1. Download source files as required. 2. Configure, build and install the cross-compiling toolchain if an internal toolchain is used, or import a toolchain if an external toolchain is used. 3. Build selected target packages. 4. Build a kernel image, if selected. 5. Build a bootloader image, if selected. 6. Create a root filesystem in selected formats.  The results are stored in a directory, output/. 2014/12/9/ 26 8

Lab 11 Department of Computer Science and Information Engineering National Taiwan University  We now use Buildroot to compile the cross toolchain.  Step 0: install necessary packages.  % sudo apt-get install bison flex gettext  Step 1: dowload Buildroot and pre-downloaded packages.  buildroot tar.gz buildroot tar.gz  buildroot _dl.tar.gz buildroot _dl.tar.gz  Step 2: extract them, and put pre-downloaded packages dl/ into buildroot /.  Step 3: configure Buildroot.  % make menuconfig  Target Architecture = arm  Target Architecture Variant = xscale 2014/12/9/ 26 9

Lab 11 Department of Computer Science and Information Engineering National Taiwan University  Step 4: compile. (It will take about 10 ~ 20 mins.)  You should never use “ make -jN ” with Buildroot. It does not support top-level parallel make.  We can find the results in output/host/usr/bin.  Buildroot will use it to compile everything selected.  Step 5: Append this toolchain directory to PATH.  You have to delete the path of cross used in Lab6.  We will use it to compile the ported U-Boot later. 2014/12/9/ 26 10

Lab 11 Department of Computer Science and Information Engineering National Taiwan University  Now you will be given the U-Boot source codes without the configuration file for PXA270.U-Boot  Please port it to PXA270.  Modify the hardware-dependent codes to fit the architecture of PXA270.  Please add the ported U-Boot to Buildroot.  Create a patch.  Configure Buildroot so that it applies the patch before building the U-Boot. 2014/12/9/ 26 11

Lab 11 Department of Computer Science and Information Engineering National Taiwan University  include/  contains all header files used globally.  When porting boards, there should exist a board configuration file which is called configs/.h.  board/  contains all the specific board initialization files.  An individual directory for each board is supported by U-Boot.  /lowlevel_init.s : sequence of bootstrapping  /u-boot.lds : linker script  Makefile  Modify the top level makefile to specify the new board support. 2014/12/9/ 26 12

Lab 11 Department of Computer Science and Information Engineering National Taiwan University  Now we start to port U-Boot.  We can refer to U-Boot in Lab4 which has been ported to PXA270.U-Boot  Copy the following file and directory from U-Boot to U-boot  include/configs/Create_XScale_PXA270.h  board/Create_XScale_PXA270/  And please rename the board name “ Create_XScale_PXA270 ” to “ mtcr270 ”. 2014/12/9/ 26 13

Lab 11 Department of Computer Science and Information Engineering National Taiwan University  Rename memsetup.S to lowlevel_init.S which is the filename of bootstrapping in U-Boot  There are related labels which should be modified in this file.  You can refer to “ lowlevel_init.S ” from other boards.  E.g., board/adsvix/lowlevel_init.S 2014/12/9/ 26 14

Lab 11 Department of Computer Science and Information Engineering National Taiwan University  Delete some unnecessary functions in board/mtcr270/mtcr270.c.  They are from line 140 to line 158.  /* set CPU speed from config block if not already set */  Adjust the settings in include/configs/mtcr270.h.  Comment out “ #define CONFIG_SERIAL_TAG 1 ”.  Change “ #define CONFIG_INIT_CRITICAL ” to “ #undef CONFIG_INIT_CRITICAL ”.  Check and correct other common-use settings, such as “ CONFIG_BOOTCOMMAND ”, “ CONFIG_LINUX ”, as we do in lab /12/9/ 26 15

Lab 11 Department of Computer Science and Information Engineering National Taiwan University  Define some configuration in U-Boot  In include/flash.h,  #define INTEL_ID_28F256P30B 0x891C891C  #define FLASH_28F256P30B 0x00BA  In Makefile, add a rule below at line arm pxa mtcr270  In board/mtcr270/Makefile, set to correct name.  OBJS := mtcr270.o flash.o  SOBJS := lowlevel_init.o 2014/12/9/ 26 16

Lab 11 Department of Computer Science and Information Engineering National Taiwan University  In include/asm-arm/mach-types.h, add the following.  At line 739: #define MACH_TYPE_MTCR  At line 9406: #ifdef CONFIG_MACH_MTCR270 # ifdef machine_arch_type # undef machine_arch_type # define machine_arch_type __machine_arch_type # else # define machine_arch_type MACH_TYPE_MTCR270 # endif # define machine_is_Create_MTCR270() (machine_arch_type == MACH_TYPE_MTCR270) #else # define machine_is_MTCR270()(0) #endif 2014/12/9/ 26 17

Lab 11 Department of Computer Science and Information Engineering National Taiwan University  In board/mtcr270/mtcr270.c,  fix “ gd->bd->bi_arch_number = MACH_TYPE_MTCR270 ” at line 95.  Comment out “ printf("CPU speed: %dkHz\n", pxa27x_get_freq()); ” at line 142.  In include/asm-arm/arch-pxa/pxa-regs.h, fix at line #define GPLR(x) (*((((x) & 0x7f) < 96) ? &_GPLR(x) : GPLR3)) #define GPDR(x) (*((((x) & 0x7f) < 96) ? &_GPDR(x) : GPDR3)) #define GPSR(x) (*((((x) & 0x7f) < 96) ? &_GPSR(x) : GPSR3)) #define GPCR(x) (*((((x) & 0x7f) < 96) ? &_GPCR(x) : GPCR3)) #define GRER(x) (*((((x) & 0x7f) < 96) ? &_GRER(x) : GRER3)) #define GFER(x) (*((((x) & 0x7f) < 96) ? &_GFER(x) : GFER3)) #define GEDR(x) (*((((x) & 0x7f) < 96) ? &_GEDR(x) : GEDR3)) #define GAFR(x) (*((((x) & 0x7f) < 96) ? &_GAFR(x) : ((((x) & 0x7f) < 112) ? &GAFR3_L : &GAFR3_U))) #else 2014/12/9/ 26 18

Lab 11 Department of Computer Science and Information Engineering National Taiwan University  Disable the warning “target CPU does not support interworking” when compiling.  % vim cpu/pxa/config.mk  PLATFORM_CPPFLAGS +=$(call cc-option,-mapcs-32,-mabi=apcs-gnu)  PLATFORM_CPPFLAGS +=$(call cc-option,-mno-thumb-interwork,)  PLATFORM_RELFLAGS +=$(call cc-option,-mshort-load-bytes,$(call …)  After the modification, please use the new toolchain as in slide 10 to compile this U-Boot and copy it to PXA270.slide 10  You can refer to Lab /12/9/ 26 19

Lab 11 Department of Computer Science and Information Engineering National Taiwan University  Now we would like to automatically compile the U-Boot by Buildroot, so we have to create a patch.  Use diff command to create the file containing the differences between U-Boot and modified one.  Use man diff command to see the meaning of the options.  % diff -Naur >.patch  Tip  Use make distclean command to delete all generated files, configures and temporary files before creating patch. 2014/12/9/ 26 20

Lab 11 Department of Computer Science and Information Engineering National Taiwan University  Step 1: add your U-Boot information to Buildroot configuration.  % cd buildroot  % vim boot/uboot/Config.in … config BR2_TARGET_UBOOT_1_2_0 bool"1.2.0" … config BR2_TARGET_UBOOT_VERSION string … default "1.2.0"if BR2_TARGET_UBOOT_1_2_0  Step 2: put u-boot tar.bz2 into dl/ directory.  Step 3: put your patch into specific directory.  % mkdir -p board/ /u-boot patches  % cp.patch board/ /u-boot patches/uboot pxa270.patch 2014/12/9/ 26 21

Lab 11 Department of Computer Science and Information Engineering National Taiwan University  Step 4: configure Buildroot. Bootloaders  U-Boot = checked U-Boot board name = mtcr270 U-Boot Version = custom patch dir = board/ /u-boot patches  Step 5: compile.  The resulting u-boot.bin is in output/images/.  Tip  The name of the patch is determined by support/scripts/apply-patches.sh. 2014/12/9/ 26 22

Lab 11 Department of Computer Science and Information Engineering National Taiwan University  Add an open-source software “tetris” to Buildroot.tetris  You need to use Lab3’s arm-unknown-linux-gnu-* toolchain to compile tetris.  However, Buildroot’s external toolchain option does not work.  For simplicity, you can set tetris’s cross compiler directly.  Do not forget to compile tetris as statically linked. 2014/12/9/ 26 23

Lab 11 Department of Computer Science and Information Engineering National Taiwan University  Step 1: create a new directory in the package directory.  % cd buildroot  % mkdir package/ /  Step 2: make your package available upon configuration.  % cd package  % vim / /Config.in  config BR2_PACKAGE_  bool " "  default n  % vim Config.in  source "package/ / /Config.in"  The position where you insert the reference to your packages decides where the entry in menu system is going to be later on. 2014/12/9/ 26 24

Lab 11 Department of Computer Science and Information Engineering National Taiwan University  Step 3: create a Buildroot package Makefile.  % vim / /.mk  Please refer to Atmel’s document.Atmel’s document 2014/12/9/ 26 25

Lab 11 Department of Computer Science and Information Engineering National Taiwan University  Port “U-Boot-1.2.0” to PXA270. You have to use Buildroot to build.  Port “Tetris” to Buildroot. 2014/12/9/ 26 26