• Updated 2023-07-12: Hello, Guest! Welcome back, and be sure to check out this follow-up post about our outage a week or so ago.

Setting Up a Cross Compile Environment for Mac68K NetBSD

K55

Well-known member
:) Setting Up a Cross Compile Environment for Mac68K NetBSD :)

In this post I'm going to outline how to create and use a virtual environment to use a really fast PC to make programs for a really slow Mac. ;)

1: Set up your favorite VM with XXX settings (read on their site, I'm going to use virtualbox)

      a) Download NetBSD’s boot.iso for amd64 for the version you want to target (e.g. 6.0)

      b.) Probabaly 20GB is big enough for a HDD and say 2gb RAM and a CPU core just for the VM

2. Boot up netbsd, follow install instructions & install

                a)  Use the entire disk, default settings, install over FTP, wait an hour or so

                b.) Install pkgsrc and pkgin at the post install prompt and configure anything you’d like

3. Log in as root, we’re not going to use this as a serious computer so its ok

                a) Wait for everything to start up, and you should see the “#” indicator for the console

                b.) get the source for NetBSD as described here: https://www.netbsd.org/docs/guide/en/chap-fetch.html (the 1st section)

4. edit /etc/mk.conf with your favorite text editor and put this inside:

 # Cross-compile by default.
   #
   # XXX This currently can't be set to `yes' on the command line,
   # which is a bug.
USE_CROSS_COMPILE?=  yes

   # This is a kludge for cross-libtool.
   #
   # XXX Should not need this.
CROSSBASE=           ${LOCALBASE}/cross-${TARGET_ARCH:U${MACHINE_ARCH}}

.if !empty(USE_CROSS_COMPILE:M[yY][eE][sS])
   # Specify the machine architecture of target packages.
   #
   # XXX This currently can't be set on the command line, which is a
   # bug.
MACHINE_ARCH=       m68k

   # Point pkgsrc at the NetBSD tooldir and destdir.
   #
   # XXX There is no obvious variable that is set to amd64 so that we
   # could use
   #
   #    TOOLDIR=        /usr/obj/tooldir.${OPSYS}-${OS_VERSION}-${NATIVE_xyz}
   #
   # MACHINE is amd64 but, since it's not NATIVE_xyz, it's wrong.
   # NATIVE_MACHINE_ARCH is x86_64, not amd64.
TOOLDIR=             /usr/obj/tooldir.NetBSD-6.0-amd64
CROSS_DESTDIR=       /usr/obj/destdir.mac68k

   # Put target work and packages in separate directories.  (You might
   # use OBJMACHINE=yes or WRKOBJDIR=/tmp/work.${MACHINE_ARCH} instead
   # for the work directories.)
   #
   # XXX Should not need this.

PACKAGES=            ${PKGSRCDIR}/packages.${MACHINE_ARCH}
WRKDIR_BASENAME=     work.${MACHINE_ARCH}

.endif
 

5. Ok, now cd to /usr/src/, and run “./build.sh –m mac68k tools” then “./build.sh –m mac68k distribution” , this builds the cross compilation tools and takes around 1-2 hours to do.

:-x

6. Now we have to build libtool to be able to cross compile:

                a) $ cd /usr/pkgsrc/devel/libtool-base

                b.) edit the Makefile and change the pkgname to: "cross-libtool-base-m68k-2.4.2" (no quotes)

                c.)$ make package

                e) its going to give a output folder so we install that package: $ pkg_add –m m68k  /usr/pkgsrc/packages.m68k/All/cross-libtool-…...tgz

                e) now we also install libtool cross with pkgin and libtool with pkgin: “pkgin install cross-libtool-base”, if you get a warning just say yes, its fine

                f) libtool and everything else needs to be copied into the correct directory: $ cp -R /usr/pkg/bin/ /usr/pkg/cross-m68k/

7. If everything is fine, we should be able to crossbuild something. Lets try lynx:

                a) cd /usr/pkgsrc/www/lynx

                b.) make package…..wait….

8. FINALLY, you should have a file in    that you can transfer over to your mac and install using pkg_add. I’ve also included an image in this post that you can mount and try out. It should mostly work, but not all packages can cross compile, major unix knowledge is necessary!

Proof:
7CVI49X.png.952c7e6a0aef7d53d70eca528bbb9608.png


Torrent: http://www.mediafire.com/file/pfnablqey4tr36y/68kbsdimage.torrent

 
Last edited by a moderator:

Cory5412

Daring Pioneer of the Future
Staff member
It's downloading onto my system now, with the torrent. I'll keep that running as a seed.

I'm trying to reattach the .torrent file to this post. EDIT: I see. I'll have to talk to wthww/Bunsen about whether it would be appropriate for us to allow attaching .torrent files to the forum.

I'll see about putting it up in another alternate folder as well, for plain HTTP download.

 
Last edited by a moderator:
Top