LWN.net Logo

Gujin GPL bootloader version 2.6

From:  Etienne Lorrain <etienne_lorrain@yahoo.fr>
To:  linux-kernel@vger.kernel.org
Subject:  [ANNOUNCE] Gujin GPL bootloader version 2.6
Date:  Tue, 12 May 2009 22:01:08 +0000 (GMT)
Message-ID:  <26299.12218.qm@web23602.mail.ird.yahoo.com>
Archive-link:  Article, Thread


There is a new version v2.6 of Gujin at http://gujin.sf.net with 

bugfixes and improvement, like: 

  - Better PCI BIOS to detect IDE interfaces (SATA CDROM at non

  conventional address)

  - Better EDID BIOS support (screen definition detection)

  - Fix modification of *.iso images, fix ELF32/64 handling by

  tiny images.

  - works with GCC-4.4, works with every distribution-provided

  compiler I tested.

  - Align by default the clusters of FAT16/32 filesystems even if

  the start of the partition isn't aligned, generate FAT32 useable

  by Windows.

  - Completely remove the support for zImage and for locating

  the ELF in the Linux kernel, now only the official way to boot a

  bzImage Linux kernel is possible, and *.kgz files have to be

  compressed ELF32/64 files.

  - Gives few examples of ELF32 and ELF64 bootable kgz files,

  with and without memory relocation by using ld option --emit-relocs:

  see hello*.kgz in Makefile.

  - Generate a "gujin" executable, which is "instboot + few embedded

  boot images" for either 32 or 64 bits Linux, to use like (as root):



    -> to install the way GRUB or LILO installs themselves:

./gujin /boot/gujin.ebios

    -> to remove (and re-install previous bootloader)

./gujin --remove=/dev/sda && rm /boot/gujin.ebios

    -> to initialise a "superfloppy" FAT filesystem on a USB drive:

umount /dev/sdz*      # device /dev/sdz will be ERASED

./gujin --disk=BIOS:0x0,auto /dev/sdz

    -> to  transform a bootable ISO file and write it to a USB stick:

umount /dev/sdz*      # device /dev/sdz will be ERASED

./gujin eeebuntu-2.0-standard.iso \\

        && cat eeebuntu-2.0-standard.iso > /dev/sdz && sync

    -> for more example, use gujin without parameters,

        or with --help parameter.

 



 The simplest bootable "hello world" kgz file is:

/*  To be compiled by:

$ gcc -m32 -Wall -O2 -s -static -nostartfiles -nodefaultlibs \

   -Wl,-Ttext=0x110000 hello.c -o hello.elf

$ gzip -9 hello.elf -c > hello.kgz

*/

const char msg1[] = "Hello protected-mode text world! please reboot ...";

#define STACKSIZE 64 * 1024

static unsigned stack[STACKSIZE / 4] __attribute__ ((aligned(32)));

void _start (void)

{

    /* We are flat non-paged memory and interrupt disabled */

    asm (" mov %0,%%esp " : : "i" (&stack[STACKSIZE / 4]));

    /* This work only in text modes (assumed mode 3), video

    memory at real mode address 0xB800:0000. At this address,

    we shall write two bytes per char, one  containing the foreground

    and background color, the other containing the letter: */

    volatile unsigned short *video_array
         = (volatile unsigned short *)0xB8000;

    unsigned cpt1;



    video_array += 10 * 80;  /* few empty lines */

    /* We want blue background color and lightgray foreground: */

    for (cpt1 = 0; cpt1 < sizeof(msg1) - 1; cpt1++)

            video_array[cpt1] = 0x1700 + msg1[cpt1];

    while (1)

        continue;

}



 Downloads at:

http://sourceforge.net/project/showfiles.php?group_id=15465



  Have fun,

  Etienne.



      

Copyright © 2009, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds