Discussion:
[9fans] stripping down the kernel for an small embedded systems?
(too old to reply)
Aharon Robbins
2012-09-03 18:34:38 UTC
Permalink
Hi 9fans.

A colleague asked me some questoins about the Plan 9 kernel that I could
not answer.

For a small x86-based embedded system (*deeply* embedded), how small would
the Plan 9 kernel be if one removed the networking stack (TCP/IP, 9P)
and all fiesystem code (except for access to a very few devices)? The
idea is to have primarily memory management and processes.

Any idea how hard this would be or what the steps would be to build
such a kernel given a regular Plan 9 installation?

Much thanks!

Arnold Robbins
Charles Forsyth
2012-09-03 19:29:21 UTC
Permalink
Just modifying a configuration file, and substituting
nocache.c and noswap.c (you won't have them, but they're easy)
to eliminate the devmnt cache and the pager, I can get

8l -o 9pctiny -T0xF0100020 -l l.8 plan9l.8 cga.8 i8253.8 i8259.8 kbd.8
main.8 memory.8 mmu.8 random.8 syscallfmt.8 trap.8 pctiny.root.8
pctiny.rootc.8 uarti8250.8 devmnt.8 mtrr.8 devdup.8 devenv.8 devarch.8
mpacpi.8 devproc.8 devrtc.8 devcons.8 apic.8 devuart.8 mp.8 devroot.8
archmp.8 pci.8 realmode.8 bios32.8 alarm.8 alloc.8 allocb.8 auth.8
nocache.8 chan.8 dev.8 edf.8 fault.8 latin1.8 page.8 parse.8 pgrp.8
portclock.8 print.8 proc.8 qio.8 qlock.8 rdb.8 rebootcmd.8 segment.8
noswap.8 sysfile.8 sysproc.8 taslock.8 tod.8 xalloc.8 pctiny.8
/386/lib/libc.a

size 9pctiny
279329t + 145512d + 359380b = 784221 9pctiny


That leaves in 9P (devmnt) and devproc.c (/proc) because they are a little
harder to eliminate, and no doubt a few other files
that might not strictly be needed. To go much beyond that, you'd need to
copy and change, deleting system calls (sysfauth) and other
code you didn't need (/dev/random in devcons.c).
Post by Aharon Robbins
Hi 9fans.
A colleague asked me some questoins about the Plan 9 kernel that I could
not answer.
For a small x86-based embedded system (*deeply* embedded), how small would
the Plan 9 kernel be if one removed the networking stack (TCP/IP, 9P)
and all fiesystem code (except for access to a very few devices)? The
idea is to have primarily memory management and processes.
Any idea how hard this would be or what the steps would be to build
such a kernel given a regular Plan 9 installation?
Much thanks!
Arnold Robbins
a***@skeeve.com
2012-09-04 07:46:32 UTC
Permalink
Thanks Charles and Erik for both your answers. I have pointed my colleague
to the online archive.

Arnold

erik quanstrom
2012-09-03 20:33:09 UTC
Permalink
Post by Charles Forsyth
Just modifying a configuration file, and substituting
nocache.c and noswap.c (you won't have them, but they're easy)
to eliminate the devmnt cache and the pager, I can get
8l -o 9pctiny -T0xF0100020 -l l.8 plan9l.8 cga.8 i8253.8 i8259.8 kbd.8
main.8 memory.8 mmu.8 random.8 syscallfmt.8 trap.8 pctiny.root.8
pctiny.rootc.8 uarti8250.8 devmnt.8 mtrr.8 devdup.8 devenv.8 devarch.8
mpacpi.8 devproc.8 devrtc.8 devcons.8 apic.8 devuart.8 mp.8 devroot.8
archmp.8 pci.8 realmode.8 bios32.8 alarm.8 alloc.8 allocb.8 auth.8
nocache.8 chan.8 dev.8 edf.8 fault.8 latin1.8 page.8 parse.8 pgrp.8
portclock.8 print.8 proc.8 qio.8 qlock.8 rdb.8 rebootcmd.8 segment.8
noswap.8 sysfile.8 sysproc.8 taslock.8 tod.8 xalloc.8 pctiny.8
/386/lib/libc.a
size 9pctiny
279329t + 145512d + 359380b = 784221 9pctiny
i just started a few minutes later, but i might as well post the results.
the deltas seem to be
included:
devcap.
dropped/reduced
using a low-calorie version of pci -- no bios32
mp
realmode
rtc
removed echo reboot kernel>/dev/reboot
removed old crunch from memory.c

8l -o 9pccpu -T0xF0100020 -l l.8 plan9l.8 cga.8 i8253.8 i8259.8 kbd.8 main.8 memory.8 mmu.8 random.8 trap.8 pccpu.root.8 pccpu.rootc.8 uarti8250.8 devmnt.8 devdup.8 devenv.8 fpx87.8 devarch.8 devsrv.8 devcap.8 devproc.8 devcons.8 devuart.8 uartp8250.8 devpipe.8 devroot.8 pci.8 alarm.8 alloc.8 allocb.8 auth.8 cache.8 chan.8 dev.8 edf.8 fault.8 latin1.8 page.8 parse.8 pgrp.8 portclock.8 print.8 proc.8 qio.8 qlock.8 segment.8 noswap.8 sysfile.8 sysproc.8 taslock.8 tod.8 xalloc.8 pccpu.8 /386/lib/libc.a /386/ lib/libsec.a /386/lib/libmp.a
size 9pccpu
263232t + 120204d + 47716b = 431152 9pccpu
; ls -l 9pccpu*
--rwxr-xr-x M 32 quanstro quanstro 513968 Sep 3 16:17 9pccpu
--rw-r--r-- M 32 quanstro quanstro 220568 Sep 3 16:17 9pccpu.gz

if i remove devcap, i get

258689t + 119888d + 47668b = 426245 9pccpu
; ; ls -l 9pccpu 9pccpu.gz
--rwxr-xr-x M 32 quanstro quanstro 506548 Sep 3 16:27 9pccpu
--rw-r--r-- M 32 quanstro quanstro 218071 Sep 3 16:26 9pccpu.gz

- erik
Loading...