Making a FreeBSD system running on a floppy disk

Source: Internet
Author: User
Tags config file system mkdir firewall

Test platform: FreeBSD 4.5 release (i386)

We may have seen many Linux operating on floppy disk, can run on floppy disk FreeBSD instead of less, although there are PICOBSD, however, many times Picobsd does not meet our needs, then can we make a floppy disk run on the FreeBSD system? The answer is yes. I am maintaining a floppy firewall project, which is a firewall system based on FreeBSD and IPFilter running on floppy disks, and many netizens are using floppy After firewall email to ask how to make FreeBSD run on a small floppy disk. But because some time ago too many things have not been time, and finally found time today, so the production of the FreeBSD on the floppy disk to write to share with you, there are errors, but also please advise.

1. Introduction to FreeBSD start-up process

After the BIOS is read into the MBR, the program in the MBR reads the bootstrapper in the hard disk FreeBSD Slice (FreeBSD partition), the bootstrapper loads/boot/loader by default, and loader loads/kernel. At this point kernel began to detect some hardware and do some initialization. After the initialization is complete, kernel will mount root device, and then start the system initialization process/sbin/init,init will initialize according to the settings in/ETC/RC.

As you can see, the part we need to address is: Bootstrapper->/boot/loader->/kernel->/sbin/init->/ETC/RC

After understanding the startup process and the problem, we can start making the FreeBSD on the floppy disk.

2. Initialize floppy disk

The first thing to do is to initialize the floppy disk, including setting up Disklabel and creating the file system (formatted in a UFS format).

bsd# Disklabel-r-W fd0a fd1440

The next step is to install the bootstrapper.

bsd# Disklabel-b fd0a

Now the floppy disk has been able to boot, but because we want to place the program on it, we want to create the file system.

bsd# Newfs fd0a

The bootstrapper has just been done, because the bootstrapper will load the/boot/loader, so we also need to copy the/boot/loader from the system to the floppy disk.

bsd# mkdir /fd
  bsd# mount /dev/fd0a /fd
  bsd# mkdir /fd/boot
  bsd# cp /boot/loader /fd/boot/loader

According to the FreeBSD boot process, now that we are ready for the bootstrapper and loader, we have to prepare the kernel.

3. Custom kernel

Floppy disk space is limited, so we need to customize a small kernel, not directly using the system's original kernel.

Since we only use floppy disks, the kernel's SCSI, ATA, ATAPI, and RAID items should be removed because we don't need IPv6 so INET6 should also be deleted, what's left to see their own use, there is no standard. But there are a few things that are necessary:

options MFS      # 内存文件系统支持
  options MD_ROOT    # 使用MD(内存磁盘)设备做root
  options UFS      # UFS文件系统支持
  options UFS_ROOT    # UFS ROOT
  pseudo-device md    # MD设备支持

The following is a kernel configuration file that I use:

#
# GENERIC--GENERIC kernel configuration file for freebsd/i386
#
#
# $FreeBSD: src/sys/i386/conf/generic,v 1.246.2.38 2002/01/25 17:41:40 Murray Exp $
Machine i386
CPU I386_CPU
CPU I486_CPU
CPU I586_CPU
CPU I686_CPU
Ident "Mini-kernel"
Maxusers 0 #maxusers最好让系统自动分配, if set too large, will occupy too much memory.
Options INET #InterNETworking
Options FFS #Berkeley Fast filesystem
Options Ffs_root #FFS usable as ROOT device [keep this!]
Options MFS #Memory FileSystem
Options Md_root #MD is a potential ROOT device
Options compat_43 #Compatible with BSD 4.3 [KEEP this!]
Options no_swapping #Disable Swap
Device Isa
Device PCI
# Floppy Drives
Device fdc0 at Isa? Port IO_FD1 IRQ 6 DRQ 2
Device fd0 at Fdc0 Drive 0
# ATKBDC0 controls both the keyboard and the PS/2 mouse
Device atkbdc0 at Isa? Port IO_KBD
Device atkbd0 at ATKBDC? IRQ 1 Flags 0x1
Device vga0 at Isa?
# syscons is the default console driver, resembling a SCO console
Device sc0 at Isa? Flags 0x100
# floating point support-do not disable.
Device npx0 at Nexus? Port IO_NPX IRQ 13
# PCI Ethernet NICs The common MII Bus controller code.
# note:be sure to keep of the ' device Miibus ' line in order of these nics!
Device Miibus # MII Bus Support
Device FXP # Intel EtherExpress pro/100b (82557, 82558)
Device RL # RealTek 8129/8139
Device XL # 3Com 3C90X
Device lnc0 at Isa? Port 0x280 IRQ DRQ 0 # VMware Nic
# Pseudo devices-the number indicates how many units to allocate.
Pseudo-device Loop # Network Loopback
Pseudo-device Ether # Ethernet Support
Pseudo-device MD # Memory "Disks"

The above kernel is basically a system to run the smallest configuration, of course, if your machine is different from the specific, everyone according to their own situation to set up, my machine is:

CPU: Pentium III 733Mhz
  MotherBoard: Via 693A Chipset
  NIC: Realtek 8139c

When the preparation is to compile the kernel, we recommend that you use Config to compile, note that the last do not use make install, otherwise your original kernel will be replaced.

bsd# cd /sys/i386/conf
  bsd# config MINI
  bsd# cd ../../compile/MINI
  bsd# make depend && make kernel

After the compilation is completed will be born kernel this file, then its volume is still relatively large, but now do not care about it, later will explain how to deal with it.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.