Gujin is hosted by SourceForge Logo

Version v2.4


What is Gujin

Here is the description you can find at Freshmeat:
Gujin is a PC boot loader which can analyze your partitions and filesystems.
It finds the Linux kernel images available, as well as other bootable partitions (for *BSD, MS-DOS, Windows, etc.), files (*.kgz) and bootable disk images (*.bdi), and displays a graphical menu for selecting which system to boot.
Gujin boots Linux kernel using the documented interface, like LILO and GRUB, so it doesn't need any other pre-installed bootloader. It can also directly load gzip'ed ELF32 or ELF64 files, with a simple interface to collect real-mode BIOS data. There is no need to execute anything after making a new kernel: just copy the kernel image file into the "/boot" directory, with a standard name.
Gujin is written almost entirely in C with GCC, and it fully executes in real mode to be as compatible as possible.

And here is Gujin's Wiki and Linux Wiki.

You can download the source code (you will need also GCC-4.2.3 and Binutils-2.18), download the pre-compiled pack for installation, and/or the precompiled standard/debug executable in here.

If you have any question about Gujin, please ask them on a public list/forum (the ones on sourceforge should do the job), I simply cannot find the time to answer same questions by E-mail more than once, and then spend time to write FAQs.

Documentation

The documentation (FAQ & HowTo) I try to keep up to date is at the Document Manager of Sourceforge
Note also the file "install.txt" and the help given by --help/-h option of the "instboot" and "gzcopy" software included.

You basically have three flavour of the same software (produced by recompilation with different compiler switches):

One of the problem of using Gujin is that there is only one command line editable and stored, so it is difficult to manage multiple distributions with different command lines.
I have added a small executable named "gujin-cmdline" to insert an "embedded command line" into some free space of vmlinuz files (i.e. the end of the bootsector). The starting marker is simply "cmdline:" and the string has to be zero terminated, it has to be located below the first vmlinuz parameter. The maximum space there is currently 296 bytes.
This embedded command line can only be edited under Linux, use as:
./gujin-cmdline /boot/bzImage+2.6.24 # to display this embedded command line
./gujin-cmdline /boot/bzImage+2.6.24 "root=/dev/sda6" # to set it
Gujin will erase this field from memory before running the kernel, so Linux will never see the difference. Other bootloaders will not see any difference neither.

In short, to make all this possible, I wrote a GCC interface to the PC BIOS and all the library functions needed to easily boot a kernel.
I also wrote a DOS interface to be used if you booted a rescue DOS floppy or if you choose "return to DOS" in Windows 3.x/9x. This DOS software should work everywhere but will not be able to start Linux in a Windows DOS box - you do not want to do that anyways (too many open files not properly closed, so a scandisk at boot).
I am using a completely re-written GZIP (decompression only) library, 100% compatible with GZIP and zlib and a small Linux/UNIX "gzcopy" application to edit the comment field of GZIP files.
The main reason for the rewrite is a smaller program size, it has been seriously tested (10 CD-ROM full of .tar.gz decompressed and CRC checked), but if anyone find a problem (else than CDROM not readable or a file renamed to *.gz after being compressed with another tool) I will be glad to hear from it.
I am also using a completely re-written E2FS (read only) library, a DOS FAT12/16/32 (read only) and a ISO9660 library to search for and load kernels; they have been tested extensively (E2FS, E3FS with 1 & 4 Kbytes blocks, lot of DOS filesystems, CDROM and DVDROM), no problem has been found.
There isn't any NTFS nor CDROM/UDF support.
The system to access the video interface, which can handle in graphic modes CGA/EGA only, VGA only, VESA1 only and VESA2+ video card is unique to Gujin.
Four types of mouse are detected, for fun you can even have a joystick on a VT320 when using the serial interface - I have to make a screen shoot one day!
The size of this bootloader (only one file) is in between 50 and 200 Kbytes, depending on the compile time options (GCC-4.2.3 and binutils-2.18 as reference).

Screen Shoots

Screenshots are not easy to take in the real BIOS environment, but fortunately DosEmu is here, to give you some idea of what you get, just before switching to graphic (if verbose mode is active):
boot image

You should check at least once that this information is correct, for instance note that here, I have a partition 45667938 sectors (i.e. 21 Gbytes) bigger than the filesystem it contains (a 22 Gbytes partition where I copied the Damn Small Linux bootable CDROM by "cat /dev/cdrom ⊃ /dev/hda8" - obviouly a lot of wasted space for this 100 Mb CDROM); you can then uncheck the "verbose" box in the setup screen for a "quick" boot.

Just after switching to graphic, you will see something like this if you have a Linux distribution with a memtest floppy image and three kernels, a Redmond system, a CDROM image inside a partition, and the demo standalone *.kgz on a floppy:
main image

Then, if a mouse/joystick has been detected, you can click to one of the highlighted fields to either switch to another video mode or boot a kernel, else you can use the keyboard interface (keys '+', '-','/', '*' ... , and function keys).
Note that those kernels have been found automagically, they are not described in any "/etc/gujin.conf" file: this file do not and will never exist.

If you press "space" or the "setup" field (on the top right), you can setup the display and remove some fields (click on checkboxes):
setup image

So you get by re-clicking setup or re-pressing space:
simple image

The setup screen has a lot more checkboxes, to search kernel and/or MBR, to search on floppy disks or on BIOS disks or only on IDE...:
setup2 image

To show a screenshot of Gujin menu with CDROM/DVDs, I need to use another emulator: Bochs.
This one is slower but simulate correctly the (first session only) of CDROMs. If you want to generate more complex CDROMs than this one, you should read the few commands lines of target "CDall" and/or "CD_BDI" in file Makefile.
main Bochs image

You can also change the language used by a compilation option; now only French is available - look at "messages.h" file to help supporting your own language...
french setup image

At the end (press the end key or click on the button) you get some command, last one being "uninstall" to remove Gujin and restore the old boot process. Here, that option is not enabled because dosemu has booted from a floppy, so there isn't any saved boot sector:
cmd image

You can also get more unusual video modes, like text mode 40x25:
mode0 image

16 colors video modes in VGA only graphic:
sixteen color image

or even 4 colors video modes (2 Bit Per Pixel but in dosemu):
four color image

Yes, that is the same software, the same floppy!

By the way, if you do, on a test floppy:
./instboot --full boot.bin /dev/fd0 --serial=com1,9600,n,8,1
put this floppy in the PC to boot, and link the two PCs by a crossed serial line (with or without two modems and a phone line in between), you can type:
serial connection

The "serial initialisation failed" is due to no answer received whatsoever when interrogating the terminal type - Gujin then assumes a monochrome VT100 terminal. If you have a more powerful terminal, like a color VT430, or a VT420 which can do 132 columns and 48 lines, be sure to connect it before the identification code is asked (physical terminal autodetection).

You can start minicom and set it to /dev/ttyS0, 9600 baud and get:
serial menu

Active/clickable fields are underlined, as usual.

Selecting a kernel will really boot it (you will have the console on your serial line) - you will need to setup getty to accept connection on serial line (in /etc/inittab) if you want to connect (see also /etc/securetty).

Have fun!


Comments to Etienne Lorrain.
Donate to gujin boot/system loader   Donate to this project

Last modified 2008-02-04


[frdm] Support SFLC
Also, if you want to pay to see the GPL respected in France: http://freebox.flouzo.net

Gujin is hosted by SourceForge Logo