Presentation is loading. Please wait.

Presentation is loading. Please wait.

Lab 8 Department of Computer Science and Information Engineering National Taiwan University Lab8 - Root Filesystem 2015/11/10/ 22 1.

Similar presentations


Presentation on theme: "Lab 8 Department of Computer Science and Information Engineering National Taiwan University Lab8 - Root Filesystem 2015/11/10/ 22 1."— Presentation transcript:

1 Lab 8 Department of Computer Science and Information Engineering National Taiwan University Lab8 - Root Filesystem 2015/11/10/ 22 1

2 Lab 8 Department of Computer Science and Information Engineering National Taiwan University  Learn how to build your own root filesystem for PXA270. 2015/11/10/ 22 2

3 Lab 8 Department of Computer Science and Information Engineering National Taiwan University  Host System  Windows XP  Build System  VirtualBox + Ubuntu 8.04  Target System  Creator XScale PXA270  Software  Compiled toolchain  BusyBox  version.h  Script for mknod  Inittab  rcS  mkfs.jffs2 utility  You can find all software on CSL Course Software.CSL Course Software 2015/11/10/ 22 3

4 Lab 8 Department of Computer Science and Information Engineering National Taiwan University  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. 2015/11/10/ 22 4 Reference: linfo: root filesystem, http://www.linfo.org/root_filesystem.htmlhttp://www.linfo.org/root_filesystem.html

5 Lab 8 Department of Computer Science and Information Engineering National Taiwan University  Root filesystem follows FHS (Filesystem Hierarchy Standard).  FHS has the guideline of your filesystem. 2015/11/10/ 22 5

6 Lab 8 Department of Computer Science and Information Engineering National Taiwan University  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. 2015/11/10/ 22 6

7 Lab 8 Department of Computer Science and Information Engineering National Taiwan University  Step 1: create a folder for placing root filesystem content.  % mkdir $HOME/  Step 2: create the essential directories.  % cd  % mkdir etc lib var proc mnt dev tmp 2015/11/10/ 22 7

8 Lab 8 Department of Computer Science and Information Engineering National Taiwan University  To compile BusyBox, we need to install another cross-compiler.  Step 1: download cross-compiler (cross-2.95.3.tar.bz2).  Step 2: extract the compiler.  % tar jxvf cross-2.95.3.tar.bz2  Step 3: move files to specified location.  % sudo mkdir –p /usr/local/arm  % sudo mv 2.95.3 /usr/local/arm  Step 4: append installation directory (bin) to PATH.  Test new cross-compiler.  % arm-linux-gcc -v 2015/11/10/ 22 8

9 Lab 8 Department of Computer Science and Information Engineering National Taiwan University  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.  Step 1: download BusyBox (busybox-1.00.tar.gz).  Step 2: extract the source codes.  Step 3: copy header from kernel source codes of Lab5.  % cd busybox-1.00  % cp –R /pxa270/linux/include/linux include 2015/11/10/ 22 9

10 Lab 8 Department of Computer Science and Information Engineering National Taiwan University  Step 4: download Linux verison.h.  % cp version.h include/linux  Step 5: configure BusyBox.  % make menuconfig  Build Options   Networking Utilities  2015/11/10/ 22 10

11 Lab 8 Department of Computer Science and Information Engineering National Taiwan University  Step 6: compile BusyBox.  % make  Step 7: install BusyBox.  % make install  Step 8: move files to your root filesystem folder (slide7).slide7  % mv _install/* 2015/11/10/ 22 11

12 Lab 8 Department of Computer Science and Information Engineering National Taiwan University  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. 2015/11/10/ 22 12

13 Lab 8 Department of Computer Science and Information Engineering National Taiwan University  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 2015/11/10/ 22 13

14 Lab 8 Department of Computer Science and Information Engineering National Taiwan University  For the convenience, we use a script to create related device files for our root filesystem:  download mknod.sh.  % cp mknod.sh /dev  % cd /dev  % sudo sh mknod.sh  % rm mknod.sh 2015/11/10/ 22 14

15 Lab 8 Department of Computer Science and Information Engineering National Taiwan University  Step 1: add configuration file used by first user-space program (i.e. /sbin/init ).  % download inittab.  % cp inittab /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 2015/11/10/ 22 15

16 Lab 8 Department of Computer Science and Information Engineering National Taiwan University  Step 2: add system initialization script ( rcS ).  % download rcS.  % cp rcS /etc  Step 3: change permission.  % cd /etc  % chmod 777 inittab rcS  Please refer to the website below for more information.  http://linux.vbird.org/linux_basic/0510osloader.php#startup_init http://linux.vbird.org/linux_basic/0510osloader.php#startup_init 2015/11/10/ 22 16

17 Lab 8 Department of Computer Science and Information Engineering National Taiwan University  Step 1: make a JFFS2 file system image. (Download mkfs.jffs2 ) mkfs.jffs2  % chmod +x mkfs.jffs2  %./mkfs.jffs2 -v -e 0x20000 --pad=0xf00000 -r -o rootfs.jffs2  You can see the mkfs.jffs2 usage by executing without arguments.  (Optional) Step 1: or a ext2 file system image.  Install genext2fs package in Ubuntu 8.04.  % genext2fs -b 15360 -d -e 0 rootfs.ext2  Please refer to the website below for the genext2fs usage.  http://csurs.csr.uky.edu/cgi-bin/man/man2html?genext2fs http://csurs.csr.uky.edu/cgi-bin/man/man2html?genext2fs 2015/11/10/ 22 17

18 Lab 8 Department of Computer Science and Information Engineering National Taiwan University  Step 2: 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$ setenv bootargs root=/dev/mtdblock3 rw rootfstype=ext2 console=ttyS0,9600n8 mem=64M ip=...  u-boot$ saveenv 2015/11/10/ 22 18

19 Lab 8 Department of Computer Science and Information Engineering National Taiwan University  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 -o rootfs.jffs2  % genext2fs -b 15360 -d -e 0 rootfs.ext2 2015/11/10/ 22 19

20 Lab 8 Department of Computer Science and Information Engineering National Taiwan University  Now, please refer to previous slides to increase the size of your root filesystem to 20M and add tftp, lsmod, insmod, rmmod utility.  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 in BusyBox.  You can add lsmod, insmod, rmmod commands in BusyBox.  These commands are under “Linux Module Utilities”.  You need to check the support of 2.6.x Linux Kernels. 2015/11/10/ 22 20

21 Lab 8 Department of Computer Science and Information Engineering National Taiwan University 2015/11/10/ 22 21 0xA0000000 0xA4000000 RAM U-Boot Flash 0x00000000 0x00040000 0x00080000 diag 0x00480000 0x01880000 Linux kernel 1 Root Filesystem 0x00020000 U-Boot parameters 0x02000000 U-Boot 0xA3F80000 For lab8 Question

22 Lab 8 Department of Computer Science and Information Engineering National Taiwan University  Show that you can use tftp on your Linux kernel which has a 20M filesystem.  Please hand in your lab report to the FTP.  Server: 140.112.90.174  Username: csl2015  Password: csl2015HomeWork  Directory: lab7,8  Please use this format for filename: “G# Ver#”, where G# is your group id and Ver# is revision version number.  E.g., G1 Ver2 2015/11/10/ 22 22


Download ppt "Lab 8 Department of Computer Science and Information Engineering National Taiwan University Lab8 - Root Filesystem 2015/11/10/ 22 1."

Similar presentations


Ads by Google