Gujin: Difference between revisions

Jump to navigation Jump to search
[unchecked revision][unchecked revision]
Content deleted Content added
No edit summary
m Bot: Replace deprecated source tag with syntaxhighlight
Line 44: Line 44:


Then, we reformat that dedicated USB stick as a bootable FAT filesystem, erasing all its content: first go in "root" by typing "su" or "sudo" (distribution dependant), then get the device name of you USB stick (let's say it is /dev/sdg) (sometimes /dev/mmcblk0 for SD cards), and type:
Then, we reformat that dedicated USB stick as a bootable FAT filesystem, erasing all its content: first go in "root" by typing "su" or "sudo" (distribution dependant), then get the device name of you USB stick (let's say it is /dev/sdg) (sometimes /dev/mmcblk0 for SD cards), and type:
<source lang="bash">
<syntaxhighlight lang="bash">
./gujin /dev/sdg --disk=BIOS:0x00,auto
./gujin /dev/sdg --disk=BIOS:0x00,auto
</syntaxhighlight>
</source>
Depending on the size of the USB stick, that will have created either a FAT16 or a FAT32 (or even a FAT12) filesystem, but that point is not really important.
Depending on the size of the USB stick, that will have created either a FAT16 or a FAT32 (or even a FAT12) filesystem, but that point is not really important.


Line 52: Line 52:


To check that this filesystem is correctly created, you can type:
To check that this filesystem is correctly created, you can type:
<source lang="bash">
<syntaxhighlight lang="bash">
/sbin/fsck.vfat /dev/sdg
/sbin/fsck.vfat /dev/sdg
</syntaxhighlight>
</source>


With the Gujin installer parameters we used, that would have created a "superfloppy" format on our USB stick, that is currently the format most PC will be able to understand and boot from.
With the Gujin installer parameters we used, that would have created a "superfloppy" format on our USB stick, that is currently the format most PC will be able to understand and boot from.
Line 100: Line 100:


Then compile it like (you may need to add "-fno-stack-protector" too, distribution dependant):
Then compile it like (you may need to add "-fno-stack-protector" too, distribution dependant):
<source lang="bash">
<syntaxhighlight lang="bash">
gcc -m32 -Wall -O2 -s -static -nostartfiles -nodefaultlibs -Wl,-Ttext=0x110000 hello.c -o hello.elf
gcc -m32 -Wall -O2 -s -static -nostartfiles -nodefaultlibs -Wl,-Ttext=0x110000 hello.c -o hello.elf
</source>
</syntaxhighlight>
and compress it by:
and compress it by:
<source lang="bash">
<syntaxhighlight lang="bash">
gzip -9 hello.elf -c > hello.kgz
gzip -9 hello.elf -c > hello.kgz
</syntaxhighlight>
</source>


You just need to copy that hello.kgz file into the USB stick, and reboot with this USB stick, you will get a menu with "hello.kgz" displayed.
You just need to copy that hello.kgz file into the USB stick, and reboot with this USB stick, you will get a menu with "hello.kgz" displayed.
Line 226: Line 226:


And then compile it by:
And then compile it by:
<source lang="bash">
<syntaxhighlight lang="bash">
gcc -m32 -Wall -Os -s -static -nostartfiles -nodefaultlibs -Wa,-R -Wl,--section-start,.init=0 hello_bios.c -o hello_bios.elf
gcc -m32 -Wall -Os -s -static -nostartfiles -nodefaultlibs -Wa,-R -Wl,--section-start,.init=0 hello_bios.c -o hello_bios.elf
</syntaxhighlight>
</source>
and compress it:
and compress it:
<source lang="bash">
<syntaxhighlight lang="bash">
gzip -9 hello_bios.elf -c > hello_bios.kgz
gzip -9 hello_bios.elf -c > hello_bios.kgz
</syntaxhighlight>
</source>
you can copy this hello_bios.kgz to the USB stick and run it, I hope the different functions of the source file are obvious.
you can copy this hello_bios.kgz to the USB stick and run it, I hope the different functions of the source file are obvious.