Building ramdisk (was "trees, 3rd time's a charm (ok+tests)" )

classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

Building ramdisk (was "trees, 3rd time's a charm (ok+tests)" )

Brett Mahar-2
Hi,
After prodding from the "openbsd community needs to shake thinsg up" I attempted to compile a ramdisk with the patches from http://marc.info/?l=openbsd-tech&m=131669525606850&w=2. The kernel and userland built fine with -current from a few days ago, and the patches. But I have had no luck finding working instructions on building a ramdisk. Most seemed to be intermixed with instructions on building an install CD (to test the ramdisk, I was just going to boot into it, then install the sets from a recent snapshot CD).

This site: http://www.seattlecentral.edu/cgi-bin/cgiwrap/dmartin/moin.cgi/OpenBSD says to make crunchgen from /usr/src/distrib/crunch but that directory does not exist in my source code.

The "building the ramdisk" stage from: http://openbsd.wikia.com/wiki/Creating_a_custom_OpenBSD_RAM_disk ends with:

 .....
crunchgen -h  -k _crunched_mv_stub mv.lo
echo "int _crunched_expr_stub(int argc, char **argv, char **envp){return main(ar
gc,argv,envp);}" >expr_stub.c
cc -O2 -pipe   -c expr_stub.c
ld -dc -r -o expr.lo expr_stub.o /usr/src/distrib/macppc/ramdisk/../../../bin/ex
pr/obj/expr.o
crunchgen -h  -k _crunched_expr_stub expr.lo
echo "int _crunched_dmesg_stub(int argc, char **argv, char **envp){return main(a
rgc,argv,envp);}" >dmesg_stub.c
cc -O2 -pipe   -c dmesg_stub.c
ld -dc -r -o dmesg.lo dmesg_stub.o /usr/src/distrib/macppc/ramdisk/../../../dist
rib/special/dmesg/obj/dmesg.o
crunchgen -h  -k _crunched_dmesg_stub dmesg.lo
echo "int _crunched_hostname_stub(int argc, char **argv, char **envp){return mai
n(argc,argv,envp);}" >hostname_stub.c
cc -O2 -pipe   -c hostname_stub.c
ld -dc -r -o hostname.lo hostname_stub.o /usr/src/distrib/macppc/ramdisk/../../.
./bin/hostname/obj/hostname.o
crunchgen -h  -k _crunched_hostname_stub hostname.lo
cc -static -o instbin instbin.o dd.lo mount_cd9660.lo df.lo mount.lo arch.lo syn
c.lo newfs_msdos.lo stty.lo ln.lo disklabel.lo pax.lo ping.lo cat.lo ifconfig.lo
 ls.lo sysctl.lo rtsol.lo ping6.lo date.lo less.lo mount_nfs.lo fdisk.lo grep.lo
 umount.lo mount_msdos.lo mount_udf.lo fsck.lo sha256.lo mknod.lo route.lo pdisk
.lo ftp.lo reboot.lo mount_ffs.lo dhclient.lo ed.lo cp.lo gzip.lo chmod.lo fsck_
ffs.lo init.lo newfs.lo rm.lo mt.lo mkdir.lo sed.lo ksh.lo bioctl.lo sleep.lo mv
.lo expr.lo dmesg.lo hostname.lo -L//usr/lib -L/usr/src/distrib/macppc/ramdisk/.
./../../distrib/special/libstubs/obj -lstubs -lutil -lotermcap -lm
strip instbin
dd if=/dev/zero of=mr.fs bs=512 count=8192
8192+0 records in
8192+0 records out
4194304 bytes transferred in 0.165 secs (25299354 bytes/sec)
vnconfig -v -c vnd0 mr.fs
vnconfig: VNDIOCSET: Device busy
*** Error code 1

Stop in /usr/src/distrib/macppc/ramdisk (line 77 of /usr/src/distrib/macppc/ramd
isk/Makefile).

Is there some more recent instructions floating around I could try?

Thanks,
Brett.

Reply | Threaded
Open this post in threaded view
|

Re: Building ramdisk (was "trees, 3rd time's a charm (ok+tests)" )

Ted Unangst-6
On Thu, Oct 20, 2011, Brett wrote:
> vnconfig -v -c vnd0 mr.fs
> vnconfig: VNDIOCSET: Device busy
> *** Error code 1
>
> Stop in /usr/src/distrib/macppc/ramdisk (line 77 of
> /usr/src/distrib/macppc/ramd
> isk/Makefile).
>
> Is there some more recent instructions floating around I could try?

Did you read the error message?  Are you using vnd0?

Reply | Threaded
Open this post in threaded view
|

Re: Building ramdisk (was "trees, 3rd time's a charm (ok+tests)" )

Amit Kulkarni-5
In reply to this post by Brett Mahar-2
> After prodding from the "openbsd community needs to shake thinsg up" I
attempted to compile a ramdisk with the patches from
http://marc.info/?l=openbsd-tech&m=131669525606850&w=2. The kernel and
userland built fine with -current from a few days ago, and the patches. But I
have had no luck finding working instructions on building a ramdisk. Most
seemed to be intermixed with instructions on building an install CD (to test
the ramdisk, I was just going to boot into it, then install the sets from a
recent snapshot CD).
>
> This site:
http://www.seattlecentral.edu/cgi-bin/cgiwrap/dmartin/moin.cgi/OpenBSD says to
make crunchgen from /usr/src/distrib/crunch but that directory does not exist
in my source code.

crunchgen is now part of base. so you just follow the rest. I built it
using the exact same instructions (seattlecentral) in September a
month ago or so ago. Grab current sources because there was a
something which nigel@ pointed in bsd.rd generation and its fixed in
current as of 2 days ago.

HTH

Reply | Threaded
Open this post in threaded view
|

Re: Building ramdisk (was "trees, 3rd time's a charm (ok+tests)" )

Brett Mahar-2
Ted Unangst wrote:

> vnconfig -v -c vnd0 mr.fs
> vnconfig: VNDIOCSET: Device busy
> *** Error code 1
>
> Stop in /usr/src/distrib/macppc/ramdisk (line 77 of
> /usr/src/distrib/macppc/ramd
> isk/Makefile).
>
> Is there some more recent instructions floating around I could try?

Did you read the error message?  Are you using vnd0?

----

On Thu, 20 Oct 2011 10:32:53 -0500
Amit Kulkarni <[hidden email]> wrote:

> >  I attempted to compile a ramdisk with the patches from http://marc.info/?l=openbsd-tech&m=131669525606850&w=2. The kernel and userland built fine with -current from a few days ago, and the patches. But I have had no luck finding working instructions on building a ramdisk. Most seemed to be intermixed with instructions on building an install CD (to test the ramdisk, I was just going to boot into it, then install the sets from a recent snapshot CD).
> >
> > This site: http://www.seattlecentral.edu/cgi-bin/cgiwrap/dmartin/moin.cgi/OpenBSD says to make crunchgen from /usr/src/distrib/crunch but that directory does not exist in my source code.
>
> crunchgen is now part of base. so you just follow the rest. I built it
> using the exact same instructions (seattlecentral) in September a
> month ago or so ago. Grab current sources because there was a
> something which nigel@ pointed in bsd.rd generation and its fixed in
> current as of 2 days ago.
>
> HTH

----

Hi,

Following Amit's suggestion I updated my source tree (mine was more like 3-4 days old) and now it builds, once I manually enter " # export DESTDIR=/ " (Note it will not compile until I set a destdir, I'm not sure if that is supposed to be the behaviour).

I booted into a shell using the generated bsd.rd and it worked on G4 macppc (sorry, should have mentioned the architecture in the earlier port). Will try it on an install later today. As others have reported, the ramdisk is less than half the size of the regular one.

Ted Unangst asked if I was using vnd0 (which shows in the error message). As far as I know I am not, it does not show up in the boot dmesg and I did not configure it myself.  I assumed this was something used in the ramdisk compiling process.

Thanks,
Brett.

Reply | Threaded
Open this post in threaded view
|

Re: Building ramdisk (was "trees, 3rd time's a charm (ok+tests)" )

Ted Unangst-6
In reply to this post by Brett Mahar-2
On Fri, Oct 21, 2011, Brett wrote:
> Ted Unangst asked if I was using vnd0 (which shows in the error message).
> As far as I know I am not, it does not show up in the boot dmesg and I did
> not configure it myself.  I assumed this was something used in the ramdisk
> compiling process.

Well, it's busy, so you are.  It is used by the ramdisk build, but if
it's already in use that doesn't work.  vnconfig -l may help.

Reply | Threaded
Open this post in threaded view
|

Re: Building ramdisk (was "trees, 3rd time's a charm (ok+tests)" )

Brett Mahar-2
On Fri, 21 Oct 2011 00:28:01 -0400
Ted Unangst <[hidden email]> wrote:

> On Fri, Oct 21, 2011, Brett wrote:
> > Ted Unangst asked if I was using vnd0 (which shows in the error message).
> > As far as I know I am not, it does not show up in the boot dmesg and I did
> > not configure it myself.  I assumed this was something used in the ramdisk
> > compiling process.
>
> Well, it's busy, so you are.  It is used by the ramdisk build, but if
> it's already in use that doesn't work.  vnconfig -l may help.
>

I'm running all the programs that I had open when I got that build error message (reported in first post), except for make ramdisk, and now my vnodes are all quiet:

# vnconfig -l
vnd0: not in use
vnd1: not in use
vnd2: not in use
vnd3: not in use
#

Reply | Threaded
Open this post in threaded view
|

Re: Building ramdisk (was "trees, 3rd time's a charm (ok+tests)" )

Philip Guenther-2
On Thursday, October 20, 2011, Brett <[hidden email]> wrote:
> On Fri, 21 Oct 2011 00:28:01 -0400
> Ted Unangst <[hidden email]> wrote:
>
>> On Fri, Oct 21, 2011, Brett wrote:
>> > Ted Unangst asked if I was using vnd0 (which shows in the error
message).
>> > As far as I know I am not, it does not show up in the boot dmesg and I
did
>> > not configure it myself.  I assumed this was something used in the
ramdisk
>> > compiling process.
>>
>> Well, it's busy, so you are.  It is used by the ramdisk build, but if
>> it's already in use that doesn't work.  vnconfig -l may help.
>>
>
> I'm running all the programs that I had open when I got that build error
message (reported in first post), except for make ramdisk, and now my vnodes
are all quiet:
>
> # vnconfig -l
> vnd0: not in use
> vnd1: not in use
> vnd2: not in use
> vnd3: not in use
> #

(vnd's, not vnodes.  The former are a block device, the latter are a kernel
datastructure)

The likely cause of it being busy before is a previous attempt to build the
ramdisks which failed.  When that happens the image of the ramdisk is left
configured as a vnd so you can diagnose the problem.  Make sure you do
"vnconfig-u vnd0" after a failed build in that case.


Philip Guenther

Reply | Threaded
Open this post in threaded view
|

Re: Building ramdisk (was "trees, 3rd time's a charm (ok+tests)" )

Brett Mahar-2
In reply to this post by Brett Mahar-2
> > # vnconfig -l
> > vnd0: not in use
> > vnd1: not in use
> > vnd2: not in use
> > vnd3: not in use
> > #
>
> vnd's, not vnodes.

Is OpenBSD causing my dyslexia or merely bringing to light a preexisting condition?

> The likely cause of it being busy before is a previous attempt to build the
> ramdisks which failed. When that happens the image of the ramdisk is left
> configured as a vnd so you can diagnose the problem. Make sure you do
> "vnconfig-u vnd0" after a failed build in that case.
>
> Philip Guenther

OK, that does sound likely. Thanks everyone, for the help.
Brett.