Linux Genesis Dev Setup

Talk about development tools here

Moderator: BigEvilCorporation

doragasu
Very interested
Posts: 125
Joined: Tue Oct 09, 2012 8:15 am

Post by doragasu » Sat Aug 03, 2013 9:51 am

I got some more time to play with this and finally got it to work! Grabbed SGDK "windows only" makefile and started modifying it to work with GNU/Linux. At first, object files were built, but failed when linking:

Code: Select all

m68k-elf-gcc -n -T /opt/toolchains/gen/ldscripts/md.ld -nostdlib out/sega.o @out/cmd_ /opt/toolchains/gen/m68k-elf/lib/libmd.a /opt/toolchains/gen/m68k-elf/lib/gcc/m68k-elf/4.5.2/libgcc.a -o out/rom.out
/opt/toolchains/gen/m68k-elf/lib/libmd.a(memory.o): In function `MEM_init':
memory.c:(.text+0x2): undefined reference to `_bend'
collect2: ld returned 1 exit status
make: *** [out/rom.out] Error 1
It couldn't find _bend symbol. I browsed libmd.a to see if it was there, and it is, but undefined (prefixed with 'U' character):

Code: Select all

$ m68k-elf-nm $GDK/m68k-elf/lib/libmd.a
[...]
memory.o:
00000064 T MEM_alloc
00000052 T MEM_free
00000028 T MEM_getFree
00000000 T MEM_init
         U _bend
000001b0 T fastMemcpy
000001cc T fastMemcpyU16
000001ea T fastMemcpyU32
00000154 T fastMemset
00000174 T fastMemsetU16
00000194 T fastMemsetU32
00000000 b free
00000004 b heap
         U memcpy
00000116 T memcpyU16
00000134 T memcpyU32
         U memset
         U memsetU16
         U memsetU32
[...]
Then I grep the sources, and the only reference to "bend" I found was (as expected) in memory.c:

Code: Select all

// end of bss segment --> start of heap
extern u32 _bend;
It is defined as an external symbol, and as it is not defined in any other source file, I suspected it could be defined in the linker file. But it was not in the one installed by the script. So I opened the one inside SGDK package and bingo!:

Code: Select all

  .bss 0xFF0000 + SIZEOF (.data) :
  {
    _start = . ;
    *(.shbss)
    *(.bss .bss.*)
    *(COMMON)
    _bend = . ;
  } > ram
Replaced installed md.ld with latest SGDK md.ld, and the ROM was built. And it works!

If anyone wants to test the Makefile, you can find it here. You will also have to overwrite the md.ld linker file using the one from SGDK sources, and copy the src directory from SGDK to $GDK/src. I have also used $GDK variable to point to the toolchain instead of the one the build script initially set up ($GENDEV).

User avatar
Stef
Very interested
Posts: 2630
Joined: Thu Nov 30, 2006 9:46 pm
Location: France - Sevres
Contact:

Post by Stef » Sat Aug 03, 2013 10:32 am

ElBarto wrote: It means set if not defined

SHELL?=$(BIN)/sh

is equivalent to :

.ifndef SHELL
SHELL=$(BIN)/sh
.endif
Oh ok, thanks :) I'll modify it this way then.

doragasu>Glad you got it working, seems like the linux dev env was a bit outdated compared to the last SGDK build :)

User avatar
Stef
Very interested
Posts: 2630
Joined: Thu Nov 30, 2006 9:46 pm
Location: France - Sevres
Contact:

Post by Stef » Sat Aug 03, 2013 10:45 am

This syntax:

Code: Select all

SHELL?=$(BIN)/sh
is definitely not recognized by my version of make, i guess i have to work with ifndef / endif couple.

User avatar
kubilus1
Very interested
Posts: 221
Joined: Thu Aug 16, 2012 2:25 am
Contact:

Added SegaCD build

Post by kubilus1 » Sun Nov 03, 2013 5:49 pm

I've added the ability to build Sega CD images in the sgdk/skeleton make directory. Using the stuff in the new build skeleton should allow small programs to work by executing a:

$ make out.iso

Roms must be 256K or smaller to work and currently this only support 1 Rom.

This is based off of the work in LukeProjectCD. I've modified several of the files so this works with gnu-assembler and only other Linux native tools (No 'wine ASM68K.EXE!!')

Zontar
Very interested
Posts: 55
Joined: Fri Oct 21, 2011 8:58 pm

Post by Zontar » Sat Feb 01, 2014 4:12 am

Trying to install the latest version on my laptop for when I go on a trip. I think the new version has a build problem? Make aborts with an Error 1 and doesn't create a .gendev directory. Building on Ubuntu 12.10.

User avatar
kubilus1
Very interested
Posts: 221
Joined: Thu Aug 16, 2012 2:25 am
Contact:

Post by kubilus1 » Sat Feb 01, 2014 8:01 pm

There is a problem with texinfo > 5.0. Rolling back to an earlier version of texinfo should work, but there is probably a better way to solve this.

Mask of Destiny
Very interested
Posts: 558
Joined: Thu Nov 30, 2006 6:30 am

Post by Mask of Destiny » Sun Feb 02, 2014 1:56 am

The most recent version of gcc builds fine with texinfo 5. I did some work on updating the makefile and scripts to work with the latest version of gcc and binutils. I just did the bare minimum to build the toolchain, but I could probably clean it up and produce a diff if there's interest.

User avatar
kubilus1
Very interested
Posts: 221
Joined: Thu Aug 16, 2012 2:25 am
Contact:

Post by kubilus1 » Sun Feb 02, 2014 3:43 am

I would definitely be interested in seeing that!

Mask of Destiny
Very interested
Posts: 558
Joined: Thu Nov 30, 2006 6:30 am

Post by Mask of Destiny » Mon Feb 03, 2014 6:47 am

I've uploaded a diff here: http://rhope.retrodev.com/files/gcc_4_8_2.diff. It updates the main Makefile and makefile-gen.diff to build gcc 4.8.2 and binutils 2.24 which are the latest versions. They seem to work fine with SGDK, but I didn't do any extensive testing.[/url]

Zontar
Very interested
Posts: 55
Joined: Fri Oct 21, 2011 8:58 pm

Post by Zontar » Sun Apr 27, 2014 1:25 pm

I see some changes are being made. :D

However, I think one broke x86-64 support in the latest. Or my setup (which I'm soon leaving for Ubuntu 14.04) is bad. Recently tried to recompile and got this:
/usr/bin/ld: i386 architecture of input file `../lib/elf/aplib.a(spack.o)' is incompatible with i386:x86-64 output
/usr/bin/ld: i386 architecture of input file `../lib/elf/aplib.a(sgetsize.o)' is incompatible with i386:x86-64 output
/usr/bin/ld: i386 architecture of input file `../lib/elf/aplib.a(sdepack.o)' is incompatible with i386:x86-64 output
/usr/bin/ld: i386 architecture of input file `../lib/elf/aplib.a(depacks.o)' is incompatible with i386:x86-64 output
/usr/bin/ld: i386 architecture of input file `../lib/elf/aplib.a(crc32.o)' is incompatible with i386:x86-64 output
/usr/bin/ld: i386 architecture of input file `../lib/elf/aplib.a(aplib.o)' is incompatible with i386:x86-64 output

User avatar
kubilus1
Very interested
Posts: 221
Joined: Thu Aug 16, 2012 2:25 am
Contact:

Post by kubilus1 » Sun Apr 27, 2014 2:33 pm

Ahh. I'm running 32 bit ATM. Got a few other changes I would like to do but have been busy with life and work.

I have started to put the together a Vagrant Genesis development build environment. That should allow pretty much anyone to have a Dev environment regardless of OS choice( mac , Linux, BSD, windows)

User avatar
kubilus1
Very interested
Posts: 221
Joined: Thu Aug 16, 2012 2:25 am
Contact:

Post by kubilus1 » Sun Apr 27, 2014 10:15 pm

Okay, I've added a patched appack provided by r57shell and patched the makefile to hopefully build the 64 bit binary correctly. Problem was it was always pointing to the 32 bit aplib.a.

Pull in the changes and give it a try.

Zontar
Very interested
Posts: 55
Joined: Fri Oct 21, 2011 8:58 pm

Post by Zontar » Sun May 04, 2014 6:42 pm

All right, wish I could test but I've recently upgraded to Ubuntu 14.04, which got me bitten by the texinfo 5 bug. Tried applying Mask of Destiny's diff but I may be doing it wrong as it gives an error when patching Makefile. I'll have to look further into this when I have the time.

Chilly Willy
Very interested
Posts: 2493
Joined: Fri Aug 17, 2007 9:33 pm

Post by Chilly Willy » Thu May 08, 2014 5:22 pm

Zontar wrote:All right, wish I could test but I've recently upgraded to Ubuntu 14.04, which got me bitten by the texinfo 5 bug. Tried applying Mask of Destiny's diff but I may be doing it wrong as it gives an error when patching Makefile. I'll have to look further into this when I have the time.
I'm in the process of updating to 14.04. I always wait a week or so for the rush to die down (swamped servers), and for a few emergency bug-fixes to be released.

User avatar
kubilus1
Very interested
Posts: 221
Joined: Thu Aug 16, 2012 2:25 am
Contact:

Post by kubilus1 » Sat May 10, 2014 1:57 am

Okay, I finally got around to applying the patch that MaskOfDestiny provided. (Thanks for providing that!)

Give that a whirl and see if it works for you.

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest