Presentation is loading. Please wait.

Presentation is loading. Please wait.

1 系統晶片 SOC 與嵌入 式系統 Linux 開發工具 介紹與操作實習 華亨科技 王祈翔. 2 Outline Basic Concepts Building Development Environment XSBase255B Bootloader XSBase255B Linux kernel.

Similar presentations


Presentation on theme: "1 系統晶片 SOC 與嵌入 式系統 Linux 開發工具 介紹與操作實習 華亨科技 王祈翔. 2 Outline Basic Concepts Building Development Environment XSBase255B Bootloader XSBase255B Linux kernel."— Presentation transcript:

1 1 系統晶片 SOC 與嵌入 式系統 Linux 開發工具 介紹與操作實習 華亨科技 王祈翔

2 2 Outline Basic Concepts Building Development Environment XSBase255B Bootloader XSBase255B Linux kernel XSBase255B Filesystem OS Porting

3 3 Outline Basic Concepts Building Development Environment XSBase255B Bootloader XSBase255B Linux kernel XSBase255B Filesystem OS Porting

4 4 Cross-Development Environment Target has limited resource (memory, storage, low speed processor). Host and Target are different architecture. Cross-platform Development Environment Host Bootloader Kernel Root Filesystem Target

5 5 Create Target Linux System A target Linux system is created by configuring and bundling together the appropriate system components. Programming and development aspects are a separate subject There are four main steps to creating a target Linux system:  Determine system components  Configure and build the kernel  Build root filesystem  Set up boot software and configuration

6 6 System Boot Flow

7 7 What we need are : Cross-Platform development toolchain Bootloader  Provide by vendor Linux kernel  Linux kernel + some patches if needed Filesystem  Busybox  Device node  Configuration

8 8 Outline Basic Concepts Building Development Environment XSBase255B Bootloader XSBase255B Linux kernel XSBase255B Filesystem OS Porting

9 9 Environment

10 10 HOST PC Environment  BOOTP 、 TFTP and NFS Service  bootp-2.4.3-7.i386.rpm  tftp-server-0.17-9.i386.rpm  Cross Comipler  GNU gcc compilers for C, C++  GNU binutil  GNU C Library  GNU C header  GNU Make

11 11 BOOTP 、 TFTP and NFS Service BOOTP Service  bootp-2.4.3-7.i386.rpm

12 12 BOOTP 、 TFTP and NFS Service TFTP Service  tftp-server-0.17-9.i386.rpm

13 13 BOOTP 、 TFTP and NFS Service NFS Service

14 14 Tool Chain ARM-Linux Development Environment  Binutils-2.11.gz  Gcc-2.95.3.gz  Glibc-2.2.3.gz  Linux-2.4.18.tar.gz  Patch-2.4.18-rmk7.gz

15 15 Makefile 多個原始檔在同一個 project 的問題  更改一個 header 檔案,有 include 此檔的原始檔 必需重新編譯,反之則不需要 Make 工具可以針對每個原始檔之間的相依 關係來解決這樣的問題 http://www.study-area.org/cyril/opentools/ http://www.study-area.org/cyril/opentools/ opentools/makefile.html

16 16 Outline Basic Concepts Building Development Environment XSBase255B Bootloader XSBase255B Linux kernel XSBase255B Filesystem OS Porting

17 17 Bootloader

18 18 The Bootloader's Job One main mission: load the operating system(s). Tasks: Initialize the machine properly (the kernel can do part of this later too). Access the kernel and initrd files in their storage medium (need to support the corresponding filesystem too) Because of the above 2 tasks, bootloaders are often platform specific! Load the kernel and initrd files Execute the kernel file with the right command line

19 19 2-stage Bootloaders At startup, the hardware automatically executes the bootloader from a given location, usually with very little space (such as the boot sector on a PC hard disk) Because of this lack of space, 2 stages are implemented:  1 st stage: minimum functionality. Just accesses the second stage on a bigger location and executes it.  2 nd stage: offers the full bootloader functionality. No limit in what can be implemented. Can even be an operating system itself!

20 20 Some Bootloaders LILO: LInux LOad. Original Linux bootloader. Still in use!  http://freshmeat.net/projects/lilo/  Supports: x86 GRUB: GRand Unified Bootloader from GNU. More powerful.  http://www.gnu.org/software/grub/  Supports: x86 LinuxBIOS: Linux based BIOS replacement  http://www.linuxbios.org/  Supports: x86

21 21 Some Bootloaders (cont.) UBoot: Universal Bootloader. The most used on arm.  http://uboot.sourceforge.net/  Supports: arm, ppc, mips, x86 RedBoot: eCos based bootloader from RedHat  http://sources.redhat.com/redboot/  Supports: x86, arm, ppc, mips, sh, m68k...

22 22 Outline Basic Concepts Building Development Environment XSBase255B Bootloader XSBase255B Linux kernel XSBase255B Filesystem OS Porting

23 23 XSBase255B Linux kernel 如何設定 Kernel 各個目錄的關係和內容 配置 Makefile 和 config.in 加入程式到 Kernel 中

24 24 Kernel 目錄結構 /usr/src/linux uname – r 可察看 kernel 版本 arch 目錄  包含所有體系結構相關的 kernel 程式  我們所使用的將是 arm 的體系架構 include 目錄  header 檔存放處  我們所使用的 header 檔存放在 asm-arm 下

25 25 Kernel 目錄結構 init 目錄  Kernel 的初始化程式  研究 kernel 程式的起點 mm 目錄  記憶體管理相關 kernel 目錄  Kernel 的系統函式

26 26 Kernel 目錄結構 drivers 目錄  驅動程式存放處 lib 目錄  Library 存放處

27 27 Kernel 的 Makefile 和 config.in Kernel 的系統配置由三個部份組成  Makefile  Config.in  配置工具 ( 圖形介面, 用戶配置 … )

28 28 Makefile Makefile 將會遞回進入到 kernel 的各個子目 錄中, 分別調用這些子目錄中的 Makefile Include arch/$(ARCH)/Makefile 將指明特定 的 CPU 結構

29 29 Config.in 系統配置腳本 把隨選功能加入 Linux 的配置選項 Makefile 會調用 scripts/Configure 並按照 arch/arm/config.in 來進行配置 命令執行完後會產生.config 檔

30 30 Kernel 各項配置介紹 環境設置  Menuconfig 使用  Make menuconfig

31 31 System Type 請選擇 PXA255 系列的 CPU 格式

32 32 PCMCIA/CardBus Support

33 33 RAM/ROM Flash Chip drivers

34 34 Mapping drivers for chip access

35 35 Ethernet (10 or 100Mbit) CS8900 support  支援 XSCALE PXA255 Ethernet

36 36 Console drivers Support for frame buffer devices PXA LCD support

37 37 Add Driver 在 Kernel 中新增 function 三步驟  將開發的程式放入 kernel 中  新增至配置選項  建立子目錄之 Makefile

38 38 Step1 在 drivers 目錄下新增一目錄以及 Makefile, config.in 修改上層的 config.in 修改上層的 Makefile 確保初始化函數有被調用到  直接 buildin 在 kernel 中  利用掛載 / 卸載方式

39 39 Step2 drivers/test/Config.in arch/arm/config.in  在檔的最後加入 source drivers/test/Config.in

40 40 Step3 編寫 makefile (drivers/test/Makefile)

41 41 Modify Makefile drivers/Makefile Makefile

42 42 Step4 $make menuconfig $make dep $make zImage

43 43 Outline Basic Concepts Building Development Environment XSBase255B Bootloader XSBase255B Linux kernel XSBase255B Filesystem OS Porting

44 44 Filesystem Design 使用簡單方便 安全可靠 即時回應 介面開放性和可移植性 可伸縮性和配置性 開放的體系架構 資源有效性 功能完整性

45 45 Filesystem Type Extfs Ext2fs Jffs Jffs2 Cramfs

46 46 MTD Support

47 47 RAM/ROM/Flash chip drivers

48 48 Mapping drivers for chip access

49 49 RAMDISK Support

50 50 Filesystem Format Jffs2

51 51 Creat Filesystem Image 切換到正確的 File System 目錄  Filesystem/ 利用 mkfs.jffs2 工具將指定目錄壓縮 ./mkfs.jffs2 – o rootfs.img – e 0x40000 – r root_XSBase255B – p -l

52 52 Outline Basic Concepts Building Development Environment XSBase255B Bootloader XSBase255B Linux kernel XSBase255B Filesystem OS Porting

53 53 Burn Bootloader via JTAG./Jflash-XSBASE x-boot255 XSCALE-R1 Copyright (C) 2004 Chhnet Co,. ltd. Support: http://www.hhnet.com.tw Autoboot in progress, press any key to stop. Autoboot aborted Type "help" to get a list of commands XSBASE> ……….

54 54 Load Kernel & Filesystem XSBASE> tftp zImage kernel XSBASE> flash kernel XSBASE> tftp rootfs.img root XSBASE> flash root

55 55 OS Porting Demo

56 56 THE END Thank you.


Download ppt "1 系統晶片 SOC 與嵌入 式系統 Linux 開發工具 介紹與操作實習 華亨科技 王祈翔. 2 Outline Basic Concepts Building Development Environment XSBase255B Bootloader XSBase255B Linux kernel."

Similar presentations


Ads by Google