Re: [PATCH] x86:

!MAILaRCHIVE_VOTE_RePLACE
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: <linux-tiny@...>
Cc: Michael Opdenacker <michael-lists@...>, Matt Mackall <mpm@...>, Ingo Molnar <mingo@...>, Thomas Gleixner <tglx@...>, <linux-kernel@...>
Date: Sunday, January 20, 2008 - 8:25 am

On Friday 18 January 2008 10:29:23 Michael Opdenacker wrote:

Personally, I'm trying to figure out how to build a "hello world" kernel.

I.E. the minimal set of files I need to compile to get a kernel I can boot 
under qemu that does something visible.  (Printing "hello world" to the 
serial port via the early_serial_write(), perhaps?)

No VFS, no process management, preferably no memory management...  Just get to 
a stub start_kernel() that calls early_serial_write() and then does a HLT.  I 
note that start_kernel() calls 11 things before the first printk(), and that 
without the early_printk stuff that's just going into a buffer.

Preferably, I even want to take this out of the kernel's build process and 
build it from the command line or a small shell script.  (zImage packaging 
and all.)  I.E. some kind of:

  gcc blah blah blah -o vmlinux
  wrap.sh vmlinux zImage

The reason for this is, of course, that I'm trying to build the kernel with my 
tinycc fork, and the whole kernel build is kind of intimidating and 
complicated.  (And I currently need to pregenerate asm-offsets.h until I 
teach tinycc to produce assembly output or come up with an alternative.)

Currently, a "make allnoconfig" build runs for 479 lines, and builds radix 
tree code and /dev/random and sysfs and all sorts of stuff.  
Counter-intuitively, allnoconfig _isn't_ the smallest kernel you can build 
(by a long shot), to do that you have to switch on the embedded menu and then 
switch off everything in it (and all the stuff that shows up right _after_ 
it, which smells like a bug to me), and switch to SLOB and switch off the 
block layer at the top level.  But doing that only gets the build down to 449 
lines, and the resulting x86-64 kernel is over 400k.  That is _not_ a "hello 
world" kernel.  Not even close. :)

Alas, working from the other end and building your way _up_ isn't trivial 
either.  (But has the advantage that I'm starting much closer to my goal than 
the stripping down approach.)


Rob
-- 
"One of my most productive days was throwing away 1000 lines of code."
  - Ken Thompson.
--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH] x86: fix unconditional arch/x86/kernel/pcspeaker.c c..., Michael Opdenacker, (Thu Jan 17, 11:43 am)
Re: [PATCH] x86: fix unconditional arch/x86/kernel/pcspeaker..., Michael Opdenacker, (Thu Jan 17, 1:05 pm)
Re: [PATCH] x86: fix unconditional , Michael Opdenacker, (Thu Jan 17, 6:15 pm)
Re: [PATCH] x86: fix unconditional arch/x86/kernel/pcspeaker..., Michael Opdenacker, (Fri Jan 18, 8:14 am)
Re: [PATCH] x86: fix unconditional arch/x86/kernel/pcspeaker..., Michael Opdenacker, (Fri Jan 18, 9:03 am)
Re: [PATCH] x86: fix unconditional arch/x86/kernel/pcspeaker..., Michael Opdenacker, (Fri Jan 18, 12:29 pm)
Re: [PATCH] x86: , Rob Landley, (Sun Jan 20, 8:25 am)
Re: [PATCH] x86: , Michael Opdenacker, (Wed Jan 23, 6:30 pm)
Re: [PATCH] x86: fix unconditional arch/x86/kernel/pcspeaker..., Michael Opdenacker, (Mon Jan 21, 11:31 am)
Re: [PATCH] x86: , Rob Landley, (Sun Jan 20, 12:59 am)
Re: [PATCH] x86: fix unconditional arch/x86/kernel/pcspeaker..., Michael Opdenacker, (Fri Jan 18, 4:22 am)
Re: [PATCH] x86: fix unconditional arch/x86/kernel/pcspeaker..., Michael Opdenacker, (Thu Jan 17, 2:32 pm)