www.cutedigi.com     Call Us:  303-834-7832    Email Us:  sales at cutedigi.com

Quick Find:    
Search
    
Use keywords to find the product you are looking for.
Categories
.NET Micro Frameworks
3D printer
Arduino
Arduino Kits
Arduino Shields
Book
Breakout Board
Cables
Cellular
Component
Development Tools
DMX512
EL
Ethernet
FPGA
GPS
LCD
Lighting LED
Powerline Communication
Programmer/Emulator
Project Case
Prototyping
Python-On-A-Chip
Raspberry Pi
Robotics
Security and Spy Camera
Sensor
Services
Storage
Tools
Tracking
Video
Wireless
Featured more
T Board to Bridge Arduino Shield to pcDuino with Level Shifter
T Board to Bridge Arduino Shield to pcDuino with Level Shifter
 $9.99 
Specials more
ATWIN Quad-band GPRS/GSM Shield for Arduino
ATWIN Quad-band GPRS/GSM Shield for Arduino
 $49.00  $45.00 
Linker Kit for Raspberry Pi / pcDuino
Linker Kit for Raspberry Pi / pcDuino
 $29.00  $24.90 
IOIO for Android
IOIO for Android
 $44.90  $25.99 
WiFi  RedBack 1.0 -- Arduino  yellowjacket Compatible
WiFi RedBack 1.0 -- Arduino yellowjacket Compatible
 $75.00  $64.99 
LinkSprite JPEG Color Camera Serial UART Interface (TTL level)
LinkSprite JPEG Color Camera Serial UART Interface (TTL level)
 $44.00  $39.00 
CuHead Pro WiFi/Ethernet Shield with AirPlay/DLNA Audio
CuHead Pro WiFi/Ethernet Shield with AirPlay/DLNA Audio
 $55.90  $51.00 
  Top » Catalog » Linux Port Tutorial TQ2440 » TUT 11: Build file system (I)
TUT 11: Build file system (I)   by Patrick

Note 1: Linux-2.6.25.8 and Linux-2.6.30.4 can use the same file system (major parts are same, the only difference is the driver module). The explaination in this tutorial is using 2.6.30.4 as an example.

Note 2. Suggest to do tut 12 first, and then come back to do this tuturial.

11.1 Build the frame

Create a directory "root_2.6.30.4" under "/opt/EmbedSky/". Copy the compiled directories from busybox "bin", "sbin","usr" and "linuxrc" to "root_2.6.30.4".

Also need to create "dev","etc","home","lib","mnt","opt","proc"¡¢"root","sys","tmp","var" and "web".

Also create a "lib" and "share" under the exsisting "usr".

 

Use the following commands:

#mkdir -p /opt/EmbedSky/root_2.6.30.4
#cd /opt/EmbedSky/root_2.6.30.4
#cp -rf /opt/EmbedSky/busybox-1.13.0/_install/* .
#mkdir -p dev etc home/sky lib mnt/udisk mnt/sd opt proc root sys tmp usr/lib usr/share var


11.2 Add new contents

We suggest you do the the following contents manually so you can get familar with the important concepts. If you choose you can also copy the exisiting one from the ported file system from

 http://www.cutedigi.com/forum/viewtopic.php?f=24&t=262.

"dev" directory:

The contents under "dev" will be automatically created by the system by calling "mdev" when kernel finished loading file system.

However, "mdev" is calling "init" to boot. Before using mdev to create "dev", init will need "/dev/console" and "/dev/null". So we need to statically create these two device files when build the file system:

#cd /opt/EmbedSky/root_2.6.30.4/dev
#mknod console c 5 1
#mknod null c 1 3

If we don't create these two device files, during booting, the file system will report "Warning: unable to open an initial console."

This warning message comes from line 778 int_post() in the kernel file "init/main.c".

"etc" directory:

It's used to store system config files. The frequent used files are stored under "etc/".

Note: The mentioned files can be copied from the file system we provided. You can also use vi or gedit command to create them, and type the corresponding contents. The mentioned directories also need to be created.

fstab:Specify the file systems that need to be mounted.
group:User group.
inittab:config files for init process.
shadow:This file is used by "passwd" to create password.
passwd:password file.
profile:Config file of user enviroment.
mdev.conf:Starting from 2.6.18, linux stops using devfs, and use udev (mdev is simplied version of udev). mdev.conf can be blank or edit according to some rules. Here we add the scripts used to automatically mount SD and USB flash drive.
resolv.conf:It's used to DNS information. DNS is needed when excess extra net.

The frequent used directories:

init.d:the starting file directory. There are one "rcS" file under this directory, it is used to store the booting config and the automatically started processes.
sysconfig:In the file system we provides, there is one file named "HOSTNAME". The content of this file is: EmbedSky£¬ That's why we will see "[root@EmbedSky /]" in the file system.
rc.d:It's used to store some automatically called scrips in our file system.
boa:a directory only in our file system, used to store the config script of web server.

Now we list the contents of each files under "etc/".

Note: If you want to build a brand new file system, you need to create these files.

fstab:
# device             mount-point      type           options          dump            fsck order
proc                   /proc               proc             defaults          0                    0
tmpfs                 /tmp               tmpfs           defaults          0                    0
sysfs                  /sys                sysfs            defaults          0                    0
tmpfs                 /dev                 tmpfs           defaults          0                    0
var                     /dev                tmpfs            defaults         0                     0
ramfs                 /dev                ramfs            defaults          0                    0

group:
root:*:0:
daemon:*:1:
bin:*:2:
sys:*:3:
adm:*:4:
tty:*:5:
disk:*:6:
lp:*:7:lp
mail:*:8:
news:*:9:
uucp:*:10:
proxy:*:13:
kmem:*:15:
dialout:*:20:
fax:*:21:
voice:*:22:
cdrom:*:24:
floppy:*:25:
tape:*:26:
sudo:*:27:
audio:*:29:
ppp:x:99:
500:x:500:sky
501:x:501:sky

inittab: please refer to the "examples/inittab" under the busybox directory.

# /etc/inittab
::sysinit:/etc/init.d/rcS
tq2440_serial0::askfirst:-/bin/sh
::ctrlaltdel:/sbin/reboot
::shutdown:/bin/umount -a -r


Note 1:The red part in the reference files in busybox is ttySAC0, but we use tq2440_serial as device name in the serial driver for s3c24xx.(in Linux-2.6.25.8 kernel source file "drivers/serial/s3c2410.c", line 949, in Linux-
2.6.30.4 kenerl source file "drivers/serial/samsung.c" line 888, we change it to tq2440_serial. We then use seerial 0 as control console, so we use tq2440_serial0.

Note 2: we need to change inittab to executable, recommended to use 777. Command: #chmod 777 inittab.

shadow:

The content is blank.

Comment: This file is used by passwd.

passwd:
root::0:0:root:/:/bin/sh
ftp::14:50:FTP User:/var/ftp:
bin:*:1:1:bin:/bin:
daemon:*:2:2:daemon:/sbin:

nobody:*:99:99:Nobody:/:
sky:$1$8GIZx6d9$L2ctqdXbYDzkbxNURpE4z/:502:502:Linux User,,,:/home/sky:/bin/sh
Note: the red part is the encrypted password. The method to get it to do run set password in a built filesystem (your host) using "passwd sky", and open this file, then you will see this content.

profile:

# Ash profile
# vim: syntax=sh
# No core files by default
#ulimit -S -c 0 > /dev/null 2>&1
USER="`id -un`"
LOGNAME=$USER
PS1='[u@h W]# '
PATH=$PATH
HOSTNAME=`/bin/hostname`
export USER LOGNAME PS1 PATH

 

This article was published on Sunday 11 April, 2010.
Current Reviews: 0  Write Review 
Tell a friend
Tell a friend about this article:     
Shopping Cart more
0 items
Articles
New Articles (0)
All Articles (82)
Android
Arduino (30)
DMX512 (1)
FPPA (3)
GPS (6)
Industry News (5)
Linux Port Tutorial TQ2440 (24)
MCU Zone (4)
Multitouch Display (2)
PCB/SMT Assembly Service (2)
Sensors (1)
Smart Home (4)
Cards Accepted
Cards We Accept