Computer System Laboratory

Slides:



Advertisements
Similar presentations
Computer System Laboratory
Advertisements

A Guide to Unix Using Linux Fourth Edition
Lab 4 Department of Computer Science and Information Engineering National Taiwan University Lab4 - Bootloader 2014/10/14/ 13 1.
5 Basic utilities When a user logs in to the Linux operating system the directory that they will start in is their home directory. Most users will have.
Introduction to Unix (CA263) File System
Exploring the UNIX File System and File Security
GNU/Linux Filesystem 1 st AUT GNU/Linux Festival Computer Engineering & IT Department Bahador Bakhshi.
The UNIX File System.
Guide To UNIX Using Linux Third Edition
Computer System Laboratory
Linux-MVME Targets Using Motorola Board Support
COMPUTER SYSTEM LABORATORY Lab8 - Debugging II. Lab 8 Experimental Goal Learn how to debug Linux in source-level by Domingo and diagnose target boards.
COMPUTER SYSTEM LABORATORY Lab4 - Bootloader. Lab 4 Experimental Goal Learn how to build U-Boot bootloader for PXA /10/8/ 142.
Introduction to The Linaro Toolchain Embedded Processors Training Multicore Software Applications Literature Number: SPRPXXX 1.
1 Introduction to Tool chains. 2 Tool chain for the Sitara Family (but it is true for other ARM based devices as well) A tool chain is a collection of.
Lab 3 Department of Computer Science and Information Engineering National Taiwan University Lab3 - Cross Tools 2014/10/7/ 20 1.
Guide To UNIX Using Linux Fourth Edition
Help session: Unix basics Keith 9/9/2011. Login in Unix lab  User name: ug0xx Password: ece321 (initial)  The password will not be displayed on the.
Manage Directories and Files in Linux
Computer System Laboratory
1 Embedded Linux porting Speaker: Yi-Ji Jheng Date:
Embedded Linux porting Kernel
Computer System Laboratory
Lab 11 Department of Computer Science and Information Engineering National Taiwan University Lab11 - Porting 2014/12/9/ 26 1.
Unix Basics Chapter 4.
Porting Operating Systems Phan Duy Hùng (PhD) ES Lecturer – Hanoi FPT University.
Chapter Two Exploring the UNIX File System and File Security.
INTRODUCTION TO LINUX Jacob Chan. GNU/Linux Consists of Linux kernel, GNU utilities, and open source and commercial applications Works like Unix –Multi-user.
March 2, 2005Wah-kai Ngai1 Installation of Geant4 1st HK Simulation Meeting.
Lab 10 Department of Computer Science and Information Engineering National Taiwan University Lab10 – Debugging II 2014/12/2 1 /16.
COMPUTER SYSTEM LABORATORY Lab6 - Root Filesystem.
Guide to Linux Installation and Administration1 Chapter 4 Running a Linux System.
Filesystem Hierarchy Dr. Michael L. Collard 1.
Linux file system "On a UNIX system, everything is a file; if something is not a file, it is a process." Sorts of files (on a Linux system) Directories:
Manage Directories and Files in Linux. 2 Objectives Understand the Filesystem Hierarchy Standard (FHS) Identify File Types in the Linux System Change.
Chapter Two Exploring the UNIX File System and File Security.
Lab 14 Department of Computer Science and Information Engineering National Taiwan University Lab14 – Camera 2014/12/30 1 /14.
1 © 2001 John Urrutia. All rights reserved. Chapter 4 The LINUX Filesystem.
Linux Commands C151 Multi-User Operating Systems.
PTA Linux Series Copyright Professional Training Academy, CSIS, University of Limerick, 2006 © Workshop V Files and the File System Part B – File System.
Implementation of Embedded OS Lab3 Porting μC/OS-II.
SUSE Linux Enterprise Desktop Administration Chapter 7 Manage Directories and Files.
Linux Development Lecture 7. Schedule Linux Root Filesystem.
Lab 5 Department of Computer Science and Information Engineering National Taiwan University Lab5 – Bootloader + OS Kernel 2015/10/27/ 25 1.
The Kernel At a high level, the kernel in an operating system serves as the bridge between applications and the actual data processing of the hardware.
Lab 8 Department of Computer Science and Information Engineering National Taiwan University Lab8 - Root Filesystem 2015/11/10/ 22 1.
Lab 9 Department of Computer Science and Information Engineering National Taiwan University Lab9 - Debugging I 2014/11/4/ 28 1.
Implementation of Embedded OS
Lab 5 Department of Computer Science and Information Engineering National Taiwan University Lab5 - OS Kernel 2014/10/21/ 16 1.
1 Setup and Compile Linux Kernel Speaker: Yi-Ji Jheng Date:
Embedded Software Design Week II Linux Intro Linux Kernel.
LINUX Zhengli Zhu, School of Life Sciences. Outline 1. ABC of Linux 2. Basic orers of Linux 3. Bash Programming.
1 Free Electrons. Kernel, drivers and embedded Linux development, consulting, training and support. http//free-electrons.com The GRUB bootloader Michael.
1 Free Electrons. Kernel, drivers and embedded Linux development, consulting, training and support. http//free-electrons.com The U-boot bootloader Michael.
The GRUB bootloader Michael Opdenacker Thomas Petazzoni Free Electrons
Computer System Laboratory
Computer System Laboratory
Implementation of Embedded OS
Computer System Laboratory
Linux 101 Training Module Linux Basics.
UBUNTU INSTALLATION
Linux file system "On a UNIX system, everything is a file;
C151 Multi-User Operating Systems
Structure of Unix OS.
9 Linux on the Desktop.
Implementation of Embedded OS
Exploring the UNIX File System and File Security
Computer System Laboratory
Computer System Laboratory
Computer System Laboratory
Presentation transcript:

Computer System Laboratory Lab6 Root Filesystem

Experimental Goal Understand the basic process of root filesystem building Lab6 2019/4/9

Environment Host System Build System Target System Software Windows XP/Ubuntu 8.04 Build System Ubuntu 8.04 Target System XScale PXA270 Software BusyBox source code Compiled toolchain mkfs.jffs2 & genext2fs utility Misc. You can download all the source codes from RSWiki CSL Course Software Lab6 2019/4/9

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 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 It is the filesystem on which all the other filesystems are mounted as the system is booted up ~ from The Linux Information Project Lab6 2019/4/9

PXA270 Lab6 2019/4/9

Basic Root Filesystem Structure Root filesystem follows FHS (Filesystem Hierarchy Standard) FHS has the guideline of your filesystem Lab6 2019/4/9

Types of File Systems Some well-known file systems Windows : FAT, NTFS Mac OS X : HFS Plus, UFS Linux : ex*, XFS, JFS, ReiserFS We will use JFFS2 & ext2 in this lab ext2 (The second extended filesystem) A non-journaling file system Writable JFFS2 (Journaling Flash File System Version 2) A journaling file system Writable, compressed, power-down-reliable file system Lab6 2019/4/9

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 <root filesystem folder’s path> % mkdir etc lib var proc mnt dev tmp Lab6 2019/4/9

Compiled Toolchain Installation Step1 : extract binary files % tar –jxvf cross-2.95.3.tar.bz2 Step2 : move files to specified location % mkdir /usr/local/arm % sudo mv ./2.95.3 /usr/local/arm Step3 : append installation directory to PATH % … Test % arm-linux-gcc -v Lab6 2019/4/9

Build BusyBox 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 : extract source code % tar –zxvf busybox-1.00.tar.gz Step2 : copy header from kernel source % cd busybox-1.00 % cp –R <creator mt-linux path>/pxa270/linux/include/linux \ include % wget http://eraser.csie.ntu.edu.tw/courses/csl/101/lab6/sof tware/version.h % cp version.h include/linux Lab6 2019/4/9

Build BusyBox (Cont.) Step3 : configure BusyBox % make menuconfig Build Options  [*] Build BusyBox as a static binary (no shared libs) [*] Do you want to build BusyBox with a Cross Compiler? (arm-linux-) Cross Compiler prefix Networking Utilities  [ ] route Step4 : compile BusyBox % make -j4 Step5 : install BusyBox % make -j4 install Step6 : move files to your root filesystem folder % mv _install/* <root filesystem folder’s path> Lab6 2019/4/9

Create Essential Device Files 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 Lab6 2019/4/9

Create Essential Device Files (Cont.) The official source of information for device major and minor numbers can be found in Documentation/devices.txt under the kernel source We use a script to create device files % wget http://eraser.csie.ntu.edu.tw/courses/csl/101/lab6/sof tware/mknod.sh % cp mknod.sh <root filesystem folder’s path>/dev % cd <root filesystem folder’s path>/dev % sudo sh mknod.sh % rm mknod.sh Lab6 2019/4/9

Misc. Add configuration file used by first user-space program (i.e. /sbin/init) % wget http://eraser.csie.ntu.edu.tw/courses/csl/101/lab6/sof tware/inittab % cp inittab <root filesystem folder’s path>/etc inittab describes which processes are started during bootup The entry syntax of inittab id : runlevels : action : process sysinit : execute the process during system boot askfirst : prompt “Please press Enter to activate this console.” before execution Some other actions: respawn, ctrlaltdel ::sysinit:/etc/rcS ::askfirst:/bin/sh Lab6 2019/4/9

Misc. (Cont.) Add system initialization script Change their permission % wget http://eraser.csie.ntu.edu.tw/courses/csl/101/lab6/sof tware/rcS % cp rcS <root filesystem folder’s path>/etc Change their permission % cd <root filesystem folder’s path>/etc % chmod 777 inittab rcS Please refer to the website below for more information http://linux.vbird.org/linux_basic/0510osloader.php#startup_init Lab6 2019/4/9

Create the Root Filesystem Image Make a JFFS2 file system image % ./mkfs.jffs2 -v -e 0x20000 --pad=0xf00000 -r \ <root filesystem folder’s path> -o rootfs.jffs2 Make a ext2 file system image % ./genext2fs -b 15360 -d <root filesystem folder’s path> \ -e 0 rootfs.ext2 Now you can write rootfs image to board Tip If you choose ext2 file system format, you need to change U-Boot bootargs environment variable $ setenv bootargs root=/dev/mtdblock3 rw rootfstype=ext2 console=ttyS0,9600n8 mem=64M ip=10.26.2.2:10.26.2.254:10.26.2.254:255.255.255.0::et h0:off ether=12:34:56:78:90:ab) Lab6 2019/4/9

Change File System Image Size The size of root filesystem is determined by Linux kernel (in arch/arm/mach-pxa/mach-creator-pxa270.c) Then the corresponding option is required to set % ./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 static struct mtd_partition creator_pxa270_partitions[] = { … name: "Filesystem", size: 0x00f00000, /* 15M for rootfs */ } Lab6 2019/4/9

Exercise Refer to previous page, increase the size of the root filesystem to 20Mbytes You can use “df -h” command in Linux shell to check The tftp client utility is not built by default, please add tftp client utility to BusyBox Lab6 2019/4/9