9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
* Re: [9fans] how small can you get
@ 2002-02-09 20:52 Russ Cox
  0 siblings, 0 replies; 14+ messages in thread
From: Russ Cox @ 2002-02-09 20:52 UTC (permalink / raw)
  To: 9fans

If you use the kernel config file below along
with bzip2 compression, I think you can fit everything
inside 160kb.

g% strip < 9tiny | bzip2 -9 | wc -c
 136003
g% strip < /sys/src/cmd/bzip2/8.bunzip2lite | wc -c
  18928
g% 

That leaves 5000 bytes to do load-related stuff
like jumping to the right address.  If you meant
160*1024 bytes, you've got almost 9000 bytes left.
That and bunzip2lite can be made smaller yet.
It is way too long and ugly to post,
but if you're interested mail me.  Basically
I took the bunzip2 code and replaced a bunch
of macros with functions to get the code size
down.  There's still plenty of room for improvement.

Russ



dev
	root
	cons
	arch
	env
	pipe
	proc
	mnt
	srv
	dup
	rtc
	ether	netif
	sd
	ns16552

link
	ether82557	pci

misc
	archmp		mp apic
	sdata		pci sdscsi

port
	int cpuserver = 0;

boot
	local


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [9fans] how small can you get
  2002-02-08 17:04   ` Sean Quinlan
@ 2002-02-08 17:16     ` Ronald G Minnich
  0 siblings, 0 replies; 14+ messages in thread
From: Ronald G Minnich @ 2002-02-08 17:16 UTC (permalink / raw)
  To: 9fans

On Fri, 8 Feb 2002, Sean Quinlan wrote:

> The current internal version of the kernel has this functionality.

good.

> We are also in the process of redoing the /boot.  The idea is
> to use rc as the boot scripting language.  The combination of these two
> ideas means that 9load can be greatly simplified, and we can have scenarios
> such as
> 	9load->local kernel -> setup ip; connected to fs; load kernel over 9p -> reboot
>
> The local kernel is just a fancy bootloader.

This is pretty much what we've been doing for the last 18 months with
Linux. We can boot linux from flash, or etherboot from flash on those
256KB flash cases.

The first Linux we boot in turn can boot another linux from wherever linux
knows how to read from (disk, network, etc.).

So my scenario would be
linuxbios->gunzip local kernel from FLASH->setup ip; connected to fs; load
	kernel over 9p

> The only tricky aspects to getting this to work is resetting the various
> devices that potentially can be doing DMA during or soon after the reboot.

Yup. In Two-Kernel Monte for Linux Erik Hendriks handles this by using
loadable modules. Before Monte boots the next Linux it unloads all the
modules he loaded, and their unload process pretty much disables each
interface.

Plan9 doesn't have loadable modules but I assume you've worked out the
details of disabling the DMA. Actually for PCI I've always found it safe
to just disable DMA in the device command register but Erik is more
paranoid than I am (probably justifiable given awful PC hardware).

The APIC and SMP add difficulties. Eric Biederman of LinuxNetworx has
solved these problems however. You might want to check out his kexec patch
unless you've solved this already. But turning off an APIC that was
brought alive in uniprocessor mode and having it do the right thing when
you get into SMP -- that's turned out to be tough. Add in the usual
chipset bugs and ... what a mess.

One thing we also do is use the Disk On Chip (where possible) to give us a
7MB / partition on the motherboard. This can be very handy ... you could
put plan9.ini in there, for example.

Anyway we're interested ...

ron



^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [9fans] how small can you get
@ 2002-02-08 17:14 jmk
  0 siblings, 0 replies; 14+ messages in thread
From: jmk @ 2002-02-08 17:14 UTC (permalink / raw)
  To: 9fans

On Fri Feb  8 11:43:15 EST 2002, rminnich@lanl.gov wrote:
> That tiny kernel from anothy is pretty encouraging.
> 
> OK, unless it makes people REALLY unhappy, we're going to look into a way
> to get plan9 to boot plan9. We're finding that OSes make pretty good
> bootstraps, since they generally are current on hardware bugs and glitches
> that bootstrap loaders lag on. Making an OS boot an OS is not that hard
> anyway.
> 
> Thanks
> 
> ron

Also, that's exactly what we did 10 years ago when we used to build hardware.
The Hobbit board ROM monitor was just a Plan 9 kernel with a slightly different
memory mapping and /boot replaced with interactive code.


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [9fans] how small can you get
  2002-02-08 16:42 ` Ronald G Minnich
@ 2002-02-08 17:04   ` Sean Quinlan
  2002-02-08 17:16     ` Ronald G Minnich
  0 siblings, 1 reply; 14+ messages in thread
From: Sean Quinlan @ 2002-02-08 17:04 UTC (permalink / raw)
  To: 9fans

That is exactly the way we have headed with plan 9 here at the labs.
The current internal version of the kernel has this functionality.
We are also in the process of redoing the /boot.  The idea is
to use rc as the boot scripting language.  The combination of these two
ideas means that 9load can be greatly simplified, and we can have scenarios
such as
	9load->local kernel -> setup ip; connected to fs; load kernel over 9p -> reboot

The local kernel is just a fancy bootloader.

The only tricky aspects to getting this to work is resetting the various
devices that potentially can be doing DMA during or soon after the reboot.

Another issue is the kernel configuration enviroment.

email me if you want more details.

seanq


Ronald G Minnich wrote:
> 
> That tiny kernel from anothy is pretty encouraging.
> 
> OK, unless it makes people REALLY unhappy, we're going to look into a way
> to get plan9 to boot plan9. We're finding that OSes make pretty good
> bootstraps, since they generally are current on hardware bugs and glitches
> that bootstrap loaders lag on. Making an OS boot an OS is not that hard
> anyway.
> 
> Thanks
> 
> ron


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [9fans] how small can you get
  2002-02-08 16:19 anothy
@ 2002-02-08 16:42 ` Ronald G Minnich
  2002-02-08 17:04   ` Sean Quinlan
  0 siblings, 1 reply; 14+ messages in thread
From: Ronald G Minnich @ 2002-02-08 16:42 UTC (permalink / raw)
  To: 9fans

That tiny kernel from anothy is pretty encouraging.

OK, unless it makes people REALLY unhappy, we're going to look into a way
to get plan9 to boot plan9. We're finding that OSes make pretty good
bootstraps, since they generally are current on hardware bugs and glitches
that bootstrap loaders lag on. Making an OS boot an OS is not that hard
anyway.

Thanks

ron



^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [9fans] how small can you get
@ 2002-02-08 16:19 anothy
  2002-02-08 16:42 ` Ronald G Minnich
  0 siblings, 1 reply; 14+ messages in thread
From: anothy @ 2002-02-08 16:19 UTC (permalink / raw)
  To: 9fans

256KB is tight, but i bet it's doable, if your bootloader understands
gzip, as 9load does. i just did this:
	:; size 9tiny
	360495t + 153284d + 36356b = 550135	9tiny
	:; strip < 9tiny > 9teeny
	:; ls -l 9tiny 9teeny 9teeny.gz
	--rw-rw-r-- M 4 anothy sys 513811 Feb  8 06:15 9teeny
	--rwxrwxr-x M 4 anothy sys 683136 Feb  8 06:14 9tiny
	--rw-rw-r-- M 4 anothy sys 229755 Feb  8 06:15 9teeny.gz
i just did the tiny config file in a minute; i bet more could be taken
out if some care were applied. i've appended below what i had, for
refference. pretty close to what i think you're asking for.
ア

---/sys/src/cmd/pc/tiny---
dev
	root
	cons
	arch
	env
	pipe
	proc
	mnt
	srv
	dup
	rtc
	ssl

	ether	netif
	ip	arp chandial ip ipaux iproute netlog nullmedium pktmedium ptclbsum386 inferno

	sd
	ns16552


link
	ether82557	pci
	ethermedium

misc
	archmp		mp apic

	ipconfig.root

	sdata		pci sdscsi

ip
	tcp
	udp
	ipifc
	icmp

port
	int cpuserver = 0;

boot boot #S/sdC0/
	local
	tcp



^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [9fans] how small can you get
  2002-02-08  2:53 jmk
  2002-02-08  5:25 ` Lucio De Re
@ 2002-02-08 15:20 ` Ronald G Minnich
  1 sibling, 0 replies; 14+ messages in thread
From: Ronald G Minnich @ 2002-02-08 15:20 UTC (permalink / raw)
  To: 9fans

On Thu, 7 Feb 2002 jmk@plan9.bell-labs.com wrote:

> You don't specify when or for which architecture. This is the oldest
> x86 kernel I could find in a public place:

Sorry, current kernel, i386 target.

I should mention the reason: I'm trying to see what I can get into a 256KB
or 512KB flash part. It looks like jamming a minimal kernel into flash is
not going to work with a 256KB part any more.

ron



^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [9fans] how small can you get
  2002-02-08  1:48 ` Russ Cox
  2002-02-08  1:52   ` Scott Schwartz
@ 2002-02-08 15:17   ` Ronald G Minnich
  1 sibling, 0 replies; 14+ messages in thread
From: Ronald G Minnich @ 2002-02-08 15:17 UTC (permalink / raw)
  To: 9fans

On Thu, 7 Feb 2002, Russ Cox wrote:

> I just built a stripped down pc kernel --
> IDE, CGA, no ether, no network, and got
       ^^^

can we go to full serial console?

> about 361kb.

what happened after gzip?

many thanks.

ron



^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [9fans] how small can you get
  2002-02-08  0:19 Ronald G Minnich
@ 2002-02-08 10:08 ` Boyd Roberts
  0 siblings, 0 replies; 14+ messages in thread
From: Boyd Roberts @ 2002-02-08 10:08 UTC (permalink / raw)
  To: 9fans

Ronald G Minnich wrote:
> just wondering, what's the smallest plan9 kernel seen to date.

With R2 I had a 1.44Mb floppy that would boot to 8 1/2 with
ftpfs and telnet.

No compression.

It was impressive.


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [9fans] how small can you get
  2002-02-08  2:53 jmk
@ 2002-02-08  5:25 ` Lucio De Re
  2002-02-08 15:20 ` Ronald G Minnich
  1 sibling, 0 replies; 14+ messages in thread
From: Lucio De Re @ 2002-02-08  5:25 UTC (permalink / raw)
  To: 9fans

On Thu, Feb 07, 2002 at 09:53:52PM -0500, jmk@plan9.bell-labs.com wrote:
> 
> On Thu Feb  7 20:54:13 EST 2002, schwartz@bio.cse.psu.edu wrote:
> > | I just built a stripped down pc kernel --
> > | IDE, CGA, no ether, no network, and got 
> > | about 361kb.
> > 
> > I'm surprised it is that big.  Back in the days of 4.2BSD, normal
> > kernels were smaller than that.  But maybe the vax had better code
> > density than x86.
> 
> I don't have easy access to a 4.2BSD kernel, so this will have to do:
> 
> o% pwd
> /rls/unix/4.3bsd/GENERIC
> o% ls -l vmunix
> --rwxr-xr-x M 49476 0 10 407552 Jun  6  1986 vmunix
> o% xd -s -4d vmunix|sed 2q
> 0000000  0000000264 0000279844 0000080872 0000100324
> 0000010  0000025716 2147488504 0000000000 0000000000
> o% hoc
> 279844+80872+100324
> 461040

Off the top of my head, the 68000 kernel for the AT&T Unix PC that I
am most familiar with was just >150K.  With loadable device drivers,
admittedly.  I could get more details tonight.

++L


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [9fans] how small can you get
@ 2002-02-08  2:53 jmk
  2002-02-08  5:25 ` Lucio De Re
  2002-02-08 15:20 ` Ronald G Minnich
  0 siblings, 2 replies; 14+ messages in thread
From: jmk @ 2002-02-08  2:53 UTC (permalink / raw)
  To: 9fans

On Thu Feb  7 19:23:15 EST 2002, rminnich@lanl.gov wrote:
> just wondering, what's the smallest plan9 kernel seen to date.
> 
> No graphics, just an enet device and an IDE and no network.
> 
> ron

You don't specify when or for which architecture. This is the oldest
x86 kernel I could find in a public place:

o% size /n/bootesdump/1991/1102/386/9safari
162289t + 132096d + 227168b = 521553	/n/bootesdump/1991/1102/386/9safari
o% 

and here are the other kernels from that time:

o% size /n/bootesdump/1991/1102/*/9
125738t + 53604d + 210996b = 390338	/n/bootesdump/1991/1102/68020/9
266448t + 44456d + 516736b = 827640	/n/bootesdump/1991/1102/mips/9
197000t + 45600d + 34536b = 277136	/n/bootesdump/1991/1102/sparc/9
o% 


On Thu Feb  7 20:54:13 EST 2002, schwartz@bio.cse.psu.edu wrote:
> | I just built a stripped down pc kernel --
> | IDE, CGA, no ether, no network, and got 
> | about 361kb.
> 
> I'm surprised it is that big.  Back in the days of 4.2BSD, normal
> kernels were smaller than that.  But maybe the vax had better code
> density than x86.

I don't have easy access to a 4.2BSD kernel, so this will have to do:

o% pwd
/rls/unix/4.3bsd/GENERIC
o% ls -l vmunix
--rwxr-xr-x M 49476 0 10 407552 Jun  6  1986 vmunix
o% xd -s -4d vmunix|sed 2q
0000000  0000000264 0000279844 0000080872 0000100324
0000010  0000025716 2147488504 0000000000 0000000000
o% hoc
279844+80872+100324
461040


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [9fans] how small can you get
  2002-02-08  1:48 ` Russ Cox
@ 2002-02-08  1:52   ` Scott Schwartz
  2002-02-08 15:17   ` Ronald G Minnich
  1 sibling, 0 replies; 14+ messages in thread
From: Scott Schwartz @ 2002-02-08  1:52 UTC (permalink / raw)
  To: 9fans

| I just built a stripped down pc kernel --
| IDE, CGA, no ether, no network, and got 
| about 361kb.

I'm surprised it is that big.  Back in the days of 4.2BSD, normal
kernels were smaller than that.  But maybe the vax had better code
density than x86.



^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [9fans] how small can you get
@ 2002-02-08  1:48 ` Russ Cox
  2002-02-08  1:52   ` Scott Schwartz
  2002-02-08 15:17   ` Ronald G Minnich
  0 siblings, 2 replies; 14+ messages in thread
From: Russ Cox @ 2002-02-08  1:48 UTC (permalink / raw)
  To: 9fans

I just built a stripped down pc kernel --
IDE, CGA, no ether, no network, and got 
about 361kb.

g% size 9tiny
247634t + 78200d + 35628b = 361462	9tiny
g% ls -l 9tiny
--rwxrwxr-x M 173507 rsc sys 447113 Feb  7 20:42 9tiny
g% 

It's hard to include ethernet but not IP,
as you requested, because there are a few
ether routines that depend on functions in
the IP code.

Russ


^ permalink raw reply	[flat|nested] 14+ messages in thread

* [9fans] how small can you get
@ 2002-02-08  0:19 Ronald G Minnich
  2002-02-08 10:08 ` Boyd Roberts
  0 siblings, 1 reply; 14+ messages in thread
From: Ronald G Minnich @ 2002-02-08  0:19 UTC (permalink / raw)
  To: 9fans

just wondering, what's the smallest plan9 kernel seen to date.

No graphics, just an enet device and an IDE and no network.

ron



^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2002-02-09 20:52 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-02-09 20:52 [9fans] how small can you get Russ Cox
  -- strict thread matches above, loose matches on Subject: below --
2002-02-08 17:14 jmk
2002-02-08 16:19 anothy
2002-02-08 16:42 ` Ronald G Minnich
2002-02-08 17:04   ` Sean Quinlan
2002-02-08 17:16     ` Ronald G Minnich
2002-02-08  2:53 jmk
2002-02-08  5:25 ` Lucio De Re
2002-02-08 15:20 ` Ronald G Minnich
     [not found] <rsc@plan9.bell-labs.com>
2002-02-08  1:48 ` Russ Cox
2002-02-08  1:52   ` Scott Schwartz
2002-02-08 15:17   ` Ronald G Minnich
2002-02-08  0:19 Ronald G Minnich
2002-02-08 10:08 ` Boyd Roberts

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).