tech-embed archive

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

Re: Tests of mdsetimage -s



Marcin Jessa wrote:


On Sat, 2 Apr 2005 01:04:32 +0200 (CEST)
Hubert Feyrer <hubert%feyrer.de@localhost> wrote:


As far as I understand, this is to reserve a lot of space first (MEMORY_DISK_ROOT_SIZE), and then later tell the kernel how much space really to allocate. Try embedding your 11MB filesystem in the 51MB kernel.



OK, now I set MEMORY_DISK_ROOT_SIZE=15000 which gives 15000*512/1024 = 7500 k
The image is 5112 k
#mdsetimage -v -s netbsd custom.img
got symbols from netbsd
mapped netbsd
copying image custom.img into netbsd
done copying image
setting md_root_size to 5226496
exiting

Running without -s gives:
# mdsetimage -v netbsd custom.img
got symbols from netbsd
mapped netbsd
copying image custom.img into netbsd
done copying image
exiting

Seems like -s sets the reserved space to the size of the image.

I am not sure how big the mounted memory fs is since I have problems with 
kernel refusing to execute /sbin/init
It stops right before that.
So I made a simple printf C code and replaced init with it
# sbin/init Tell YazzY you started!

exec /sbin/init: error 8
init: trying /sbin/oinit
exec /sbin/oinit: error 2
nit: trying /sbin/init.bak
exec /sbin/init.bak: error 2
init: not found panic: no init syncing disks... done rebooting...
Any idea why init cannot be not started ?


It looks like init is running (the YazzY is the printf, I assume?).

I'm not an expert, so take everything here with a huge grain of salt.

If I recall, init should never return and in reality is tasked with forking all the processes in the rc.d system. Init is the first process to run and the last to exit. When it exits, the return code indicates what happened, and that may be what you see. That is the kernel started init, your init ran, and then returned (unexpectedly for the kernel), so the kernel assumes something went wrong and tries some other backup inits.

I have an article that discusses changing init so that it simply drops to the single user shell. Look at init's SMALLPROG constant, which controls this behavior. I found it easier to do this than to create a custom init. Basically, with smallprog defined, init will simply invoke /bin/sh after it is done working its magic.

http://www.bsdnewsletter.com/2003/09/Features102.html

(note: this is all one link)
http://brianrose.net/family/fetch.php?dir=
  /Brian/NetBSD/Embedded&filename=single.html

--

Brian



Home | Main Index | Thread Index | Old Index