Because ATA compatible compact-flash cards are seen by FreeBSD as normal IDE hard drives, as is a M-Systems Disk-On-Chip product (when you are running a kernel with the fla driver built in) you could theoretically install FreeBSD from the network using the kern and mfsroot floppies or from a CD. Other than the fact that you should not write a boot-loader of any kind to the M-Systems device, no special instructions are needed.
However, even a small installation of FreeBSD using normal installation procedures can produce a system in size of greater than 200 megabytes. Because most people will be using smaller flash memory devices (128 megabytes is considered fairly large - 32 or even 16 megabytes is common) an installation using normal mechanisms is not possible--there is simply not enough disk space for even the smallest of conventional installations.
The easiest way to overcome this space limitation is to install FreeBSD using conventional means to a normal hard disk. After the installation is complete, pare down the operating system to a size that will fit onto your flash media, then tar the entire filesystem. The following steps will guide you through the process of preparing a piece of flash memory for your tarred filesystem. Remember, because a normal installation is not being performed, operations such as partitioning, labeling, file-system creation, etc. need to be performed by hand. In addition to the kern and mfsroot floppy disks, you will also need to use the fixit floppy. If you are using a M-Systems Disk-On-Chip, the kernel on your kern floppy must have the fla option detailed in Section 2 compiled into it. Please see Section 5 for instructions on creating a new kernel for kern.flp.
Partitioning your flash media device
After booting with the kern and mfsroot floppies, choose custom from the installation menu. In the custom installation menu, choose partition. In the partition menu, you should delete all existing partitions using the d key. After deleting all existing partitions, create a partition using the c key and accept the default value for the size of the partition. When asked for the type of the partition, make sure the value is set to 165. Now write this partition table to the disk by pressing the w key (this is a hidden option on this screen). When presented with a menu to choose a boot manager, take care to select None if you are using an M-Systems Disk-On-Chip. If you are using a ATA compatible compact flash card, you should choose the FreeBSD Boot Manager. Now press the q key to quit the partition menu. You will be shown the boot manager menu once more - repeat the choice you made earlier.
Creating filesystems on your flash memory device
Exit the custom installation menu, and from the main installation menu choose the fixit option. After entering the fixit environment, enter the following commands:
ATA compatible | Disk-On-Chip |
---|---|
# mknod /dev/ad0a c 116 0 # mknod /dev/ad0c c 116 2 # disklabel -e /dev/ad0c |
# mknod /dev/fla0a c 102 0 # mknod /dev/fla0c c 102 2 # disklabel -e /dev/fla0c |
At this point you will have entered the vi editor under the auspices of the disklabel command. If you are using Disk-On-Chip, the first step will be to change the type value near the beginning of the file from ESDI to DOC2K. Next, regardless of whether you are using Disk-On-Chip or ATA compatible compact flash media, you need to add an a: line at the end of the file. This a: line should look like:
a: 123456 0 4.2BSD 0 0
Where 123456 is a number that is exactly the same as the number in the existing c: entry for size. Basically you are duplicating the existing c: line as an a: line, making sure that fstype is 4.2BSD. Save the file and exit.
Placing your filesystem on the flash media
Mount the newly prepared flash media:
Bring this machine up on the network so we may transfer our tar file and explode it onto our flash media filesystem. One example of how to do this is:
# ifconfig xl0 192.168.0.10 netmask 255.255.255.0 # route add default 192.168.0.1
Now that the machine is on the network, transfer your tar file. You may be faced with a bit of a dilemma at this point - if your flash memory part is 128 megabytes, for instance, and your tar file is larger than 64 megabytes, you cannot have your tar file on the flash media at the same time as you explode it - you will run out of space. One solution to this problem, if you are using FTP, is to untar the file while it is transferred over FTP. If you perform your transfer in this manner, you will never have the tar file and the tar contents on your disk at the same time:
ftp> get tarfile.tar "| tar xvf -"
If your tarfile is gzipped, you can accomplish this as well:
ftp> get tarfile.tar "| zcat | tar xvf -"
After the contents of your tarred filesystem are on your flash memory filesystem, you can unmount the flash memory and reboot:
# cd / # umount /flash # exit
Assuming that you configured your filesystem correctly when it was built on the normal hard disk (with your filesystems mounted read-only, and with the necessary options compiled into the kernel) you should now be successfully booting your FreeBSD embedded system.
Prev | Home | Next |
rc.diskless and Read-Only Filesystems | Building a kern.flp Installation Floppy with the fla Driver |
This, and other documents, can be downloaded from ftp://ftp.FreeBSD.org/pub/FreeBSD/doc/.
For questions about FreeBSD, read the
documentation
before contacting <questions@FreeBSD.org>.
For questions about this documentation, e-mail <doc@FreeBSD.org>.
Закладки на сайте Проследить за страницей |
Created 1996-2024 by Maxim Chirkov Добавить, Поддержать, Вебмастеру |