NetBSD-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: NetBSD on CF card



> On Nov 12, 2019, at 2:14 PM, Dima Veselov <kab00m%lich.phys.spbu.ru@localhost> wrote:
> 
> Is there any way to have NetBSD copied to memory disk at
> start?

Hi Dima,

You can mount directories using tmpfs on startup. I use the rc.d script below when booting from an ISO image and use a readonly root filesystem.

There’s probably other configuration that is required that I’m forgetting about as the ISOs I use are heavily modified before this script runs but it should give you a general idea.
You may also be interested in mount_chfs(8) though I have not used this filesytem myself.

This rc.d scripts was heavily inspired by: https://github.com/abs0/dc-burn-netbsd/blob/master/dc-burn-netbsd#L113

Best of luck,
Travis



#!/bin/sh

# REQUIRE: DISKS
# PROVIDE: roroot
# BEFORE:  mountcritlocal

$_rc_subr_loaded . /etc/rc.subr

name="roroot"

start_cmd="${name}_start"

roroot_start() {
  mount -t tmpfs -o -s128000000 \
    -o noatime -o nodev -o noexec -o nosuid tmpfs /tmp
        echo "Mounting etc and var in tmpfs"
        for dir in etc var; do
                mkdir -p /tmp/.$dir
                mount -t union /tmp/.$dir /$dir
        done
}

load_rc_config $name
run_rc_command "$1"



Home | Main Index | Thread Index | Old Index