Everything's ready to get glued together. The only thing we need is a bootloader that helps us to get our stuff into the memory and execute it:
$ cd BUILD $ tar -xvzf ../SRC/sh-boot-20010831-1455.tar.gz -C . $ patch -p0 < ../SRC/sh-boot-20010831-1455.diff
The next steps create a file kernel-boot.bin that contains the Linux kernel and the initial ramdisk. So, these steps have to be done every time, you change either the Linux kernel or something within the initial ramdisk (e.g. copy a new program to it or modify the configuration):
$ cd sh-boot/tools/dreamcast $ cp ../../../../KERNEL/linux/arch/sh/boot/zImage \ ./zImage.bin $ cp ../../../../initrd.bin . $ make scramble kernel-boot.bin
Now, you've got two possibilities.
Edit the file roast.sh
and change the value CDRECORD for your
needs (i.e. the SCSI device id). Afterwards, insert a CD-R and burn your
first embedded Linux distribution by typing:
$ ./roast.sh kernel-boot.bin
Insert the disc in your SEGA Dreamcast and hit the power button. Hopefully, you'll see the Linux-SH penguin in the upper left corner of your screen while the SEGA Dreamcast waits for your login.
First, you have to download the server and client tools for enjoying saving money.
$ cd ../../../../SRC $ wget http://adk.napalm-x.com/dc/\ dcload-serial/dcload-1.0.3-1st_read.zip $ wget http://adk.napalm-x.com/dc/\ dcload-serial/dc-tool-serial-1.0.3-linux.gz $ gunzip dc-tool-serial-1.0.3-linux.gz $ mkdir ../LOADER $ mv dc-tool-serial-1.0.3-linux ../LOADER $ chmod u+x ../LOADER/dc-tool-serial-1.0.3-linux $ mkdir ../BUILD/server.disc $ unzip dcload-1.0.3-1st_read.zip -d ../BUILD/server.disc $ cd ../BUILD/server.disc
Now, you have to create the server disc. Following Marcus Comstedt's HowTo [Comstedt00], a bootable CD-R for the SEGA Dreamcast should have two sessions. The first should contain only a normal audio track. The second session should contain a CD/XA data track (mode 2 form 1). This data track ought to contain a regular ISO9660 file system, and in the first 16 sectors a correct bootstrap (IP.BIN).
First you have to burn the audio session. The simplest option is just to create 4 seconds (the minimum track length) of silence, like:
$ dd if=/dev/zero bs=2352 count=300 of=audio.raw
Next, insert a blank CD-R (the SEGA Dreamcast can't read CD-RW without any modification) and burn the audio track. Make sure that you leave the disc open for further sessions, the -multi option to cdrecord takes care of that:
$ cdrecord dev=0,1,0 -multi -audio audio.raw
Please take care that you're allowed to burn the disc and that you're using the right device. Now that the audio track has been burned, it is possible to create the ISO filesystem image. But first, you have to find out the offset where you can start off the data track. To find out this number, run
$ cdrecord dev=0,1,0 -msinfo
with the disc still in the drive. You should get two numbers separated by comma (for example 0,11700). Remember these numbers. Now create the ISO image with mkisofs:
$ mkisofs -l -C x,y -o tmp.iso \ ./dcload-1.0.3-1st_read/scrambled/1st_read.bin
where x,y is the pair of numbers you got with -msinfo earlier. Make sure you get them correctly, or the image won't work.
The first 16 sectors of an ISO9660 filesystem are blank, to leave room for bootstraps. This is where IP.BIN (32768 bytes) goes. So, we glue the tmp.iso together with the IP.BIN file:
$ ( cat ./dcload-1.0.3-1st_read/IP.BIN ; \ dd if=tmp.iso bs=2048 skip=16 ) > data.raw
Finally, you're ready to burn the second session and complete the disc. This track has to be burned as CD/XA with form 1 sectors (2048 bytes per sector). Use the -xa1 option to cdrecord:
$ cdrecord dev=0,1,0 -multi -xa1 data.raw
Now, you only have to insert your serial loader server disc into your dreamcast and hit the power button. After a while, you'll see the idle... prompt. Now, on your host, you have to invoke the loading process by typing:
$ cd ../../LOADER $ ./dc-tool-serial-1.0.3-linux\ -t /dev/ttyS1 -e -b 115200 -x \ ../BUILD/sh-boot/tools/dreamcast/kernel-boot.bin
Please note, that you probably have to change the serial port /dev/ttyS?
.
Wait a moment and, hopefully, you'll see your SEGA Dreamcast is booting
your Linux kernel and your initial ramdisk.
Congratulations. You overcome the first steps.