# Embedded FreeBSD system



## YetMe (Oct 15, 2015)

Hi

Im trying to make a cutdown version of FreeBSD 10.2 loaded into memory (MD_ROOT) for a home server but i always end up with the "mountroot>" prompt. I searched allover the google and this forum but iI didn't managed to find a solution.

My Kernel conf:

```
cpu        HAMMER
ident        GENERIC

options     SCHED_ULE        # ULE scheduler
options     PREEMPTION        # Enable kernel thread preemption
options     INET            # InterNETworking
options     FFS            # Berkeley Fast Filesystem
options     SOFTUPDATES        # Enable FFS soft updates support
options     UFS_ACL            # Support for access control lists
options     UFS_EXTATTR
options     UFS_DIRHASH        # Improve performance on big directories
options     UFS_GJOURNAL        # Enable gjournal-based UFS journaling
options     NFSCL            # New Network Filesystem Client
#options     NFSLOCKD        # Network Lock Manager
options     PROCFS            # Process filesystem (requires PSEUDOFS)
options     PSEUDOFS        # Pseudo-filesystem framework
options     GEOM_PART_GPT        # GUID Partition Tables.
options     GEOM_LABEL        # Provides labelization
options        COMPAT_43        # Compatible with BSD 4.3 [KEEP THIS!]
options     SCSI_DELAY=5000        # Delay (in ms) before probing SCSI
options     STACK            # stack(9) support
options     SYSVSHM            # SYSV-style shared memory
options     SYSVMSG            # SYSV-style message queues
options     SYSVSEM            # SYSV-style semaphores
options     _KPOSIX_PRIORITY_SCHEDULING # POSIX P1003_1B real-time extensions
options     PRINTF_BUFR_SIZE=128    # Prevent printf output being interspersed.
options     KBD_INSTALL_CDEV    # install a CDEV entry in /dev
options     HWPMC_HOOKS        # Necessary kernel hooks for hwpmc(4)
options     INCLUDE_CONFIG_FILE     # Include this file in kernel
options        NULLFS            # The nullFS to mount local directory
options     TMPFS            #Efficient memory filesystem
options     QUOTA            #Enable disk quotas
options     GEOM_UZIP
options        MD_ROOT           # MD    is a potential root device

options        DEVICE_POLLING
options        HZ=2000

# Make an SMP-capable kernel by default
options     SMP            # Symmetric MultiProcessor Kernel

# CPU frequency control
device        cpufreq

# Bus support.
device        acpi
device        pci

# ATA controllers
device        ahci        # AHCI-compatible SATA controllers
device        ata        # Legacy ATA/SATA controllers
options     ATA_STATIC_ID    # Static device numbering

# ATA/SCSI peripherals
device        scbus        # SCSI bus (required for ATA/SCSI)
device        da        # Direct Access (disks)
device        sa        # Sequential Access (tape etc)
device        pass        # Passthrough device (direct ATA/SCSI access)

# atkbdc0 controls both the keyboard and the PS/2 mouse
device        atkbdc        # AT keyboard controller
device        atkbd        # AT keyboard

device        kbdmux        # keyboard multiplexer

device        vga        # VGA video card driver

# syscons is the default console driver, resembling an SCO console
device        sc
device        agp        # support several AGP chipsets
#options     SC_PIXEL_MODE        # add support for the raster text mode

# PCI Ethernet NICs that use the common MII bus controller code.
# NOTE: Be sure to keep the 'device miibus' line in order to use these NICs!
device        miibus        # MII bus support
device        re        # RealTek 8139C+/8169/8169S/8110S
device        re

# Pseudo devices.
device        loop        # Network loopback
device        random        # Entropy device
device        ether        # Ethernet support
device        md            # Memory "disks"
device        pty            # BSD-style compatibility pseudo ttys
device        epair
device        if_bridge

# The pf packet filter consists of three devices:
device        pf            #  The `pf' device provides /dev/pf and the firewall code itself.
device        pflog        #  The `pflog' device provides the pflog0 interface which logs packets.
device        pfsync        #  Provides the pfsync0 interface used for synchronization of firewall state tables

# USB support
options     USB_DEBUG    # enable debug msgs
device        ohci        # OHCI PCI->USB interface
device        ehci        # EHCI PCI->USB interface (USB 2.0)
device        usb        # USB Bus (required)
device        uhid        # "Human Interface Devices"
device        ukbd        # Keyboard
device        umass        # Disks/Mass storage - Requires scbus and da
```

After creating the world and compress it with mkuzip iI end up with a folder that contais:

```
/boot
[INDENT]/kernel
[INDENT]/kernel
/[...other standard modules][/INDENT]
/loader.conf
/[... other standard boot files]
/base.uzip[/INDENT]
```
Here is my loader.conf file:

```
mfsroot_load="YES"
mfsroot_type="md_image"
mfsroot_name="/boot/base.uzip"
vfs.root.mountfrom="ufs:/dev/ufs/ROOTFS"
```
For making the world iI use:
`makes /tmp/base.ufs /tmp/world_dir
MDDEV=$(mdconfig -a -t vnode /tmp/base.ufs)
tunes -L ROOTFS /dev/$MDDEV
mdconfig -d -u $MDDEV
mkuzip -s 8192 -o /tmp/base.uzip /tmp/base.ufs`

I tar this folder and send it with nc to the a vmWare machine  and unpack it there. All goes fine till the kernel try to mount /. There it stop and ask me for mountroot>

Any help is VERY MUCH APPRECIATED as I'm out of ideas to try


----------



## Crest (Oct 22, 2015)

I would recommend read-only mounts over MD_ROOT in most cases. MD_ROOT is a workaround if you can't access any file system with /sbin/init and /etc/rc. Yes you can store a whole read-only system in RAM these days but the kernel will cache such a small system. If you have access to a /boot/loader.conf you can store more than just a kernel, its modules, the bootloader and its config files.

You can enter a question-mark instead of a root device to list all GEOM providers. If you want to debug the system attach a root filesystem and debug your kernel configuration from single user mode.


----------

