tech-userlevel archive

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

Re: NetBSD on embedded devices



I haven't been paying attention here much of late, but I chanced upon
this discussion today....

At Mon, 5 Jun 2017 01:25:08 +0300, Michael Pounov <misho%elwix.org@localhost> wrote:
Subject: Re: NetBSD on embedded devices
> 
> I wrote this, because I want just to reminder about using crunchgen
> and embedded rootfs into kernel.
> 
> You can mitigate this when built in into rootfs very small basic
> collection of tiny critical programs for serving boot system
> process.

There's really no need to be too selective when using crunchgen.  My
boot CD is very nearly a (command-line-only) "live" CD.  Why struggle
with a limited set of commands, some of them crippled to remove
features, when you can have everything from a full base.tgz but in a
fraction of the space?

I've built a nearly fully functional NetBSD-5 i386 base system which
will run on even the most minimal i386 systems I can still make work.

What's most incredible though is how fast the system is at general tasks
and command-line responsiveness, even running it out of a slow disk on a
slow CPU.  When *everything* runs out of the same 9.7MB text segment,
and it is of course static-linked so no running an extra and expensive
program just to start every program, exec time is imperceptible, even
for rarely used and large programs.

It also makes it possible to upgrade every bit of executable user-land
code all at once by replacing just one 9MB binary.

274 utilities from /bin, /sbin, /usr/bin, /usr/sbin, and /usr/libexec:

02:59 [41] $ file ramdiskbin
ramdiskbin: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), statically linked, for NetBSD 5.2, stripped
02:59 [42] $ size ramdiskbin
   text    data     bss     dec     hex filename
9700273  270300 4222768 14193341         d892bd ramdiskbin
02:59 [43] $ ls -l ramdiskbin
-rwxr-xr-x  1 woods  wheel  9974568 Jun  5  2016 ramdiskbin
02:59 [44] $ l *.cro
altqd.cro           hexdump.cro         ntpdc.cro           ssh-keysign.cro
altqstat.cro        host.cro            ntpq.cro            ssh.cro
apply.cro           hostapd.cro         ntptime.cro         sshd.cro
arp.cro             hostapd_cli.cro     omshell.cro         stat.cro
at.cro              hostname.cro        openssl.cro         stty.cro
atrun.cro           iconv.cro           passwd.cro          su.cro
awk.cro             id.cro              pax.cro             swapctl.cro
basename.cro        identd.cro          pcictl.cro          sync.cro
bc.cro              ifconfig.cro        ping.cro            sysctl.cro
bdes.cro            ifwatchd.cro        pkill.cro           syslogd.cro
bootpd.cro          inetd.cro           pmap.cro            systat.cro
bootpef.cro         init.cro            pppd.cro            tail.cro
bootpgw.cro         installboot.cro     pppdump.cro         tbrconfig.cro
bootptest.cro       iopctl.cro          pppoectl.cro        tcpdchk.cro
bzip2.cro           iostat.cro          pppstats.cro        tcpdmatch.cro
cap_mkdb.cro        ipf.cro             pr.cro              tcpdrop.cro
cat.cro             ipfs.cro            printenv.cro        tcpdump.cro
chat.cro            ipfstat.cro         printf.cro          tee.cro
chflags.cro         ipftest.cro         ps.cro              telnet.cro
chio.cro            ipmon.cro           pstat.cro           telnetd.cro
chmod.cro           ipnat.cro           pwd.cro             test.cro
chown.cro           ippool.cro          pwd_mkdb.cro        tftp.cro
chpass.cro          ipresend.cro        racoon.cro          tftpd.cro
chroot.cro          ipsend.cro          racoonctl.cro       time.cro
cksum.cro           iptest.cro          raidctl.cro         timed.cro
cmp.cro             ipwctl.cro          rarpd.cro           timedc.cro
comm.cro            kill.cro            rcmd.cro            tip.cro
compress.cro        ksh.cro             rcorder.cro         top.cro
cp.cro              last.cro            rcp.cro             touch.cro
cpuctl.cro          less.cro            rdate.cro           tput.cro
cron.cro            lesskey.cro         reboot.cro          tr.cro
crontab.cro         ln.cro              renice.cro          traceroute.cro
cut.cro             lock.cro            restore.cro         trpt.cro
date.cro            lockstat.cro        rexecd.cro          tset.cro
dc.cro              logger.cro          rlogin.cro          tsort.cro
dd.cro              login.cro           rlogind.cro         tty.cro
dev_mkdb.cro        ls.cro              rm.cro              ttyflags.cro
df.cro              map-mbone.cro       rmdir.cro           umount.cro
dhclient.cro        mkdir.cro           route.cro           uname.cro
dhcpd.cro           mkfifo.cro          rsh.cro             uniq.cro
dhcrelay.cro        mknod.cro           rshd.cro            units.cro
diff.cro            mktemp.cro          scp.cro             unvis.cro
diff3prog.cro       mount.cro           script.cro          usbdevs.cro
dirname.cro         mount_cd9660.cro    scsictl.cro         usbhidaction.cro
disklabel.cro       mount_fdesc.cro     sdiff.cro           usbhidctl.cro
dkctl.cro           mount_ffs.cro       sed.cro             utmp_update.cro
dmesg.cro           mount_kernfs.cro    seq.cro             uudecode.cro
domainname.cro      mount_msdos.cro     services_mkdb.cro   uuencode.cro
du.cro              mount_nfs.cro       sesd.cro            vi.cro
echo.cro            mount_null.cro      setencstat.cro      vipw.cro
ed.cro              mount_overlay.cro   sftp-server.cro     vis.cro
envstat.cro         mount_procfs.cro    sftp.cro            vmstat.cro
expr.cro            mount_ptyfs.cro     sh.cro              w.cro
fdisk.cro           mount_tmpfs.cro     shlock.cro          wall.cro
fgrep.cro           mount_union.cro     shutdown.cro        wc.cro
file.cro            mrouted.cro         skey.cro            who.cro
find.cro            mt.cro              skeyinfo.cro        whois.cro
fsck.cro            mtrace.cro          skeyinit.cro        wiconfig.cro
fsck_ffs.cro        mv.cro              slattach.cro        window.cro
fstat.cro           nc.cro              sleep.cro           wlanctl.cro
ftp.cro             ndbootd.cro         sliplogin.cro       wpa_cli.cro
ftpd.cro            netstat.cro         sntp.cro            wpa_passphrase.cro
getencstat.cro      newfs.cro           sockstat.cro        wpa_supplicant.cro
getty.cro           newsyslog.cro       sort.cro            write.cro
gkermit.cro         nice.cro            split.cro           xargs.cro
gpioctl.cro         nohup.cro           ssh-add.cro         xinstall.cro
grep.cro            ntp-keygen.cro      ssh-agent.cro       yes.cro
gzip.cro            ntpd.cro            ssh-keygen.cro
head.cro            ntpdate.cro         ssh-keyscan.cro

I only had to kick BIND out because of stupid conflicts with NTPD, but
other than that there were no real problems.

The whole root filesystem fits in 12.5MB, and stuffed into a kernel it
is still well under 20MB

netbsd-NET5501.EMBED: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), statically linked, for NetBSD 5.2, not stripped
03:18 [97] $ size netbsd-NET5501.EMBED
   text    data     bss     dec     hex filename
4536955 13034660         430196 18001811        112af93 netbsd-NET5501.EMBED
03:18 [98] $ ls -l netbsd-NET5501.EMBED
-rwxr-xr-x  1 woods  wheel  18268428 Jun  5  2016 netbsd-NET5501.EMBED

-- 
						Greg A. Woods
						Planix, Inc.

<woods%planix.com@localhost>       +1 250 762-7675        http://www.planix.com/

Attachment: pgpyuAcv2w6dv.pgp
Description: PGP signature



Home | Main Index | Thread Index | Old Index