On 12/21/13 23:26, [email protected] wrote:
I did some testing on what it took to get a minimal toybox system to boot,
autoload modules, and connect to the network (manually).
I've fiddled around with this before but it's a judgement call: all you
need to boot a system to a shell prompt via initramfs is a shell. What
the system needs depends entirely on what it'll be doing.
The aboriginal use case in the roadmap includes what aboriginal needs,
but among other things that don't use modules...
I'm testing in qemu with user networking; the ethernet drivers are built
as modules (pcnet32.ko/e1000.ko).
Instead of building a root filesystem, I'm just using the initrd as a
live filesystem.
The initmpfs patches were intended to make this a bit easier. I need to
go do some more work on aboriginal to make it default to a basic system
in initmpfs and then mount the toolchain on a directory and properly set
it up in the $PATH, add some symlinks, and maybe a bind mount or two...
But given how little time I've been able to scrape up for toybox lately,
trying to carve off more for aboriginal is... a todo item.
I create bin/, dev/, proc/, sys/, var/run/, var/log/, lib/modules/, lib/dhcp/,
tmp/, and mnt/. sbin can be a symlink to bin.
toybox gets dropped in bin/ and all the necessary symlinks created.
Ok.
Modules get installed in /lib/modules/$KERNRELEASE/kernel/, as they would
ordinarily; I then run in the project root:
/sbin/depmod -b . $KERNRELEASE
rm lib/modules/*/*.bin lib/modules/modules.{softdep,devname}
#extract any files I need
#create the initrd:
find ./|cpio -o -H newc |gzip -9c >../tbinitrd.img
And that's ready for qemu.
In qemu, I configure the network like so:
ifconfig eth0 up
dhcp -v -s /lib/dhcp/set.sh
Hope this is helpful to someone,
Sounds good. So what's the prognosis, anything majore missing? (You used
depmod and toybox hasn't got one, but is that a build tool or a runtime
tool...)
Isaac Dunham
Commands needed:
Other programs:
pdksh (as /bin/sh)
I really need to find time to tackle toysh properly. I know what I need
to _do_, I'm just having to stay more fully employed to support my
family than I did a few years back...
From toybox:
#boot
init
mount # hacked version of Ashwini Sharma's last version; all probably work
mkdir # for /dev/pts
getty # I used mine
login # if you use pdksh directly, you don't need getty or login
#autoload modules; no, the kernel doesn't seem to do this...
find
cat
xargs
resolve_modalias # mine; because modprobe -q isn't quiet (optional)
modprobe #v2 from Ashwini
Is that a bug in modprobe?
#networking
ifconfig
dhcp
route
#testing
ftpget # from Ashwini with my patch, to test network
echo
env
ls
lsmod
#shutdown
sync
umount
kill
killall
poweroff # optional if you send the right signal to init
Scripts:
/init: (devtmpfs is not automounted from the initrd!)
I need to send another kernel patch to make the devtmpfs automount thing
actually happen for initmpfs...
#!/bin/sh
mount -t devtmpfs dev /dev
exec toybox init
/etc/fstab (simplifies rcS)
/etc/inittab (not needed with Ashwini's getty)
/etc/init.d/rcS (autostart at boot)
/lib/dhcp/set.sh
Files for user accounts...
/etc/passwd
/etc/shadow
/etc/group
/etc/profile
Looks good to me. I might be up for adding a www/rootfs directory with
an example root filesystem layout. (It would logically be doc/skeleton
but our documentation directory is a copy of the website, so...)
Or maybe ascript to generate such (via here documents) would make more
sense, living in scripts?
Thanks for the heads up,
Rob
_______________________________________________
Toybox mailing list
[email protected]
http://lists.landley.net/listinfo.cgi/toybox-landley.net