SlideShare ist ein Scribd-Unternehmen logo
1 von 39
Embedded System on SD

Vincent Chen
Annie Cheng
YuChin Huang
Jason Kung
2013-09-18
Motivation
Typically, most embedded systems load system from NAND flash on the target
device. That means the boot loader, kernel and file system are fused on the NAND
flash.
However, in the beginning stage of implementation, the NAND flash is totally empty,
which means, at least, we have to fuse boot loader into the NAND flash, and then
fuse kernel and file system to bring up the system.

To fuse the boot loader into NAND flash is not easy as just copy a file. We have to
use specific tools like chip programmer or JTAG. Some of these tools are
expensive or not easy to get. Users also need to wait patiently while programming
a NAND flash because it takes time. Frequently programming NAND flash also
impacts its endurance due to its physical character. Thus, if we can find a way to
build a system on other external storage device, like SD card, it would be save a lot
of time, cost, and even NAND flash life cycle.
Embedded System (boot from NAND)

SD I/F

Boot Loader

CPU
Memory
controller

NAND flash
controller

Kernel

Memory

NAND
File System
Embedded System (SD recovery mode)

SD I/F

Boot Loader
SD / SDHC

CPU
Memory
controller

NAND flash
controller

Kernel

Memory

NAND
File System
Embedded System (boot from SD)

SD I/F

Boot Loader
SD / SDHC

CPU
Memory
controller

NAND flash
controller

Kernel

Memory

NAND
File System
Purpose
- Build the embedded system on SD card
- Loading system from SD card completely without NAND flash support.
- The file system on SD card supports read and write facility.
- Implement a utility to fuse boot loader, kernel and file system to SD card easily.

Replace boot from NAND
Load u-boot
Loader Kernel
Load File system
File system readable / writable












Benefits
- System is easy to recover/update
just simply replace the SD card.

- Cost down
NAND/NOR flash become optional, not a necessary component anymore.
It saves BOM cost.

- Product in test stage
Modify/update codes easily.

- Multi-OS in one device
Switch OS among different SD cards.
Platform - DMA6410L
- AP: Samsung S3C6410XH-66, 667Mhz
- RAM: mDDR 128MB (64MB * 2)
- Ethernet I/F: DM9000AE

- Display: 4.3” TFT (480*272)
- UART: UART * 1 (for debug)
- SD card I/F: SD card slot * 1
How …
To achieve system on SD card, we will face the following issues,

- CPU supports boot from SD card. How does it work?

- An embedded system has three parts: u-boot (boot loader), kernel and file system.
We have to know the exact position in SD card.

- SD card has SDSC (Standard-Capacity), SDHC (High-Capacity) and SDXC
(eXtended-Capacity.) Does all of them can be supported by CPU?

- How to make the boot loader loads kernel and than kernel loads file system
exactly?
Boot Loader (u-boot)
S3C6410 iROM booting
S3C6410
ARM1176JZF-S

SDRAM
Controller

SDRAM
Booting Device
(SD/MMC Card,
OneNAND, Nand)

Stepping
Stone (8KB)

iROM(BL0)
(32KB)

OM=iROM Boot

HS-MMC
Controller

BL2

Kernel

OneNAND
Controller

D-TCM (16KB)

BL1
(8KB)

File
System

NAND
Controller

GPN[15:13]:Booting
device pin selection

1.iROM supports initial boot up
Initialize system clock, D-TCM,
device specific controller and
booting device.
S3C6410 iROM booting

(cont.)

S3C6410
ARM1176JZF-S

SDRAM
Controller

SDRAM
Booting Device
(SD/MMC Card,
OneNAND, Nand)

Stepping
Stone (8KB)

iROM(BL0)
(32KB)

OM=iROM Boot

HS-MMC
Controller

BL2

Kernel

OneNAND
Controller

D-TCM (16KB)

BL1
(8KB)

File
System

NAND
Controller

GPN[15:13]:Booting
device pin selection

2.iROM boot codes can load 8KB of
boot loader to stepping stone.
The 8 KB boot loader is called
BL1.
S3C6410 iROM booting

(cont.)

S3C6410
ARM1176JZF-S

SDRAM
Controller

SDRAM
Booting Device
(SD/MMC Card,
OneNAND, Nand)

Stepping
Stone (8KB)

iROM(BL0)
(32KB)

OM=iROM Boot

HS-MMC
Controller

BL2

Kernel

OneNAND
Controller

D-TCM (16KB)

BL1
(8KB)

File
System

NAND
Controller

GPN[15:13]:Booting
device pin selection

3.BL1 can initialize system clock,
UART, and SDRAM for user.
After initializing, BL1 will load the
remaining boot loader called BL2
to SDRAM.
S3C6410 iROM booting

(cont.)

S3C6410
ARM1176JZF-S

SDRAM
Controller

SDRAM
Booting Device
(SD/MMC Card,
OneNAND, Nand)

Stepping
Stone (8KB)

iROM(BL0)
(32KB)

OM=iROM Boot

HS-MMC
Controller

BL2

Kernel

OneNAND
Controller

D-TCM (16KB)

BL1
(8KB)

File
System

NAND
Controller

GPN[15:13]:Booting
device pin selection

4.Finally, jump to start address of
BL2. That will make good
environment to use system.
SD/SDHC Device Block Assignment

1 Block = 512 bytes

SD/MMC Device
File System

Kernel

BL2

BL1

Signature

Reserved

(4MB)

(256KB)

(8KB)

(512B)

(512B)

8192

512

16

1

1
Last

1 Block = 512 bytes

SDHC Device
File System

Kernel
(4MB)

BL2
(256KB)

8192

512

BL1 Signature
(8KB) (1024B)
16

2

Skipped
(512KB)
1024
Last
For Instance …
2 GB SD

4 GB SDHC

2,021,654,528 bytes
3,958,544 blocks

3,965,190,144 bytes
7,744,512 blocks

File System

File System

3,939,822

7,734,766
Kernel

Kernel

8,192 blocks

3,948,014
BL2

BL2

512 blocks

3,948,526

8,192 blocks

7,742,958

512 blocks

7,743,470
BL1

BL1
16 blocks

3,958,542

3,958,544

16 blocks

7,743,486

Last
2 blocks
1 Block = 512 bytes

7,744,488
7,744,512

Last
Skipped

2 blocks
1,024 blocks
1 Block = 512 bytes
Screenshot (boot from 2G SD)
2 GB SD
2,021,654,528 bytes
3,958,544 blocks

File System

2GB SD
3,939,822
Kernel

8,192 blocks

3,948,014
BL2

512 blocks

3,948,526
BL1

16 blocks

3,958,542

3,958,544

Last
2 blocks
1 Block = 512 bytes
Screenshot (boot from 4G SD)
4 GB SDHC
3,965,190,144 bytes
7,744,512 blocks

File System

4GB SD
7,734,766
Kernel

8,192 blocks

7,742,958
BL2

512 blocks

7,743,470
BL1

16 blocks

7,743,486
7,744,488
7,744,512

Last
Skipped

2 blocks
1,024 blocks
1 Block = 512 bytes
smdk6410.h
Bootloaderu-bootincludeconfigssmdk6410.h
/***********************************************************
* Command definition
***********************************************************/
#define CONFIG_COMMANDS

(CONFIG_CMD_DFL
| 
CFG_CMD_CACHE
| 
CFG_CMD_USB
| 
CFG_CMD_REGINFO
| 
Add CFG_CMD_MOVINAND
CFG_CMD_LOADS
| 
CFG_CMD_LOADB
| 
to make u-boot supports
CFG_CMD_ENV
| 
movinand (SD/MMC)
CFG_CMD_NAND
| 
CFG_CMD_MOVINAND
| 
CFG_CMD_RUN
| 
CFG_CMD_DATE
| 
CFG_CMD_PING
| 
CFG_CMD_ELF)

& ~(CFG_CMD_AUTOSCRIPT
| 
CFG_CMD_BOOTD
| 
CFG_CMD_IMI
| 
CFG_CMD_CONSOLE | 
0)
smdk6410.h

(cont.)

Bootloaderu-bootincludeconfigssmdk6410.h
/* Boot configuration (define only one of next 3) */
//#define CONFIG_BOOT_NOR
// #define CONFIG_BOOT_NAND
Make u-boot boots from
#define CONFIG_BOOT_MOVINAND
movinand
//#define CONFIG_BOOT_ONENAND
//#define CONFIG_BOOT_ONENAND_IROM

#define CONFIG_NAND
//#define CONFIG_ONENAND
#define CONFIG_MOVINAND
//#define CONFIG_MMC
//#define CONFIG_MMC_S3C
//#define CFG_MMC_BASE
//#define CFG_MMC_BASE

1
1
0xff000000
0xf0000000

bootcmd setting
#elif defined(CONFIG_BOOT_MOVINAND)
#define CFG_ENV_IS_IN_MOVINAND
#define CONFIG_BOOTCOMMAND "movi read zImage c0008000;bootm c0008000"
movi.h
Bootloaderu-bootincludemovi.h
#if defined(CONFIG_S3C2450) || defined(CONFIG_S3C2416)
#define HSMMC_CHANNEL
1
Define HSMMC_CHANNEL
#else
#define HSMMC_CHANNEL
1
//0-->TF 1--> SD
#endif

/* offset information */
#define PART_UBOOT_OFFSET
#define PART_ZIMAGE_OFFSET
#define PART_ROOTFS_OFFSET
#define PART_EXTRA_OFFSET

/* movinand definitions */
#define MOVI_BLKSIZE

0x0
0x40000
0x440000
0x3200000

512

Offset in movinand (SD card)

**refer page 16
Block size definition
1 block = 512 bytes
movi.h

(cont.)

Bootloaderu-bootincludemovi.h
#define
#define
#define
#define

MOVI_LAST_BLKPOS
MOVI_BL1_BLKCNT
MOVI_ENV_BLKCNT
MOVI_BL2_BLKCNT

#define MOVI_ZIMAGE_BLKCNT
#define MOVI_BL2_POS
#define MOVI_ROOTFS_BLKCNT

(MOVI_TOTAL_BLKCNT - (eFUSE_SIZE / MOVI_BLKSIZE))
(SS_SIZE / MOVI_BLKSIZE)
(CFG_ENV_SIZE / MOVI_BLKSIZE)
(((PART_ZIMAGE_OFFSET - PART_UBOOT_OFFSET) /
MOVI_BLKSIZE) - MOVI_ENV_BLKCNT)
((PART_ROOTFS_OFFSET - PART_ZIMAGE_OFFSET) /
MOVI_BLKSIZE)
(MOVI_LAST_BLKPOS - MOVI_BL1_BLKCNT –
MOVI_BL2_BLKCNT - MOVI_ENV_BLKCNT)
8 * 1024 * 1024 / MOVI_BLKSIZE
//(PART_SIZE_ROOTFS / MOVI_BLKSIZE)

According to the formulas above, we can easily calculate the exact position of each
segment.
(you can check the following excel file to get more detailed information.)

**refer page 16
hs_mmc.c
Bootloaderu-bootcpus3c64xxhs_mmc.c
int hsmmc_init (void)
{
u32 reg;
uint width;

issue_command(MMC_GO_IDLE_STATE, 0x00, 0, 0);

issue_command(MMC_SEND_EXT_CSD, 0x000001AA, 0, MMC_RSP_R1);

Add this statement to initial
SDHC

/* MMC_SET_BLOCKLEN */
while (!issue_command(MMC_SET_BLOCKLEN, 512, 0, MMC_RSP_R1));
s3c_hsmmc_writew(0xffff, HM_NORINTSTS);
return 0;
}
Kernel (zImage)
Kernel Configuration
Kernel Configuration (cont.)
Kernel Configuration (cont.)
Kernel Configuration (cont.)
Environment Setting - bootcmd
setenv bootcmd “movi read zImage c0008000;bootm c0008000”
**refer page 21
File System
Environment Setting - bootargs
setenv bootargs “root=/dev/mmcblk0p2 rootfstype=ext3 rootdelay=3 init=/linuxrc
console=ttySAC0,115200”
**set bootargs at smdk6410.h
Screenshot
Note: The root file system is pre-built in SD card.
Fusing Tool
Fusing Tool
To fuse the boot loader (u-boot.bin), kernel (zImage), and file system (rootfs.tar) to
SD card automatically.
sdcard=$1
if [ "$sdcard" = "" ];then
echo " # Usage - ./sd.sh /dev/SDcardDevicename (ex. sd.sh /dev/sdc)"
echo " # prepare the necessary files(zImage,rootfs.tar,uboot.bin
rootfs.tar is a tar.bz2 file)"
echo " # and verify that the device is correct"
exit 0

.
mkdir /mnt1
mount ${sdcard}2 /mnt1
tar -jxvf rootfs.tar -C /mnt1
cp -rap /mnt/rootfs/* /mnt1
umount /mnt1
rm -rf /mnt1
How to use the fusing tool
root@Linux:~# ./sd4.sh /dev/sdc

1. Run the shell script “sd4.sh” as root.
2. Assign the block device where the SD card exists (ex. /dev/sdc).
3. The root file system has to be packed as rootfs.tar before running this shell
script.
4. The boot loader (u-boot.bin), kernel (zImage) and the file system (rootfs.tar)
must exist in the same folder.
5. The name of the files u-boot.bin, zImage, and rootfs.tar are fixed, casesensitive.
How the shell script works
step

command

1. Check the device user enters exists and make sure it is an SD card.
2. Partition the device (two partitions will be made).

fdisk

3. Format the second partition as ext3.

mkfs.ext3

4. Fuse the first 8k of u-boot.bin to the BL1 area of the SD card.

dd

5. Fuse the u-boot.bin to the BL2 area of he SD card.
(u-boot.bin has to be smaller than 256KB)

dd

6. Fuse the zImage to the kernel area of he SD card.

dd

7. Make a directory named /mnt1 as the mount point

mkdir

8. Mount the second partition (ext3) to the mount point (/mnt1).

mount

9. Extract rootfs.tar to /mnt1

Tar

10. Un-mount the mount point (/mnt1)

umount

11. Delete the mount point (/mnt1)

rm
Member Introduction
Member Introduction
Name

Education
Background

Tasks of the project

Working
Experience

Vincent Chen
(Team Leader)

Lan Yang Institute of Technology
BS. Electronics Engineering

- Kernel implement:
- MTD support
- MMC/SD card support
- Kernel logo display

- R&D Engineer
(Electric Meters)
- Field Application Engineer

Annie Cheng

Ming Hsin University of Science and
Technology
BS. In Electronic Engineering

- Hardware layout tracing for
SD/SDHC boot
- Documentation

- Senior Validation Engineer
(CPU Electrical / Margining)
- System Validation Test
Engineer

YiChin Huang

Chih Lee Institute of Technology
BS. in Information Management

- U-boot support SDHC
implement
- SD card fusing tool implement

Jason Kung

Texas A&M University - Commerce
MS. In Computer Science
MS. In Management

- U-boot support SD implement
- Kernel, File System
(ext3, readable/writable)on SD

- Field Application Engineer
(ARM Application Processor)
- Product Manager
(ARM Application Processor)
Thank You

Weitere ähnliche Inhalte

Was ist angesagt?

[B11] 基礎から知るSSD(いまさら聞けないSSDの基本) by Hironobu Asano
[B11] 基礎から知るSSD(いまさら聞けないSSDの基本) by Hironobu Asano[B11] 基礎から知るSSD(いまさら聞けないSSDの基本) by Hironobu Asano
[B11] 基礎から知るSSD(いまさら聞けないSSDの基本) by Hironobu Asano
Insight Technology, Inc.
 
Linux Memory Management
Linux Memory ManagementLinux Memory Management
Linux Memory Management
Ni Zo-Ma
 

Was ist angesagt? (20)

Tensorflow lite for microcontroller
Tensorflow lite for microcontrollerTensorflow lite for microcontroller
Tensorflow lite for microcontroller
 
La carte mère
La carte mèreLa carte mère
La carte mère
 
Kernel Recipes 2017 - Understanding the Linux kernel via ftrace - Steven Rostedt
Kernel Recipes 2017 - Understanding the Linux kernel via ftrace - Steven RostedtKernel Recipes 2017 - Understanding the Linux kernel via ftrace - Steven Rostedt
Kernel Recipes 2017 - Understanding the Linux kernel via ftrace - Steven Rostedt
 
[B11] 基礎から知るSSD(いまさら聞けないSSDの基本) by Hironobu Asano
[B11] 基礎から知るSSD(いまさら聞けないSSDの基本) by Hironobu Asano[B11] 基礎から知るSSD(いまさら聞けないSSDの基本) by Hironobu Asano
[B11] 基礎から知るSSD(いまさら聞けないSSDの基本) by Hironobu Asano
 
Qemu Pcie
Qemu PcieQemu Pcie
Qemu Pcie
 
Kernel Recipes 2018 - Overview of SD/eMMC, their high speed modes and Linux s...
Kernel Recipes 2018 - Overview of SD/eMMC, their high speed modes and Linux s...Kernel Recipes 2018 - Overview of SD/eMMC, their high speed modes and Linux s...
Kernel Recipes 2018 - Overview of SD/eMMC, their high speed modes and Linux s...
 
0章 Linuxカーネルを読む前に最低限知っておくべきこと
0章 Linuxカーネルを読む前に最低限知っておくべきこと0章 Linuxカーネルを読む前に最低限知っておくべきこと
0章 Linuxカーネルを読む前に最低限知っておくべきこと
 
Memory model
Memory modelMemory model
Memory model
 
MemVerge: The Software Stack for CXL Environments
MemVerge: The Software Stack for CXL EnvironmentsMemVerge: The Software Stack for CXL Environments
MemVerge: The Software Stack for CXL Environments
 
Tegra 186のu-boot & Linux
Tegra 186のu-boot & LinuxTegra 186のu-boot & Linux
Tegra 186のu-boot & Linux
 
ARM Trusted FirmwareのBL31を単体で使う!
ARM Trusted FirmwareのBL31を単体で使う!ARM Trusted FirmwareのBL31を単体で使う!
ARM Trusted FirmwareのBL31を単体で使う!
 
BlueStore, A New Storage Backend for Ceph, One Year In
BlueStore, A New Storage Backend for Ceph, One Year InBlueStore, A New Storage Backend for Ceph, One Year In
BlueStore, A New Storage Backend for Ceph, One Year In
 
PSoCまつり「PSoCの美味しい料理法」
PSoCまつり「PSoCの美味しい料理法」PSoCまつり「PSoCの美味しい料理法」
PSoCまつり「PSoCの美味しい料理法」
 
Innodb에서의 Purge 메커니즘 deep internal (by 이근오)
Innodb에서의 Purge 메커니즘 deep internal (by  이근오)Innodb에서의 Purge 메커니즘 deep internal (by  이근오)
Innodb에서의 Purge 메커니즘 deep internal (by 이근오)
 
Introduction to Linux Kernel by Quontra Solutions
Introduction to Linux Kernel by Quontra SolutionsIntroduction to Linux Kernel by Quontra Solutions
Introduction to Linux Kernel by Quontra Solutions
 
Q4.11: Introduction to eMMC
Q4.11: Introduction to eMMCQ4.11: Introduction to eMMC
Q4.11: Introduction to eMMC
 
Linux Memory Management
Linux Memory ManagementLinux Memory Management
Linux Memory Management
 
BIOS, Linux and Firmware Test Suite in-between
BIOS, Linux and  Firmware Test Suite in-betweenBIOS, Linux and  Firmware Test Suite in-between
BIOS, Linux and Firmware Test Suite in-between
 
Linux Performance Analysis and Tools
Linux Performance Analysis and ToolsLinux Performance Analysis and Tools
Linux Performance Analysis and Tools
 
Memory management
Memory managementMemory management
Memory management
 

Ähnlich wie 建構嵌入式Linux系統於SD Card

Comp 129 final exam 100% correct answers
Comp 129 final exam 100% correct answersComp 129 final exam 100% correct answers
Comp 129 final exam 100% correct answers
ProfessorLance
 
Comp 129 final exam 100% correct answers
Comp 129 final exam 100% correct answersComp 129 final exam 100% correct answers
Comp 129 final exam 100% correct answers
ProfessorLance
 
Embedded_Linux_Booting
Embedded_Linux_BootingEmbedded_Linux_Booting
Embedded_Linux_Booting
Rashila Rr
 

Ähnlich wie 建構嵌入式Linux系統於SD Card (20)

Bringing up Android on your favorite X86 Workstation or VM (AnDevCon Boston, ...
Bringing up Android on your favorite X86 Workstation or VM (AnDevCon Boston, ...Bringing up Android on your favorite X86 Workstation or VM (AnDevCon Boston, ...
Bringing up Android on your favorite X86 Workstation or VM (AnDevCon Boston, ...
 
Comp 129 final exam 100% correct answers
Comp 129 final exam 100% correct answersComp 129 final exam 100% correct answers
Comp 129 final exam 100% correct answers
 
Comp 129 final exam 100% correct answers
Comp 129 final exam 100% correct answersComp 129 final exam 100% correct answers
Comp 129 final exam 100% correct answers
 
Bootstrap process of u boot (NDS32 RISC CPU)
Bootstrap process of u boot (NDS32 RISC CPU)Bootstrap process of u boot (NDS32 RISC CPU)
Bootstrap process of u boot (NDS32 RISC CPU)
 
U-Boot Porting on New Hardware
U-Boot Porting on New HardwareU-Boot Porting on New Hardware
U-Boot Porting on New Hardware
 
Armboot process zeelogic
Armboot process zeelogicArmboot process zeelogic
Armboot process zeelogic
 
U-Boot presentation 2013
U-Boot presentation  2013U-Boot presentation  2013
U-Boot presentation 2013
 
eMMC Embedded Multimedia Card overview
eMMC Embedded Multimedia Card overvieweMMC Embedded Multimedia Card overview
eMMC Embedded Multimedia Card overview
 
U Boot or Universal Bootloader
U Boot or Universal BootloaderU Boot or Universal Bootloader
U Boot or Universal Bootloader
 
Когда предрелизный не только софт
Когда предрелизный не только софтКогда предрелизный не только софт
Когда предрелизный не только софт
 
BeagleBone Black Booting Process
BeagleBone Black Booting ProcessBeagleBone Black Booting Process
BeagleBone Black Booting Process
 
COMPUTER HARDWARE - SHORT NOTES
COMPUTER HARDWARE - SHORT NOTESCOMPUTER HARDWARE - SHORT NOTES
COMPUTER HARDWARE - SHORT NOTES
 
BeagleBoard-xM Booting Process
BeagleBoard-xM Booting ProcessBeagleBoard-xM Booting Process
BeagleBoard-xM Booting Process
 
Embedded_Linux_Booting
Embedded_Linux_BootingEmbedded_Linux_Booting
Embedded_Linux_Booting
 
Study on Android Emulator
Study on Android EmulatorStudy on Android Emulator
Study on Android Emulator
 
HKG15-409: ARM Hibernation enablement on SoCs - a case study
HKG15-409: ARM Hibernation enablement on SoCs - a case studyHKG15-409: ARM Hibernation enablement on SoCs - a case study
HKG15-409: ARM Hibernation enablement on SoCs - a case study
 
SiteGround Tech TeamBuilding
SiteGround Tech TeamBuildingSiteGround Tech TeamBuilding
SiteGround Tech TeamBuilding
 
BeagleBone Black Bootloaders
BeagleBone Black BootloadersBeagleBone Black Bootloaders
BeagleBone Black Bootloaders
 
Introduction to Computer Hardware slides ppt
Introduction to Computer Hardware slides pptIntroduction to Computer Hardware slides ppt
Introduction to Computer Hardware slides ppt
 
101 1.1 hardware settings
101 1.1 hardware settings101 1.1 hardware settings
101 1.1 hardware settings
 

Mehr von 艾鍗科技

Mehr von 艾鍗科技 (20)

TinyML - 4 speech recognition
TinyML - 4 speech recognition TinyML - 4 speech recognition
TinyML - 4 speech recognition
 
Appendix 1 Goolge colab
Appendix 1 Goolge colabAppendix 1 Goolge colab
Appendix 1 Goolge colab
 
Project-IOT於餐館系統的應用
Project-IOT於餐館系統的應用Project-IOT於餐館系統的應用
Project-IOT於餐館系統的應用
 
02 IoT implementation
02 IoT implementation02 IoT implementation
02 IoT implementation
 
Tiny ML for spark Fun Edge
Tiny ML for spark Fun EdgeTiny ML for spark Fun Edge
Tiny ML for spark Fun Edge
 
Openvino ncs2
Openvino ncs2Openvino ncs2
Openvino ncs2
 
Step motor
Step motorStep motor
Step motor
 
2. 機器學習簡介
2. 機器學習簡介2. 機器學習簡介
2. 機器學習簡介
 
5.MLP(Multi-Layer Perceptron)
5.MLP(Multi-Layer Perceptron) 5.MLP(Multi-Layer Perceptron)
5.MLP(Multi-Layer Perceptron)
 
3. data features
3. data features3. data features
3. data features
 
心率血氧檢測與運動促進
心率血氧檢測與運動促進心率血氧檢測與運動促進
心率血氧檢測與運動促進
 
利用音樂&情境燈幫助放鬆
利用音樂&情境燈幫助放鬆利用音樂&情境燈幫助放鬆
利用音樂&情境燈幫助放鬆
 
IoT感測器驅動程式 在樹莓派上實作
IoT感測器驅動程式在樹莓派上實作IoT感測器驅動程式在樹莓派上實作
IoT感測器驅動程式 在樹莓派上實作
 
無線聲控遙控車
無線聲控遙控車無線聲控遙控車
無線聲控遙控車
 
最佳光源的研究和實作
最佳光源的研究和實作最佳光源的研究和實作
最佳光源的研究和實作
 
無線監控網路攝影機與控制自走車
無線監控網路攝影機與控制自走車無線監控網路攝影機與控制自走車
無線監控網路攝影機與控制自走車
 
Reinforcement Learning
Reinforcement LearningReinforcement Learning
Reinforcement Learning
 
Linux Device Tree
Linux Device TreeLinux Device Tree
Linux Device Tree
 
人臉辨識考勤系統
人臉辨識考勤系統人臉辨識考勤系統
人臉辨識考勤系統
 
智慧家庭Smart Home
智慧家庭Smart Home智慧家庭Smart Home
智慧家庭Smart Home
 

Kürzlich hochgeladen

Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
Joaquim Jorge
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
panagenda
 

Kürzlich hochgeladen (20)

Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 

建構嵌入式Linux系統於SD Card

  • 1. Embedded System on SD Vincent Chen Annie Cheng YuChin Huang Jason Kung 2013-09-18
  • 2. Motivation Typically, most embedded systems load system from NAND flash on the target device. That means the boot loader, kernel and file system are fused on the NAND flash. However, in the beginning stage of implementation, the NAND flash is totally empty, which means, at least, we have to fuse boot loader into the NAND flash, and then fuse kernel and file system to bring up the system. To fuse the boot loader into NAND flash is not easy as just copy a file. We have to use specific tools like chip programmer or JTAG. Some of these tools are expensive or not easy to get. Users also need to wait patiently while programming a NAND flash because it takes time. Frequently programming NAND flash also impacts its endurance due to its physical character. Thus, if we can find a way to build a system on other external storage device, like SD card, it would be save a lot of time, cost, and even NAND flash life cycle.
  • 3. Embedded System (boot from NAND) SD I/F Boot Loader CPU Memory controller NAND flash controller Kernel Memory NAND File System
  • 4. Embedded System (SD recovery mode) SD I/F Boot Loader SD / SDHC CPU Memory controller NAND flash controller Kernel Memory NAND File System
  • 5. Embedded System (boot from SD) SD I/F Boot Loader SD / SDHC CPU Memory controller NAND flash controller Kernel Memory NAND File System
  • 6. Purpose - Build the embedded system on SD card - Loading system from SD card completely without NAND flash support. - The file system on SD card supports read and write facility. - Implement a utility to fuse boot loader, kernel and file system to SD card easily. Replace boot from NAND Load u-boot Loader Kernel Load File system File system readable / writable          
  • 7. Benefits - System is easy to recover/update just simply replace the SD card. - Cost down NAND/NOR flash become optional, not a necessary component anymore. It saves BOM cost. - Product in test stage Modify/update codes easily. - Multi-OS in one device Switch OS among different SD cards.
  • 8. Platform - DMA6410L - AP: Samsung S3C6410XH-66, 667Mhz - RAM: mDDR 128MB (64MB * 2) - Ethernet I/F: DM9000AE - Display: 4.3” TFT (480*272) - UART: UART * 1 (for debug) - SD card I/F: SD card slot * 1
  • 9. How … To achieve system on SD card, we will face the following issues, - CPU supports boot from SD card. How does it work? - An embedded system has three parts: u-boot (boot loader), kernel and file system. We have to know the exact position in SD card. - SD card has SDSC (Standard-Capacity), SDHC (High-Capacity) and SDXC (eXtended-Capacity.) Does all of them can be supported by CPU? - How to make the boot loader loads kernel and than kernel loads file system exactly?
  • 11. S3C6410 iROM booting S3C6410 ARM1176JZF-S SDRAM Controller SDRAM Booting Device (SD/MMC Card, OneNAND, Nand) Stepping Stone (8KB) iROM(BL0) (32KB) OM=iROM Boot HS-MMC Controller BL2 Kernel OneNAND Controller D-TCM (16KB) BL1 (8KB) File System NAND Controller GPN[15:13]:Booting device pin selection 1.iROM supports initial boot up Initialize system clock, D-TCM, device specific controller and booting device.
  • 12. S3C6410 iROM booting (cont.) S3C6410 ARM1176JZF-S SDRAM Controller SDRAM Booting Device (SD/MMC Card, OneNAND, Nand) Stepping Stone (8KB) iROM(BL0) (32KB) OM=iROM Boot HS-MMC Controller BL2 Kernel OneNAND Controller D-TCM (16KB) BL1 (8KB) File System NAND Controller GPN[15:13]:Booting device pin selection 2.iROM boot codes can load 8KB of boot loader to stepping stone. The 8 KB boot loader is called BL1.
  • 13. S3C6410 iROM booting (cont.) S3C6410 ARM1176JZF-S SDRAM Controller SDRAM Booting Device (SD/MMC Card, OneNAND, Nand) Stepping Stone (8KB) iROM(BL0) (32KB) OM=iROM Boot HS-MMC Controller BL2 Kernel OneNAND Controller D-TCM (16KB) BL1 (8KB) File System NAND Controller GPN[15:13]:Booting device pin selection 3.BL1 can initialize system clock, UART, and SDRAM for user. After initializing, BL1 will load the remaining boot loader called BL2 to SDRAM.
  • 14. S3C6410 iROM booting (cont.) S3C6410 ARM1176JZF-S SDRAM Controller SDRAM Booting Device (SD/MMC Card, OneNAND, Nand) Stepping Stone (8KB) iROM(BL0) (32KB) OM=iROM Boot HS-MMC Controller BL2 Kernel OneNAND Controller D-TCM (16KB) BL1 (8KB) File System NAND Controller GPN[15:13]:Booting device pin selection 4.Finally, jump to start address of BL2. That will make good environment to use system.
  • 15. SD/SDHC Device Block Assignment 1 Block = 512 bytes SD/MMC Device File System Kernel BL2 BL1 Signature Reserved (4MB) (256KB) (8KB) (512B) (512B) 8192 512 16 1 1 Last 1 Block = 512 bytes SDHC Device File System Kernel (4MB) BL2 (256KB) 8192 512 BL1 Signature (8KB) (1024B) 16 2 Skipped (512KB) 1024 Last
  • 16. For Instance … 2 GB SD 4 GB SDHC 2,021,654,528 bytes 3,958,544 blocks 3,965,190,144 bytes 7,744,512 blocks File System File System 3,939,822 7,734,766 Kernel Kernel 8,192 blocks 3,948,014 BL2 BL2 512 blocks 3,948,526 8,192 blocks 7,742,958 512 blocks 7,743,470 BL1 BL1 16 blocks 3,958,542 3,958,544 16 blocks 7,743,486 Last 2 blocks 1 Block = 512 bytes 7,744,488 7,744,512 Last Skipped 2 blocks 1,024 blocks 1 Block = 512 bytes
  • 17. Screenshot (boot from 2G SD) 2 GB SD 2,021,654,528 bytes 3,958,544 blocks File System 2GB SD 3,939,822 Kernel 8,192 blocks 3,948,014 BL2 512 blocks 3,948,526 BL1 16 blocks 3,958,542 3,958,544 Last 2 blocks 1 Block = 512 bytes
  • 18. Screenshot (boot from 4G SD) 4 GB SDHC 3,965,190,144 bytes 7,744,512 blocks File System 4GB SD 7,734,766 Kernel 8,192 blocks 7,742,958 BL2 512 blocks 7,743,470 BL1 16 blocks 7,743,486 7,744,488 7,744,512 Last Skipped 2 blocks 1,024 blocks 1 Block = 512 bytes
  • 19. smdk6410.h Bootloaderu-bootincludeconfigssmdk6410.h /*********************************************************** * Command definition ***********************************************************/ #define CONFIG_COMMANDS (CONFIG_CMD_DFL | CFG_CMD_CACHE | CFG_CMD_USB | CFG_CMD_REGINFO | Add CFG_CMD_MOVINAND CFG_CMD_LOADS | CFG_CMD_LOADB | to make u-boot supports CFG_CMD_ENV | movinand (SD/MMC) CFG_CMD_NAND | CFG_CMD_MOVINAND | CFG_CMD_RUN | CFG_CMD_DATE | CFG_CMD_PING | CFG_CMD_ELF) & ~(CFG_CMD_AUTOSCRIPT | CFG_CMD_BOOTD | CFG_CMD_IMI | CFG_CMD_CONSOLE | 0)
  • 20. smdk6410.h (cont.) Bootloaderu-bootincludeconfigssmdk6410.h /* Boot configuration (define only one of next 3) */ //#define CONFIG_BOOT_NOR // #define CONFIG_BOOT_NAND Make u-boot boots from #define CONFIG_BOOT_MOVINAND movinand //#define CONFIG_BOOT_ONENAND //#define CONFIG_BOOT_ONENAND_IROM #define CONFIG_NAND //#define CONFIG_ONENAND #define CONFIG_MOVINAND //#define CONFIG_MMC //#define CONFIG_MMC_S3C //#define CFG_MMC_BASE //#define CFG_MMC_BASE 1 1 0xff000000 0xf0000000 bootcmd setting #elif defined(CONFIG_BOOT_MOVINAND) #define CFG_ENV_IS_IN_MOVINAND #define CONFIG_BOOTCOMMAND "movi read zImage c0008000;bootm c0008000"
  • 21. movi.h Bootloaderu-bootincludemovi.h #if defined(CONFIG_S3C2450) || defined(CONFIG_S3C2416) #define HSMMC_CHANNEL 1 Define HSMMC_CHANNEL #else #define HSMMC_CHANNEL 1 //0-->TF 1--> SD #endif /* offset information */ #define PART_UBOOT_OFFSET #define PART_ZIMAGE_OFFSET #define PART_ROOTFS_OFFSET #define PART_EXTRA_OFFSET /* movinand definitions */ #define MOVI_BLKSIZE 0x0 0x40000 0x440000 0x3200000 512 Offset in movinand (SD card) **refer page 16 Block size definition 1 block = 512 bytes
  • 22. movi.h (cont.) Bootloaderu-bootincludemovi.h #define #define #define #define MOVI_LAST_BLKPOS MOVI_BL1_BLKCNT MOVI_ENV_BLKCNT MOVI_BL2_BLKCNT #define MOVI_ZIMAGE_BLKCNT #define MOVI_BL2_POS #define MOVI_ROOTFS_BLKCNT (MOVI_TOTAL_BLKCNT - (eFUSE_SIZE / MOVI_BLKSIZE)) (SS_SIZE / MOVI_BLKSIZE) (CFG_ENV_SIZE / MOVI_BLKSIZE) (((PART_ZIMAGE_OFFSET - PART_UBOOT_OFFSET) / MOVI_BLKSIZE) - MOVI_ENV_BLKCNT) ((PART_ROOTFS_OFFSET - PART_ZIMAGE_OFFSET) / MOVI_BLKSIZE) (MOVI_LAST_BLKPOS - MOVI_BL1_BLKCNT – MOVI_BL2_BLKCNT - MOVI_ENV_BLKCNT) 8 * 1024 * 1024 / MOVI_BLKSIZE //(PART_SIZE_ROOTFS / MOVI_BLKSIZE) According to the formulas above, we can easily calculate the exact position of each segment. (you can check the following excel file to get more detailed information.) **refer page 16
  • 23. hs_mmc.c Bootloaderu-bootcpus3c64xxhs_mmc.c int hsmmc_init (void) { u32 reg; uint width; issue_command(MMC_GO_IDLE_STATE, 0x00, 0, 0); issue_command(MMC_SEND_EXT_CSD, 0x000001AA, 0, MMC_RSP_R1); Add this statement to initial SDHC /* MMC_SET_BLOCKLEN */ while (!issue_command(MMC_SET_BLOCKLEN, 512, 0, MMC_RSP_R1)); s3c_hsmmc_writew(0xffff, HM_NORINTSTS); return 0; }
  • 29. Environment Setting - bootcmd setenv bootcmd “movi read zImage c0008000;bootm c0008000” **refer page 21
  • 31. Environment Setting - bootargs setenv bootargs “root=/dev/mmcblk0p2 rootfstype=ext3 rootdelay=3 init=/linuxrc console=ttySAC0,115200” **set bootargs at smdk6410.h
  • 32. Screenshot Note: The root file system is pre-built in SD card.
  • 34. Fusing Tool To fuse the boot loader (u-boot.bin), kernel (zImage), and file system (rootfs.tar) to SD card automatically. sdcard=$1 if [ "$sdcard" = "" ];then echo " # Usage - ./sd.sh /dev/SDcardDevicename (ex. sd.sh /dev/sdc)" echo " # prepare the necessary files(zImage,rootfs.tar,uboot.bin rootfs.tar is a tar.bz2 file)" echo " # and verify that the device is correct" exit 0 . mkdir /mnt1 mount ${sdcard}2 /mnt1 tar -jxvf rootfs.tar -C /mnt1 cp -rap /mnt/rootfs/* /mnt1 umount /mnt1 rm -rf /mnt1
  • 35. How to use the fusing tool root@Linux:~# ./sd4.sh /dev/sdc 1. Run the shell script “sd4.sh” as root. 2. Assign the block device where the SD card exists (ex. /dev/sdc). 3. The root file system has to be packed as rootfs.tar before running this shell script. 4. The boot loader (u-boot.bin), kernel (zImage) and the file system (rootfs.tar) must exist in the same folder. 5. The name of the files u-boot.bin, zImage, and rootfs.tar are fixed, casesensitive.
  • 36. How the shell script works step command 1. Check the device user enters exists and make sure it is an SD card. 2. Partition the device (two partitions will be made). fdisk 3. Format the second partition as ext3. mkfs.ext3 4. Fuse the first 8k of u-boot.bin to the BL1 area of the SD card. dd 5. Fuse the u-boot.bin to the BL2 area of he SD card. (u-boot.bin has to be smaller than 256KB) dd 6. Fuse the zImage to the kernel area of he SD card. dd 7. Make a directory named /mnt1 as the mount point mkdir 8. Mount the second partition (ext3) to the mount point (/mnt1). mount 9. Extract rootfs.tar to /mnt1 Tar 10. Un-mount the mount point (/mnt1) umount 11. Delete the mount point (/mnt1) rm
  • 38. Member Introduction Name Education Background Tasks of the project Working Experience Vincent Chen (Team Leader) Lan Yang Institute of Technology BS. Electronics Engineering - Kernel implement: - MTD support - MMC/SD card support - Kernel logo display - R&D Engineer (Electric Meters) - Field Application Engineer Annie Cheng Ming Hsin University of Science and Technology BS. In Electronic Engineering - Hardware layout tracing for SD/SDHC boot - Documentation - Senior Validation Engineer (CPU Electrical / Margining) - System Validation Test Engineer YiChin Huang Chih Lee Institute of Technology BS. in Information Management - U-boot support SDHC implement - SD card fusing tool implement Jason Kung Texas A&M University - Commerce MS. In Computer Science MS. In Management - U-boot support SD implement - Kernel, File System (ext3, readable/writable)on SD - Field Application Engineer (ARM Application Processor) - Product Manager (ARM Application Processor)