📄 213.htm
字号:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>CTerm非常精华下载</title>
</head>
<body bgcolor="#FFFFFF">
<table border="0" width="100%" cellspacing="0" cellpadding="0" height="577">
<tr><td width="32%" rowspan="3" height="123"><img src="DDl_back.jpg" width="300" height="129" alt="DDl_back.jpg"></td><td width="30%" background="DDl_back2.jpg" height="35"><p align="center"><a href="http://202.112.58.200"><font face="黑体"><big><big>Tsinghua</big></big></font></a></td></tr>
<tr>
<td width="68%" background="DDl_back2.jpg" height="44"><big><big><font face="黑体"><p align="center"> 嵌入式系统 (BM: turbolinux jacobw) </font></big></big></td></tr>
<tr>
<td width="68%" height="44" bgcolor="#000000"><font face="黑体"><big><big><p align="center"></big></big><a href="http://cterm.163.net"><img src="banner.gif" width="400" height="60" alt="banner.gif"border="0"></a></font></td>
</tr>
<tr><td width="100%" colspan="2" height="100" align="center" valign="top"><br><p align="center">[<a href="嵌入式系统.htm">回到开始</a>][<a href="198.htm">上一层</a>][<a href="214.htm">下一篇</a>]
<hr><p align="left"><small>发信人: plato (纯真年代), 信区: Embedded <br>
标 题: linux for ppc chapter 13 <br>
发信站: BBS 水木清华站 (Wed May 30 23:18:46 2001) <br>
<br>
Next Previous Contents <br>
---------------------------------------------------------------------------- <br>
---- <br>
13. Root Filesystem <br>
You need a root filesystem for the to kernel mount at startup. There are man <br>
y options, and the best one will generally depend on whether your system nee <br>
ds to be able to store persistent data (which must survive power cycling) in <br>
the field. <br>
See: http://lists.linuxppc.org/listarcs/linuxppc-embedded/200003/msg00067.ht <br>
ml. <br>
Your best bet is likely to be the root filesystem from Hard Hat Linux. Extra <br>
ct all the RPMs matching *.noarch.rpm, and use the image in opt/hardhat/devk <br>
it/ppc/8xx/target as the root filesystem. <br>
13.1 NFS Mounted <br>
During development, the embedded system can NFS-mount its root filesystem fr <br>
om your file sever to provide a complete diskless Linux system. The file ser <br>
ver need not be the same architecture as the embedded client. Answer "Y" to <br>
the kernel configuration questions regarding NFS client and root filesystem <br>
via NFS, and "make zImage". The embedded system will attempt to mount its ro <br>
ot filesystem from the server as "/tftpboot/<ipaddress>", where <ipaddress> <br>
is it's IP address. Install your root filesystem image in this directory as <br>
root on the server, and export the directory tree with an entry in /etc/expo <br>
rts on the server, like: <br>
/tftpboot (rw,no_root_squash) <br>
If your system has a hard disk, you can start by using NFS then build a root <br>
file system on the disk and boot from that. <br>
If your system has no ethernet, you may want to start developing on a board <br>
that does. <br>
13.2 Initial Ramdisk: initrd <br>
To make a diskless system standalone, you need an initial ramdisk image cont <br>
aining an ext2 filesystem to put in arch/ppc/mbxboot/ramdisk.image.gz. Then, <br>
build with "make zImage.initrd" and the ramdisk image will be mounted as th <br>
e root filesystem at startup. See Documentation/initrd.txt in the kernel sou <br>
rce tree. <br>
You need to select both CONFIG_BLK_DEV_RAM and CONFIG_BLK_DEV_INITRD to buil <br>
d zImage.initrd. You also need a file in arch/ppc/mbxboot called ramdisk.ima <br>
ge.gz. When you build zImage.initrd, the secondary boot loader is re-compile <br>
d with INITRD_OFFSET and INITRD_SIZE set, which are used to locate the start <br>
and end of the ramdisk.image.gz file in memory. The start and end are passe <br>
d to the kernel in registers (r4/r5??), which it saves into the variables in <br>
itrd_start and initrd_end. The secondary boot loader also changes the kernel <br>
command line arguments so that root=/dev/ram instead of root=/dev/nfs. The <br>
kernel does various things if initrd_start is non-zero, but the main one is <br>
to decompress the ramdisk.image.gz data into ramdisk 0, and because root=/de <br>
v/ram, this is then mounted as the root filesystem. <br>
If your ramdisk is larger than 4 MB, you will need to add ramdisk=xxxx to th <br>
e kernel command line at boot time, or modify drivers/block/rd.c. <br>
Beware that the CPU6 workarounds in the MontaVista 2.2.x kernel clobber the <br>
kernel command line, and cause the initial ramdisk mount to fail. See the th <br>
read at: http://lists.linuxppc.org/listarcs/linuxppc-embedded/200004/msg0010 <br>
3.html <br>
There are a number of ways to create your inital ramdisk image, described be <br>
low. For more info on building a root filesystem, see the Bootdisk HOWTO at: <br>
http://www.linux.org/docs/ldp/howto/Bootdisk-HOWTO/buildroot.html <br>
Examples <br>
An example ramdisk.image.gz is already included in the Hard Hat kit. <br>
A simple ramdisk for use with ppcboot is available at the Denx ftp site. <br>
Using a ramdisk <br>
You can also create your own on your development machine in a filesystem on <br>
/dev/ram. If your ramdisk is larger than 4 MB, you will need to increase the <br>
default ramdisk size on your development machine accordingly. <br>
LILO users can do this by adding the following line to the first section of <br>
/etc/lilo.conf: <br>
ramdisk=65536 <br>
There is no real harm in asking for an excessive size, as /dev/ram* only all <br>
ocates pages it actually needs to the ramdisk. However, you should use the " <br>
blocks-count" parameter to limit the filesystem size when you run mke2fs to <br>
prevent it creating unnecessarily large filesystem structures. <br>
Using the loop device <br>
Another approach is to use the loop device on your Linux development host to <br>
mount the ramdisk image as a local filesystem, and then copy the files you <br>
require into it. To allow users to mount the ramdisk.image on /mnt/loop with <br>
"mount /mnt/loop", add this entry to your /etc/fstab: <br>
/path/to/ramdisk.image /mnt/loop auto user,noauto,rw,loop 0 0 <br>
Note that the minix file system code in Linux is not endian-independant, so <br>
you can't build a minix file system image on an x86 machine and expect to re <br>
ad it on a PowerPC machine. ext2 does not suffer from this problem. <br>
For more info, see the Loopback-Root-FS HOWTO at: http://linuxdoc.org/HOWTO/ <br>
mini/Loopback-Root-FS-HOWTO.html <br>
13.3 ROMFS Flash Filesystem <br>
Search for ROMFS. <br>
13.4 cramfs <br>
The 2.4 kernel series has a compressed read-only filesystem (cramfs) aimed a <br>
t embedded systems, which can be back-ported to 2.2 kernels. If you're cross <br>
- developing, you need to modify <br>
mkcramfs <br>
to swap between little and big endian. <br>
13.5 ramfs <br>
ramfs from the 2.4 kernel is a simple filesystem ideal for use in a ramdisk. <br>
It can be used in combination with a cramfs read-only root filesystem, to m <br>
ount writable filesystems on <br>
/tmp <br>
and <br>
/var <br>
, which typically need to be writable. This combination is ideal for systems <br>
which don't require persistent storage. <br>
13.6 Journaling Flash FileSystem <br>
http://www.developer.axis.com/software/jffs/ <br>
JFFS allows persistent storage, optimised for flash memories rather than blo <br>
ck devices like hard disks. It is aimed at providing a crash/powerdown-safe <br>
filesystem for disk-less embedded devices and is a better option than the cr <br>
amfs/ramfs combination if your application requires persistent storage. You <br>
use it with the Memory Technology Device subsystem. <br>
---------------------------------------------------------------------------- <br>
---- <br>
Next Previous Contents <br>
<br>
-- <br>
<br>
※ 来源:·BBS 水木清华站 smth.org·[FROM: 166.111.161.8] <br>
</small><hr>
<p align="center">[<a href="嵌入式系统.htm">回到开始</a>][<a href="198.htm">上一层</a>][<a href="214.htm">下一篇</a>]
<p align="center"><a href="http://cterm.163.net">欢迎访问Cterm主页</a></p>
</table>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -