Notes on Linux for Dreamcast

I wanted to write down some notes about compiling Linux on Dreamcast (which I have yet to follow through to success). But before I do, allow me to follow up on my last post where I got Google’s libvpx library decoding VP8 video on the DC. Remember when I said the graphics hardware could only process variations of RGB color formats? I was mistaken. Reading over some old documentation, I noticed that the DC’s PowerVR hardware can also handle packed YUV textures (UYVY, specifically):

The video looks pretty sharp in the small photo. Up close, less so, due to the low resolution and high quantization of the test vector combined with the naive chroma upscaling. For the curious, the grey box surrounding the image highlights the 256-square texture that the video frame gets plotted on. Texture dimensions have to be powers of 2.

Notes on Linux for Dreamcast
I’ve occasionally dabbled with Linux on my Dreamcast. There’s an ancient (circa 2001) distro based around a build of kernel 2.4.5 out there. But I wanted to try to get something more current compiled. Thus far, I have figured out how to cross compile kernels pretty handily but have been unsuccessful in making them run.

Here are notes are the compilation portion:

  • provides a very useful set of cross compiling toolchains
  • get the gcc 4.5.1 cross toolchain for SH-4 (the gcc 4.3.3 one won’t work because the binutils is too old; it will fail to assemble certain instructions as described in this post)
  • working off of Linux kernel 2.6.37, edit the top-level Makefile; find the ARCH and CROSS_COMPILE variables and set appropriately:
    ARCH            ?= sh
    CROSS_COMPILE   ?= /path/to/gcc-4.5.1-nolibc/sh4-linux/bin/sh4-linux-
  • $ make dreamcast_defconfig
  • $ make menuconfig … if any changes to the default configuration are desired
  • manually edit arch/sh/Makefile, changing:
    cflags-$(CONFIG_CPU_SH4)                := $(call cc-option,-m4,) \
            $(call cc-option,-mno-implicit-fp,-m4-nofpu)


    cflags-$(CONFIG_CPU_SH4)                := $(call cc-option,-m4,) \
            $(call cc-option,-mno-implicit-fp)

    I.e., remove the '-m4-nofpu' option. According to the gcc man page, this will “Generate code for the SH4 without a floating-point unit.” Why this is a default is a mystery since the DC’s SH-4 has an FPU and compilation fails when enabling this option.

  • On that note, I was always under the impression that the DC sported an SH-4 CPU with the model number SH7750. According to this LinuxSH wiki page as well as the Linux kernel help, it actually has an SH7091 variant. This photo of the physical DC hardware corroborates the model number.
  • $ make … to build a Linux kernel for the Sega Dreamcast

So I can compile the kernel but running the kernel (the resulting vmlinux ELF file) gives me trouble. The default kernel ELF file reports an entry point of 0x8c002000. Attempting to upload this through the serial uploading facility I have available to me triggers a system reset almost immediately, probably because that’s the same place that the bootloader calls home. I have attempted to alter the starting address via ‘make menuconfig’ -> System type -> Memory management options -> Physical memory start address. This allows the upload to complete but it still does not run. It’s worth noting that the 2.4.5 vmlinux file from the old distribution can be executed when uploaded through the serial loader, and it begins at 0x8c210000.

5 thoughts on “Notes on Linux for Dreamcast

  1. bob

    Hi Mike,

    The linux kernel won’t boot starting from commit 37b7a97884ba64bf7d403351ac2a9476ab4f1bba. Hope that helps.

  2. Multimedia Mike Post author

    @bob: Thanks. It actually does help to learn whether a program is expected to work or not. That gives me an angle for debugging.

  3. bob

    I should note that even before that commit, the linux kernel won’t boot directly on the dreamcast. For some reason the start address is set to 0x8c000000, so it cannot be booted from a CD-rom or from dctool/dcload. If I set the start address to 0x8c00e000 I am able to boot it with lxdream. However I never got the kernel to load on the hardware.

    If you find a way to work around this, please let me know, I already have a full userspace waiting for a working kernel.

  4. mark

    Hi Mike,

    I know this post is really old, but did you ever manage to boot any 2.6.* kernel on the dreamcast or lxdream?

    I have a gcc-4.5.3 with binutils-2.22 but i cant’t build a working kernel (tried different versions all < 2.6.32). Looks like the entry point of the ELF file does not matter at least if you try with lxdream. I can boot some different kernels <2.6.32 but they only show the superh logo and then stops with 100% cpu usage and following error message:
    8C00317A WARN ARM Halted: BRANCH to invalid address 00200000 at 00200000

    Maybe you recall which combination of gcc/binutils/kernel worked for you. I would be very happy if it would just boot in lxdream as a first step.

  5. Multimedia Mike Post author

    @mark: Nope, I never had any success booting a Dreamcast kernel that I built myself. I was only ever able to boot that really old DC-Linux distro from 2001.

Comments are closed.