Create a portable FreeBSD system

Source: Internet
Author: User
Article Title: Create a portable FreeBSD system. Linux is a technology channel of the IT lab in China. Includes basic categories such as desktop applications, Linux system management, kernel research, embedded systems, and open source.

  Preface

You may have seen many Linux systems running on a floppy disk. FreeBSD runs less on a floppy disk. Although PICOBSD is available, PICOBSD cannot meet our needs in many cases, can I create a FreeBSD system running on a floppy disk? The answer is yes. I am maintaining a Floppy Firewall Project, which is a Firewall system running on a Floppy disk based on FreeBSD and IPFilter, after using Floppy Firewall, many netizens send emails asking how to run FreeBSD on a small Floppy disk. However, since there were too many things and there was no time to do so, I finally found time today. So I wrote the FreeBSD process on a floppy disk and shared it with you. Due to the rush of time, errors are inevitable in this article. Please kindly advise.

  1. Introduction to FreeBSD startup

After the BIOS reads data from the MBR, the MBR program reads the boot program from the hard disk FreeBSD Slice (FreeBSD partition). The boot Program loads/boot/loader by default, and then the loader loads/kernel, at this time, the kernel starts to detect some hardware and perform some initialization. After the initialization is complete, the kernel will mount the root device, and then start the system initialization process/sbin/init. The init will be initialized according to the settings in/etc/rc.

We can see that the solution is: boot program>/boot/loader>/kernel>/sbin/init>/etc/rc after learning about the Startup Process and the problem, we can start to create FreeBSD on a floppy disk.

  2. initialize a floppy disk

The first thing to do is to initialize the floppy disk, including setting disklabel and creating a file system (formatted as ufs ).

Bsd # disklabel-r-w fd0a fd1440

Next, install the boot program.

Bsd # disklabel-B fd0a

Now the floppy disk can be guided, but because we want to place programs on it, we need to create a file system.

Bsd # newfs fd0a

The boot program has been completed just now. Because the boot program will load/boot/loader, we also need to copy/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 startup process, now we have prepared the boot program and loader, And we will prepare the kernel.

  3. Custom Kernel

The disk space is limited, so we need to customize a small kernel instead of using the original kernel of the system. Because we only use a floppy disk, we should delete the scsi, ata, atapi, raid, and other items in the kernel. because we do not need IPv6, we should also delete INET6, what you leave depends on your own purposes, and there is no standard. However, the following are required:

Options MFS # memory file system support

Options MD_ROOT # Use the MD (memory disk) device as the root

Options UFS # UFS file system support

Options UFS_ROOT # UFS ROOT

Pseudo-device md # MD device Support

The following is a kernel preparation file I used:

#

# 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 should be automatically allocated by the system. If it is too large, it 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

 

[1] [2] [3] Next page

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.