Add m68k binutils and gcc and add dbztool

This commit is contained in:
PulkoMandy
2025-02-22 22:43:05 +01:00
parent 251861cbd4
commit fa31665768
4 changed files with 367 additions and 0 deletions

View File

@@ -0,0 +1,46 @@
SUMMARY="Motorola Dragonball bootstrap tool"
DESCRIPTION="Command-line tool for manipulating the bootstrap interface of a Dragonball VZ \
processor. It allows you to upload and download data, run programs, examine and modify the \
system registers, etc. Currently it's only been tested on the Alphasmart Dana but it should \
work on other machines too (although a number of places in the code assume you're using UART1, \
which need to be fixed)."
HOMEPAGE="https://github.com/davidgiven/dbztool"
COPYRIGHT="2021 David Given"
LICENSE="BSD (2-clause)"
SOURCE_URI="https://github.com/davidgiven/dbztool/archive/742153af9333afdcee1d47b554afa56d5791dbfb.tar.gz"
SOURCE_DIR="dbztool-742153af9333afdcee1d47b554afa56d5791dbfb"
CHECKSUM_SHA256="e33526550ece3a0d0231d0dccb1d9ecf1a4bc9cd531d8096bac0d102159a6947"
REVISION="1"
PATCHES="dbztool-$portVersion.patchset"
ARCHITECTURES="all"
PROVIDES="
dbztool$secondaryArchSuffix = $portVersion
cmd:dbztool$secondaryArchSuffix = $portVersion
"
REQUIRES="
haiku$secondaryArchSuffix
"
BUILD_REQUIRES="
haiku${secondaryArchSuffix}_devel
"
BUILD_PREREQUIRES="
cmd:gcc$secondaryArchSuffix
cmd:m68k_elf_gcc
cmd:make
cmd:ninja
cmd:xxd
"
BUILD()
{
make $jobArgs
}
INSTALL()
{
mkdir -p $binDir
cp dbztool $binDir
}

View File

@@ -0,0 +1,45 @@
From 5520861ac4bb11bf683309cc7d07c5722774187e Mon Sep 17 00:00:00 2001
From: PulkoMandy <pulkomandy@pulkomandy.tk>
Date: Sat, 22 Feb 2025 22:39:29 +0100
Subject: Adjust for Haiku
- Link against libbsd for cfsetspeed
- Remove FNM_EXTMATCH (unsupported in Haiku)
- Adjust name of m68k C compiler
diff --git a/Makefile b/Makefile
index 4111755..7daa2b5 100644
--- a/Makefile
+++ b/Makefile
@@ -4,11 +4,11 @@ export CXX = g++
export AR = ar rc
export RANLIB = ranlib
export STRIP = strip
-export LIBS =
+export LIBS = -lbsd
-export CC68K = m68k-linux-gnu-gcc
-export LD68K = m68k-linux-gnu-ld
-export OBJCOPY68K = m68k-linux-gnu-objcopy
+export CC68K = m68k-elf-gcc
+export LD68K = m68k-elf-ld
+export OBJCOPY68K = m68k-elf-objcopy
export C68KFLAGS = -g -Os -fomit-frame-pointer -march=68000
export OBJDIR = .obj
diff --git a/src/mc68328.cc b/src/mc68328.cc
index 77f7ae8..e4cd165 100644
--- a/src/mc68328.cc
+++ b/src/mc68328.cc
@@ -173,7 +173,7 @@ bool foreach_register(const char* glob, std::function<bool(const std::string& na
{
for (const auto& i : registers)
{
- if (fnmatch(glob, i.first.c_str(), FNM_CASEFOLD|FNM_EXTMATCH) == 0)
+ if (fnmatch(glob, i.first.c_str(), FNM_CASEFOLD) == 0)
{
if (cb(i.first, i.second))
return true;
--
2.45.2

View File

@@ -0,0 +1,153 @@
SUMMARY="Assembler, linker and binary tools for m68k family processors"
DESCRIPTION="The GNU Binutils are a collection of binary tools.
The main ones are:
- ld - the GNU linker.
- as - the GNU assembler.
But they also include:
- addr2line - converts addresses into filenames and line numbers.
- ar - a utility for creating, modifying and extracting of archives.
- c++filt - filter to demangle encoded C++ symbols.
- nm - lists symbols from object files.
- objcopy - copys and translates object files.
- objdump - displays information from object files.
- ranlib - generates an index to the contents of an archive.
- readelf - displays information from any ELF format object file.
- size - lists the section sizes of an object or archive file.
- strings - lists printable strings from files.
- strip - discards symbols.
The tools of this package can be used for cross-builds to $effectiveTargetMachineTriple."
HOMEPAGE="https://www.gnu.org/software/binutils"
COPYRIGHT="1988-2024 Free Software Foundation, Inc."
LICENSE="GNU GPL v3
GNU LGPL v3"
REVISION="1"
SOURCE_URI="https://ftp.gnu.org/gnu/binutils/binutils-$portVersion.tar.xz"
SOURCE_DIR="binutils-$portVersion"
CHECKSUM_SHA256="ce2017e059d63e67ddb9240e9d4ec49c2893605035cd60e92ad53177f4377237"
ARCHITECTURES="all !x86_gcc2"
SECONDARY_ARCHITECTURES="x86"
targetArch="m68k-elf"
targetU="m68k_elf"
PROVIDES="
${targetU}_binutils$secondaryArchSuffix = $portVersion compat >= 2.44
cmd:${targetU}_addr2line = $portVersion compat >= 2.44
cmd:${targetU}_ar = $portVersion compat >= 2.44
cmd:${targetU}_as = $portVersion compat >= 2.44
cmd:${targetU}_c++filt = $portVersion compat >= 2.44
cmd:${targetU}_elfedit = $portVersion compat >= 2.44
cmd:${targetU}_gprof = $portVersion compat >= 2.44
cmd:${targetU}_ld = $portVersion compat >= 2.44
cmd:${targetU}_ld.bfd = $portVersion compat >= 2.44
cmd:${targetU}_nm = $portVersion compat >= 2.44
cmd:${targetU}_objcopy = $portVersion compat >= 2.44
cmd:${targetU}_objdump = $portVersion compat >= 2.44
cmd:${targetU}_ranlib = $portVersion compat >= 2.44
cmd:${targetU}_readelf = $portVersion compat >= 2.44
cmd:${targetU}_size = $portVersion compat >= 2.44
cmd:${targetU}_strings = $portVersion compat >= 2.44
cmd:${targetU}_strip = $portVersion compat >= 2.44
lib:${targetU}_libbfd_$binutilsVersion$secondaryArchSuffix = $portVersion compat >= 2.44
lib:${targetU}_libopcodes_$binutilsVersion$secondaryArchSuffix = $portVersion compat >= 2.44
lib:libctf_nobfd$secondaryArchSuffix = 0.0.0 compat >= 0
lib:libctf$secondaryArchSuffix = 0.0.0 compat >= 0
lib:libsframe$secondaryArchSuffix = 0.0.0 compat >= 0
devel:libctf_nobfd$secondaryArchSuffix = 0.0.0 compat >= 0
devel:libctf$secondaryArchSuffix = 0.0.0 compat >= 0
devel:libsframe$secondaryArchSuffix = 0.0.0 compat >= 0
"
REQUIRES="
binutils$secondaryArchSuffix
haiku$secondaryArchSuffix
"
BUILD_REQUIRES="
haiku${secondaryArchSuffix}_devel
cmd:find
cmd:xargs
"
BUILD_PREREQUIRES="
cmd:autoconf
cmd:awk
cmd:bison
cmd:find
cmd:flex
cmd:gcc$secondaryArchSuffix
cmd:ld$secondaryArchSuffix
cmd:make
cmd:makeinfo
cmd:sed
cmd:strip
cmd:tar
cmd:xargs
"
BUILD_PACKAGE_ACTIVATION_PHASE=INSTALL
sourceDir=$(pwd)
relativeInstallDir="develop/tools/${targetArch}"
installDir="$prefix/$relativeInstallDir"
objectsDir=$(pwd)/../${portVersionedName}-obj
BUILD()
{
rm -rf $objectsDir
mkdir -p $objectsDir
cd $objectsDir
CFLAGS=-O2 CXXFLAGS=-O2 runConfigure --omit-dirs binDir \
"$sourceDir/configure" \
--exec-prefix=$installDir \
--includedir=$includeDir/binutils \
--docdir=$docDir --with-sysroot=$installDir \
--enable-deterministic-archives --enable-shared=yes \
--disable-nls --bindir=$prefix/bin --target=${targetArch}
make $jobArgs LEXLIB=
}
INSTALL()
{
cd $objectsDir
make install
# no info documentation
rm -r $infoDir
### Strip #################################################
echo "Strip debug info"
strip --strip-debug $prefix/bin/*
### Symlinks ##############################################
echo "Creating required symlinks"
# There are copies of a subset of the commands below installDir. We
# overwrite those with symlinks to the ones in binDir.
for file in $installDir/${targetArch}/bin/*; do
symlinkRelative -sfn $prefix/bin/${targetArch}-$(basename $file) $file
done
### Cleanup #################################################
echo "Cleanup"
# delete man pages for commands that we aren't including
cd $manDir
for cmd in dlltool nlmconv windmc windres; do
rm -f man1/$cmd.1
done
rm $libDir/*.la $libDir/*.a
prepareInstalledDevelLibs libctf libsframe
}

View File

@@ -0,0 +1,123 @@
SUMMARY="C/C++ cross-compiler for m68k CPU family"
DESCRIPTION="Compiler for m68k CPU family."
HOMEPAGE="http://gcc.gnu.org"
SOURCE_URI="http://ftpmirror.gnu.org/gcc/gcc-$portVersion/gcc-$portVersion.tar.xz"
SOURCE_DIR="gcc-$portVersion"
CHECKSUM_SHA256="61d684f0aa5e76ac6585ad8898a2427aade8979ed5e7f85492286c4dfc13ee86"
REVISION="1"
LICENSE="
GNU GPL v2
GNU LGPL v2
"
COPYRIGHT="1988-2023 Free Software Foundation, Inc."
ARCHITECTURES="all !x86_gcc2"
SECONDARY_ARCHITECTURES="x86"
targetArch="m68k-elf"
targetU="m68k_elf"
PROVIDES="
${targetU}_gcc$secondaryArchSuffix = $portVersion compat >= 4
cmd:${targetU}_c++ = $portVersion compat >= 4
cmd:${targetU}_cc = $portVersion compat >= 4
cmd:${targetU}_cpp = $portVersion compat >= 4
cmd:${targetU}_g++ = $portVersion compat >= 4
cmd:${targetU}_gcc = $portVersion compat >= 4
cmd:${targetU}_gcc_$portVersion = $portVersion compat >= 4
cmd:${targetU}_gcov = $portVersion compat >= 4
lib:${targetU}_libstdc++$secondaryArchSuffix = $portVersion compat >= 4
"
REQUIRES="
haiku$secondaryArchSuffix
cmd:${targetU}_as
lib:libgmp$secondaryArchSuffix
lib:libmpfr$secondaryArchSuffix
lib:libmpc$secondaryArchSuffix
"
BUILD_REQUIRES="
cmd:${targetU}_as >= 2.44
devel:libgmp$secondaryArchSuffix
devel:libmpfr$secondaryArchSuffix
devel:libmpc$secondaryArchSuffix
"
BUILD_PREREQUIRES="
haiku${secondaryArchSuffix}_devel
cmd:autoconf
cmd:awk
cmd:bison
cmd:find
cmd:flex
cmd:gcc$secondaryArchSuffix
cmd:ld$secondaryArchSuffix
cmd:make
cmd:makeinfo
cmd:sed
cmd:strip
cmd:tar
cmd:xargs
"
sourceDir=$(pwd)
relativeInstallDir="develop/tools/${targetArch}"
installDir="$prefix/$relativeInstallDir"
objectsDir=$(pwd)/../${portVersionedName}-obj
BUILD()
{
rm -rf $objectsDir
# Touch some files generated by bison, so that bison won't run to update
# them. Fixes issues with newer bison versions.
# And while at it, touch gperf target, too (as gperf may not be installed).
(cd $sourceDir/gcc; touch c-parse.c c-parse.h cexp.c cp/parse.c \
cp/parse.h c-gperf.h)
mkdir -p $objectsDir
cd $objectsDir
# Setting a quoted string in an environment variable is ugly (the quotes
# are removed at various stages and need an absurd amount of escaping), so
# let's use a file and --include instead.
echo '#define LIBRARY_PATH_ENV "ARM_LIBRARY_PATH"' > haiku_host.h
CXXFLAGS="-O2 -include $objectsDir/haiku_host.h -fPIC" \
CFLAGS="-O2 -U_FORTIFY_SOURCE -fPIC" "$sourceDir/configure" \
--build=$effectiveTargetMachineTriple \
--prefix=$installDir --libexecdir=$installDir/lib --mandir=$manDir \
--docdir=$docDir --disable-nls --with-gnu-ld \
--enable-languages=c,c++ --enable-lto --enable-frame-pointer \
--enable-multilib --disable-shared \
--without-headers --with-newlib \
--with-sysroot=$installDir \
--with-native-system-header-dir=/include \
--with-pkgversion=$(echo $portVersion | cut -c 7-) --target=$targetArch
echo "configure done, start build"
make $jobArgs all-gcc all-target-libgcc
}
INSTALL()
{
cd $objectsDir
make install-gcc install-target-libgcc
### Symlinks ##############################################
echo "Creating required symlinks"
# make all tools available via default paths
mkdir -p $prefix/bin
for f in c++ cc cpp g++ gcc gcov; do
symlinkRelative -sfn $installDir/bin/$targetArch-$f $prefix/bin
done
### Cleanup ###############################################
echo "Cleanup"
rm -rf $installDir/info
rm -rf $installDir/share
}