SlideShare una empresa de Scribd logo
1 de 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

Más contenido relacionado

La actualidad más candente

I/O, You Own: Regaining Control of Your Disk in the Presence of Bootkits
I/O, You Own: Regaining Control of Your Disk in the Presence of BootkitsI/O, You Own: Regaining Control of Your Disk in the Presence of Bootkits
I/O, You Own: Regaining Control of Your Disk in the Presence of Bootkits
CrowdStrike
 
The Microkernel Mach Under NeXTSTEP
The Microkernel Mach Under NeXTSTEPThe Microkernel Mach Under NeXTSTEP
The Microkernel Mach Under NeXTSTEP
Gregor Schmidt
 
U boot porting guide for SoC
U boot porting guide for SoCU boot porting guide for SoC
U boot porting guide for SoC
Macpaul Lin
 
Adaptive UI - 解像度の異なるデバイスや画面の向きに対応する 最適なレイアウトへ -
Adaptive UI  - 解像度の異なるデバイスや画面の向きに対応する 最適なレイアウトへ - Adaptive UI  - 解像度の異なるデバイスや画面の向きに対応する 最適なレイアウトへ -
Adaptive UI - 解像度の異なるデバイスや画面の向きに対応する 最適なレイアウトへ -
Yuji Hato
 

La actualidad más candente (20)

I/O, You Own: Regaining Control of Your Disk in the Presence of Bootkits
I/O, You Own: Regaining Control of Your Disk in the Presence of BootkitsI/O, You Own: Regaining Control of Your Disk in the Presence of Bootkits
I/O, You Own: Regaining Control of Your Disk in the Presence of Bootkits
 
TinyML - 4 speech recognition
TinyML - 4 speech recognition TinyML - 4 speech recognition
TinyML - 4 speech recognition
 
Exercicios clp l3 respondido
Exercicios clp l3   respondidoExercicios clp l3   respondido
Exercicios clp l3 respondido
 
I2C Drivers
I2C DriversI2C Drivers
I2C Drivers
 
103中華電信資訊類計概解答
103中華電信資訊類計概解答103中華電信資訊類計概解答
103中華電信資訊類計概解答
 
The Microkernel Mach Under NeXTSTEP
The Microkernel Mach Under NeXTSTEPThe Microkernel Mach Under NeXTSTEP
The Microkernel Mach Under NeXTSTEP
 
深入淺出C語言
深入淺出C語言深入淺出C語言
深入淺出C語言
 
[ZigBee 嵌入式系統] ZigBee Architecture 與 TI Z-Stack Firmware
[ZigBee 嵌入式系統] ZigBee Architecture 與 TI Z-Stack Firmware[ZigBee 嵌入式系統] ZigBee Architecture 與 TI Z-Stack Firmware
[ZigBee 嵌入式系統] ZigBee Architecture 與 TI Z-Stack Firmware
 
Diving into SWUpdate: adding new platform support in 30minutes with Yocto/OE !
Diving into SWUpdate: adding new platform support in 30minutes with Yocto/OE !Diving into SWUpdate: adding new platform support in 30minutes with Yocto/OE !
Diving into SWUpdate: adding new platform support in 30minutes with Yocto/OE !
 
Relógio Eletrônico de Ponto Henry Prisma Super Fácil R02 - Aplicativo Web Em...
Relógio Eletrônico de Ponto Henry Prisma Super Fácil  R02 - Aplicativo Web Em...Relógio Eletrônico de Ponto Henry Prisma Super Fácil  R02 - Aplicativo Web Em...
Relógio Eletrônico de Ponto Henry Prisma Super Fácil R02 - Aplicativo Web Em...
 
Schiller At 2 EKG manual
Schiller At 2 EKG manualSchiller At 2 EKG manual
Schiller At 2 EKG manual
 
101中華電信業務類計概解答
101中華電信業務類計概解答101中華電信業務類計概解答
101中華電信業務類計概解答
 
U-Boot Porting on New Hardware
U-Boot Porting on New HardwareU-Boot Porting on New Hardware
U-Boot Porting on New Hardware
 
U boot porting guide for SoC
U boot porting guide for SoCU boot porting guide for SoC
U boot porting guide for SoC
 
Lcu14 306 - OP-TEE Future Enhancements
Lcu14 306 - OP-TEE Future EnhancementsLcu14 306 - OP-TEE Future Enhancements
Lcu14 306 - OP-TEE Future Enhancements
 
USB Drivers
USB DriversUSB Drivers
USB Drivers
 
作業系統祕笈(張逸)
作業系統祕笈(張逸)作業系統祕笈(張逸)
作業系統祕笈(張逸)
 
Trusted firmware deep_dive_v1.0_
Trusted firmware deep_dive_v1.0_Trusted firmware deep_dive_v1.0_
Trusted firmware deep_dive_v1.0_
 
Montagem e desmontagem de um computador
Montagem e desmontagem de um computadorMontagem e desmontagem de um computador
Montagem e desmontagem de um computador
 
Adaptive UI - 解像度の異なるデバイスや画面の向きに対応する 最適なレイアウトへ -
Adaptive UI  - 解像度の異なるデバイスや画面の向きに対応する 最適なレイアウトへ - Adaptive UI  - 解像度の異なるデバイスや画面の向きに対応する 最適なレイアウトへ -
Adaptive UI - 解像度の異なるデバイスや画面の向きに対応する 最適なレイアウトへ -
 

Similar a 建構嵌入式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
 

Similar a 建構嵌入式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)
 
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
 
P1 unit 2
P1 unit 2P1 unit 2
P1 unit 2
 

Más de 艾鍗科技

Más de 艾鍗科技 (20)

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
 
智能健身
智能健身智能健身
智能健身
 

Último

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
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 

Último (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
 
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
 
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 Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 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
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
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
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
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...
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 

建構嵌入式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)