1 / 22

Computer System Laboratory

Computer System Laboratory. Lab6 - Root Filesystem. Experimental Goal. Learn how to build your own root filesystem for PXA270. Environment. Host System Windows XP Build System VirtualBox + Ubuntu 8.04 Target System Creator XScale PXA270 Software BusyBox Compiled toolchain

arne
Download Presentation

Computer System Laboratory

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Computer System Laboratory Lab6 - Root Filesystem

  2. Experimental Goal • Learn how to build your own root filesystem for PXA270. / 22

  3. Environment • Host System • Windows XP • Build System • VirtualBox + Ubuntu 8.04 • Target System • Creator XScale PXA270 • Software • BusyBox • Compiled toolchain • mkfs.jffs2 & genext2fs utility • You can download all software from RSWiki CSL Course Software / 22

  4. Introduction to Root Filesystem • A file system is a method of storing and organizing computer files and their data. • A root filesystem is the file system that is contained on the same partition on which the root directory, i.e., / in Linux, is located. • The exact contents of the root filesystem will vary according to the computer, but they will include the files that are necessary for booting the system. reference: linfo: root filesystem, http://www.linfo.org/root_filesystem.html / 22

  5. Memory Layout of PXA270 • 32MB Flash ROM • Addressing from 0x00000000 • 64MB SDRAM • Addressing from 0xa0000000 / 22

  6. Basic Root Filesystem Structure • Root filesystem follows FHS (Filesystem Hierarchy Standard). • FHS has the guideline of your filesystem. / 22

  7. Types of Filesystems • Some well-known filesystems • Windows : FAT, NTFS • Mac OS X : HFS Plus, UFS • Linux : ext*, XFS, JFS, ReiserFS • We will use JFFS2 & ext2 in this lab. • JFFS2 (Journaling Flash File System Version 2) • A journaling file system. • Writable, compressed, power-down-reliable file system. • ext2 (The second extended filesystem) • A non-journaling file system. • Writable. / 22

  8. Create Root Filesystem Skeleton • Step1: create a folder for placing root filesystem content. • % mkdir $HOME/<root filesystem folder’s name> • Step2: create the essential directories. • % cd <the path in step1> • % mkdiretc lib varprocmntdevtmp / 22

  9. Compiled Toolchain Installation • To compile BusyBox, we need to install another cross-compiler. • Step1: download cross-compiler (cross-2.95.3.tar.bz2). • Step2: extract the compiler. • % tar jxvf cross-2.95.3.tar.bz2 • Step3: move files to specified location. • % sudomkdir –p /usr/local/arm • % sudo mv 2.95.3 /usr/local/arm • Step4: append installation directory (bin) to PATH. • Test new cross-compiler. • % arm-linux-gcc -v / 22

  10. Build BusyBox (1/3) • BusyBox contains a collection of stripped-down Unix utilities into a single executable. • Why BusyBox? • You don’t have to configure and build the sources of each utility. • Step1: download BusyBox (busybox-1.00.tar.gz). • Step2: extract the source codes. • Step3: copy header from kernel source codes of Lab5. • % cd busybox-1.00 • % cp –R <creator mt-linux path>/pxa270/linux/include/linuxinclude / 22

  11. Build BusyBox (2/3) • Step3: download Linux verison.h. • % wgethttp://eraser.csie.ntu.edu.tw/courses/csl/10201/lab6/software/version.h • % cpversion.h include/linux • Step4: configure BusyBox. • % make menuconfig • Build Options  • Networking Utilities  / 22

  12. Build BusyBox (3/3) • Step5: compile BusyBox. • % make -j4 • Step6: install BusyBox. • % make -j4 install • Step7: move files to your root filesystem folder (slide8). • % mv _install/* <root filesystem folder’s path> / 22

  13. Create Essential Device Files (1/3) • Device files allow user programs to access hardware devices on the system through the kernel. • The kernel just relies on device file’s type and major number to find which driver manages this device. / 22

  14. Create Essential Device Files (2/3) • The official information for device major and minor numbers can be found in Documentation/devices.txt under the kernel source codes. • We can use mknod command to create device files in Linux, e.g., if we want to create a character ttyS0 device with major number 4 and minor number 64: • % mknod ttyS0 c 4 64 / 22

  15. Create Essential Device Files (3/3) • For the convenience, we use a script to create related device files for our root filesystem: • % wget http://eraser.csie.ntu.edu.tw/courses/csl/10201/lab6/software/mknod.sh • % cp mknod.sh <root filesystem folder’s path>/dev • % cd <root filesystem folder’s path>/dev • % sudosh mknod.sh • % rmmknod.sh / 22

  16. Add Initialization Scripts (1/2) • Step1: add configuration file used by first user-space program (i.e. /sbin/init). • % wget http://eraser.csie.ntu.edu.tw/courses/csl/10201/lab6/software/inittab • % cpinittab<root filesystem folder’s path>/etc • inittab describes which processes are started during bootup. • The entry syntax of inittab. • id : runlevels : action : process ::sysinit:/etc/rcS ::askfirst:/bin/sh • sysinit: execute the process during system boot • askfirst : prompt “Please press Enter to activate this console.” before execution • Some other actions: respawn, ctrlaltdel / 22

  17. Add Initialization Scripts (2/2) • Step2: add system initialization script (rcS). • % wget http://eraser.csie.ntu.edu.tw/courses/csl/10201/lab6/software/rcS • % cprcS<root filesystem folder’s path>/etc • Step3: change permission. • % cd <root filesystem folder’s path>/etc • % chmod 777 inittabrcS • Please refer to the website below for more information. • http://linux.vbird.org/linux_basic/0510osloader.php#startup_init / 22

  18. Create Root Filesystem Image (1/2) • Step1: make a JFFS2 file system image. (Download mkfs.jffs2) • % chmod +x mkfs.jffs2 • % ./mkfs.jffs2 -v -e 0x20000 --pad=0xf00000 -r <root filesystem folder’s path> -o rootfs.jffs2 • You can see the mkfs.jffs2 usage by executing without arguments. • Step1: or a ext2 file system image. (Optional) • Install genext2fs package in Ubuntu 8.04. • % genext2fs -b 15360 -d <root filesystem folder’s path> -e 0 rootfs.ext2 • Please refer to the website below for the genext2fs usage. • http://csurs.csr.uky.edu/cgi-bin/man/man2html?genext2fs / 22

  19. Create Root Filesystem Image (2/2) • Step2: now, you can copy rootfs.* image to PXA270. • If you choose ext2 format for your root filesystem, you need to change rootfstype in bootargs environment variable in U-Boot. • u-boot$ setenvbootargs root=/dev/mtdblock3 rwrootfstype=ext2 console=ttyS0,9600n8 mem=64M ip=... • u-boot$ saveenv / 22

  20. Change Filesystem Image Size (1/2) • Recall Lab5, if we want to change the size of filesytem, we need to modify creator_pxa270_partitions[] in Linux kernel. • Also, the corresponding arguments are required to be set in mkfs.jffs2 and genext2fs commands, e.g. a 15M root filesystem. • % ./mkfs.jffs2 -v -e 0x20000 --pad=0xf00000 -r <root filesystem folder’s path> -o rootfs.jffs2 • % genext2fs -b 15360 -d <root filesystem folder’s path> -e 0 rootfs.ext2 / 22

  21. Change Filesystem Image Size (2/2) • Now, please refer to previous slides to increase the size of your root filesystem to 20M and add tftp client utility. • Please calculate new erased end address for root filesystem. • It will take about 8 minutes to copy new 20M root filesystem. • You can use “df -h” command to check the size. • You can add tftp client utility to BusyBox. / 22

  22. Lab Requirement & Bonus • Show that you can use tftp on your Linux kernel which has a 20M filesystem. • Bonus:Answer the question of lab6 on RSWiki CSL course website.Write it in your report. • Please send your report to both TAs. • csiedatou@gmail.com, meenchen79@gmail.com • Please use this title format: [CSL] G# Lab# Ver# • E.g., [CSL] G13 Lab6 Ver1 / 22

More Related