?? 00000013.htm
字號:
<?xml version="1.0" encoding="gb2312"?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=gb2312"/><title>linux for ppc chapter 13 jacobw </title></head><body><center><h1>BBS 水木清華站∶精華區(qū)</h1></center><a name="top"></a>發(fā)信人: plato (純真年代), 信區(qū): Embedded <br />標(biāo) 題: linux for ppc chapter 13 <br />發(fā)信站: 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: <a href="http://lists.linuxppc.org/listarcs/linuxppc-embedded/200003/msg00067.ht">http://lists.linuxppc.org/listarcs/linuxppc-embedded/200003/msg00067.ht</a> <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: <a href="http://lists.linuxppc.org/listarcs/linuxppc-embedded/200004/msg0010">http://lists.linuxppc.org/listarcs/linuxppc-embedded/200004/msg0010</a> <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 /> <a href="http://www.linux.org/docs/ldp/howto/Bootdisk-HOWTO/buildroot.html">http://www.linux.org/docs/ldp/howto/Bootdisk-HOWTO/buildroot.html</a> <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: <a href="http://linuxdoc.org/HOWTO/">http://linuxdoc.org/HOWTO/</a> <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 /><a href="http://www.developer.axis.com/software/jffs/">http://www.developer.axis.com/software/jffs/</a> <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 /><a href="00000012.htm">上一篇</a><a href="javascript:history.go(-1)">返回上一頁</a><a href="index.htm">回到目錄</a><a href="#top">回到頁首</a><a href="00000014.htm">下一篇</a></h1></center><center><h1>BBS 水木清華站∶精華區(qū)</h1></center></body></html>
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -