public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [ANNOUNCE] Gujin graphical bootloader 0.4
@ 2001-08-06 10:15 Etienne Lorrain
  2001-08-09 11:26 ` Matthias Andree
  2001-08-09 17:48 ` H. Peter Anvin
  0 siblings, 2 replies; 18+ messages in thread
From: Etienne Lorrain @ 2001-08-06 10:15 UTC (permalink / raw)
  To: linux-kernel

  Hello there,

  I released the 0.4 version of the GPL Gujin bootloader.

 Its homepage (with screenshoots) is at:
http://gujin.sourceforge.net/
 Its documentation (FAQ, HowTo) is at:
http://sourceforge.net/docman/display_doc.php?docid=1989&group_id=15465
 All other information and source/precompiled downloads at:
http://sourceforge.net/projects/gujin/

 In short, this bootloader:
 - Is for PCs with at least an 80386 and a VGA, VESA1 or VESA2+
   graphic card.
 - Loads Linux kernel images (zImage and bZimage) without the help
   of LILO, and short-circuit all real-mode code in the kernel to
   start at the first protected mode instruction of the kernel.
   You can use it to load unlimited size kernels and initrd, and
   easily select the text/graphic mode for running the kernel.
 - is nearly completely written in C using GCC, so it is easy to
   modify/improve it. It uses e2fsprogs-1.22 to understand E2FS
   filesystems and a completely rewritten zlib to decompress the
   kernel. FAT12/FAT16 support is working.
 - stay in real mode for the complete boot process, so should be
   compatible with all PCs.
 - Can be installed as a bootloader (only on a floppy right now)
   or as a DOS/Win boot.exe
 - 80 % of the code is already written, so I just need to write
   the last 80 % to have the 1.0 version -:) It is IHMO already
   a good rescue floppy disk or a good single floppy system
   loader (minimum configuration around 20 Kb).

 Have fun!
 Etienne.


^ permalink raw reply	[flat|nested] 18+ messages in thread
* Re: [ANNOUNCE] Gujin graphical bootloader 0.4
@ 2001-08-10 12:24 Etienne Lorrain
  0 siblings, 0 replies; 18+ messages in thread
From: Etienne Lorrain @ 2001-08-10 12:24 UTC (permalink / raw)
  To: linux-kernel; +Cc: Gujin-devel

hpa wrote:
> Etienne wrote:
> >  - Loads Linux kernel images (zImage and bZimage) without the help
> >    of LILO, and short-circuit all real-mode code in the kernel to
> >    start at the first protected mode instruction of the kernel.
>
> This is a very bad idea.  The kernel entry point is in real mode for a
> reason: it means that the kernel doesn't have to rely on the boot
> loader to provide the services it needs from real mode before
> entering protected mode once and for all.  The interface to the real
> mode entry point is narrow and stable, the protected mode entrypoint
> is a kernel internal and doesn't have an interface that is guaranteed
> to be stable -- again, for good reason.

 Thanks for the constructive criticism, now it is time to explain
 why I did it this way - it is far to be the simplest solution.

 First, I need to say that the Linux current interface is really
 stable: if you define "BOOT_KERNEL_BEFORE_2_0" in vmlinuz.[ch],
 Gujin will be able to boot pre- 1.0 Linux versions. Also, Gujin
 has always booted kernels this way.

 Considering the kernel interface to the bootloader, I find it is
 IMHO a bit complex: you not only have to give parameters in
 memory (at 0x9000:0000 or at %esi on 2.4.1+) but also provide
 callbacks (BIOS calls) for quite a lot of things.

 Alan Cox described it (incompletely) in his message in june,
 subject "draft BIOS use document for the kernel" at:
http://marc.theaimsgroup.com/?l=linux-kernel&m=99322719013363&w=2

 You also have to put in memory one or two compressed files
 (kernel and initrd) without any way to check if those hundred
 of Kbytes have been correctly read and are not corrupted.
 There will be no way - if an error is detected by the legacy
 loader at the decompression stage - to return to the bootloader
 saying: Fatal error, please select another kernel.

 These two files in memory have also to be at fixed linear
 addresses in real mode - and if you have a memory manager
 (himem.sys) loaded, these address may not be free. Usually
 you will find at the bottom of the himem memory the smartdrv
 (disk cache) data. It is then impossible to load a file at a random
 memory address and stay in real mode to do futher processing.
 In this case, Gujin is just malloc'ing the memory (using himem.sys),
 loading and decompressing this file (checking its CRC32), and
 only then disable interrupts, switch to protected mode, copy
 the file at its intended linear address and jump to the kernel
 code.

 Then, with the "old" method to load the kernel, you have the video
 selection menu. Well, it is a bit complex a thing to do in
 a bootloader, and its interface is complex (not speaking of the
 user interface), considering that you have already written everywhere
 in memory without knowing if (for instance) a video driver was loaded.
 All the video selection stuff has be to handled before selecting
 a kernel to load, IMO.

 I could probably find other problem, but I do not want to do
 destructive criticism.

 What do I propose? Lets put is simply:

 - The kernel file is a simple binary image to load at 0x100000,
 so you get it from the linux ELF file by just doing:
  objcopy -O binary -R .note -R .comment -S /usr/src/linux/vmlinux kernel
  gzip -9 kernel
 There is absolutely no limit on its size.

 - The initrd (if present) is a gzip of a filesystem image.

 - All information needed by the kernel is set in memory. It is
 clearly described on a C structure (vmlinuz.h::struct linux_param).
 This structure contains also (for reference) old fields which
 are no more used, or fields which were used only by previous
 bootloader. The is _no_ BIOS callback.

 - The hardware is setup correctly, for instance for the current
 video mode - if you are in graphic 8 BPP - the 256 color palette
 is set up with reasonnable values independant of the video card.
 Basically, hardware is immediately useable by the kernel.

 - There is a compatibility mode to load vmlinuz/zImage/bzImage.

 Note that all this is coded and working (I hope so). I know that
 with this solution, the bootloader and the kernel are more
 linked together, but I know also that the bootloader has to
 be a lot more intelligent (considering the number of related
 messages in the Linux lists). It should not try to load a Pentium
 compiled kernel on a 486. It should setup the video card (so
 be ready to get "invalid instruction exceptions" while executing
 BIOS calls). It should not try to run a corrupted kernel. It should
 not crash if a kernel/initrd file has been moved or two hard disks
 have been exchanged. It should display clear messages on what is
 wrong.
 It is up to the bootloader to crash if one BIOS call modify one
 register which is documented as constant (if it did not take care)
 - and in DEBUG mode send some informations to a serial/parallel port.
 When a new buggy BIOS appear, it is up to the bootloader to be upgraded,
 not to the Linux kernel.
 In short it is a real and complete software which handle all/most
 of the (buggy) BIOSes in their natural environment: the i386 real mode.
 If there is few fields to add to "struct linux_param" (really
 unusual from history), then Gujin will be upgraded. Anyway it is
 GPL - and written in C so there is a lot of people around able to
 change it, unlike assembly code.

 It is not as clean as described because of the APM / ACPI /
 PCI configuration BIOS32 calls; but that did not change by the
 Gujin bootloader. Note also that the SMP tables are passed in
 memory.

 One last thing I have to add (for people who have read up to here),
 is that having removed the "header" of the vmlinuz file, I lack the
 only important parameter in this header: the root device (rdev command).
 Right now, I am guessing it in a lot of configurations, but that
 is not a perfect solution. I think one of the simplest way is
 to add a "root=/dev/hd**" in the described comment field of the GZIP
 header; that is still not coded.
 From the same area, there is no way to know if a kernel will be able
 to boot in graphic mode (support of VESA framebuffer and which BPP
 are available). If vesafb is not compiled in and you start the
 kernel in graphic, the kernel boots but the display is like a
 crash... Right now the dirty way is the write-protect bit of the
 vmlinuz file - not a long term solution.

  Comment anyone?

  Etienne.


^ permalink raw reply	[flat|nested] 18+ messages in thread
[parent not found: <fa.mdu6dgv.m10d9i@ifi.uio.no>]
* Re: [ANNOUNCE] Gujin graphical bootloader 0.4
@ 2001-08-13 12:05 Etienne Lorrain
  2001-08-13 14:29 ` Keith Owens
  2001-08-14  7:53 ` Eric W. Biederman
  0 siblings, 2 replies; 18+ messages in thread
From: Etienne Lorrain @ 2001-08-13 12:05 UTC (permalink / raw)
  To: linux-kernel

> This is indeed a good structure, but this wide interface is a pain to
> keep stable, and having bootloaders call it directly is a genuinely
> bad idea.  It will lock us into an interface, or cause major breakage,
> when we have to do necessary revving of this interface.

 Note that this interface is so stable that the structure did not change
 for a long time. If someone wants to change it completely, he will
 have to rewrite tools which are accessing this structure (rdev) and
 also the bootloaders which are setting up fields into it already.
 This will involve re-coding real-mode i8086 assembly, and there is less
 and less people knowing how to do it.

> Instead, the proper time to deal with this is at kernel link time.
> The PC-BIOS stuff should go in, say arch/i386/pcbios, and you then can
> have other platforms (say, for example, arch/i386/linuxbios) which has
> its own setup code.  You then link a kernel image which has the
> appropriate code for the platform you're running on, and you're set.

 I can see your point about keeping functions which set up the structure
 and function which uses it in a single kernel release.
 In fact, all the functions setting this structure are in the same
 file in Gujin, vmlinuz.[ch]. This file could one day go into the Linux
 kernel, but we are no more speaking of compatibility.

 My main problem is the order the things are done: First load compressed
 files at defined addresses, then call a kernel function which callback the
 BIOS, then uncompress files.

 Once Gujin has started, I have a complete C environment so I can load
 files, treat errors, display messages. I can do this either from cold
 boot or from DOS (think of the first install of Linux on a system).

 A good solution would be to have the kernel being two (or three) GZIP
 files concatenated, the first would be the real-mode code to setup
 the structure only, the second would be the protected-mode code of the
 kernel (and the third the initrd). The first part would be a position
 independant function getting some parameters (address/max size of the
 structure to fill in) and returning information like microprocessor
 minimum requirement, video mode supported (number of BPP, or text only),
 address the kernel has been linked (to load a kernel at 16 Mb), ...

 Then I would call this setup function before doing invalid things like
 writing in the "DOS=HIGH" area. Note also that Gujin do not keep the
 compressed kernel/initrd files, it reads a block and uncompress it
 immediately because of the 64Kb limit on the data section.

 This interface would still not handle a distribution where there is
 few kernel files:
 /boot/Linux-2.4.8-SMP
 /boot/Linux-2.4.8-UP
 /boot/Linux-2.4.8-386
 /boot/Linux-2.4.8-Pentium
 And the bootloader should just select automagically the right kernel.

 I have to say that I simply do not have time to do such a thing,
 because I have a lot of other problems in Gujin: it is already
 a Linux-3.0 bootloader, not Linux-2.5 .
 Moreover, going from a simple solution (loading the binary image of
 an ELF file) to a complex one (as described) to solve problem which
 may appear in the future is not my way of thinking: it is already
 complex enought to do simple software.

  Etienne.

___________________________________________________________
Do You Yahoo!? -- Vos albums photos en ligne, 
Yahoo! Photos : http://fr.photos.yahoo.com

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

end of thread, other threads:[~2001-08-15 16:47 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2001-08-06 10:15 [ANNOUNCE] Gujin graphical bootloader 0.4 Etienne Lorrain
2001-08-09 11:26 ` Matthias Andree
2001-08-09 13:38   ` Etienne Lorrain
2001-08-09 17:48 ` H. Peter Anvin
2001-08-11  7:17   ` Eric W. Biederman
2001-08-11  8:10     ` H. Peter Anvin
2001-08-14  7:27       ` Eric W. Biederman
2001-08-14 16:42         ` H. Peter Anvin
2001-08-15 16:40           ` Eric W. Biederman
  -- strict thread matches above, loose matches on Subject: below --
2001-08-10 12:24 Etienne Lorrain
     [not found] <fa.mdu6dgv.m10d9i@ifi.uio.no>
2001-08-10 13:02 ` Giacomo Catenazzi
2001-08-10 14:06   ` Etienne Lorrain
2001-08-13 12:05 Etienne Lorrain
2001-08-13 14:29 ` Keith Owens
2001-08-14  7:36   ` Eric W. Biederman
2001-08-14  7:53 ` Eric W. Biederman
2001-08-14 11:06   ` Etienne Lorrain
2001-08-14 15:46     ` Eric W. Biederman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox