[2024]Digital Global Overview Report 2024 Meltwater.pdf
建構嵌入式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.
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?
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)