From ff9c250a3ec05c9afa3faf84e2e5d793f68361b4 Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Wed, 25 Sep 2024 23:59:52 +0100 Subject: Add Sony PlayStation support to Libreboot I also added a "cleanargs" argument, similar to the makeargs argument, to work around a build error. This builds the PCSX-Redux PS1 BIOS. They reverse engineered the Sony PS1 BIOS and wrote a free one under MIT license. Run this: ./mk -b pcsx-redux The file will appear: bin/playstation/openbios.bin Signed-off-by: Leah Rowe --- config/data/pcsx-redux/mkhelper.cfg | 3 ++ .../patches/0001-no-context-will-be-given.patch | 36 ++++++++++++++++++++++ config/pcsx-redux/target.cfg | 3 ++ include/rom.sh | 7 +++++ script/trees | 14 +++++---- 5 files changed, 57 insertions(+), 6 deletions(-) create mode 100644 config/data/pcsx-redux/mkhelper.cfg create mode 100644 config/pcsx-redux/patches/0001-no-context-will-be-given.patch create mode 100644 config/pcsx-redux/target.cfg diff --git a/config/data/pcsx-redux/mkhelper.cfg b/config/data/pcsx-redux/mkhelper.cfg new file mode 100644 index 00000000..379ad032 --- /dev/null +++ b/config/data/pcsx-redux/mkhelper.cfg @@ -0,0 +1,3 @@ +. "include/rom.sh" + +postmake="copyps1bios" diff --git a/config/pcsx-redux/patches/0001-no-context-will-be-given.patch b/config/pcsx-redux/patches/0001-no-context-will-be-given.patch new file mode 100644 index 00000000..b2968c11 --- /dev/null +++ b/config/pcsx-redux/patches/0001-no-context-will-be-given.patch @@ -0,0 +1,36 @@ +From 6516ecaea03845cd07732bd4ca8c32cd08ea4281 Mon Sep 17 00:00:00 2001 +From: Leah Rowe +Date: Wed, 25 Sep 2024 23:45:56 +0100 +Subject: [PATCH 1/1] no context will be given. + +Signed-off-by: Leah Rowe +--- + lbmkbofhmakefile | 16 ++++++++++++++++ + 1 file changed, 16 insertions(+) + create mode 100644 lbmkbofhmakefile + +diff --git a/lbmkbofhmakefile b/lbmkbofhmakefile +new file mode 100644 +index 00000000..fe2e36d2 +--- /dev/null ++++ b/lbmkbofhmakefile +@@ -0,0 +1,16 @@ ++# SPDX-License-Identifier: MIT ++# SPDX-FileCopyrightText: 2024 Leah Rowe ++ ++# This is not the original pcsx-redux Makefile. ++# We don't need to build all of PCSX-Redux, only the Open BIOS. ++# Due to idiosyncrasies of lbmk's design, it's simpler to just hack ++# the Makefile like this. ++ ++all: ++ make -C src/mips/openbios ++ ++clean: ++ make -C src/mips/openbios clean ++ ++distclean: ++ make -C src/mips/openbios clean +-- +2.39.5 + diff --git a/config/pcsx-redux/target.cfg b/config/pcsx-redux/target.cfg new file mode 100644 index 00000000..21dc4b2d --- /dev/null +++ b/config/pcsx-redux/target.cfg @@ -0,0 +1,3 @@ +makeargs="-f lbmkbofhmakefile" +cleanargs="-f lbmkbofhmakefile" +mkhelper="copyps1bios" diff --git a/include/rom.sh b/include/rom.sh index 80643c48..cfd00a86 100644 --- a/include/rom.sh +++ b/include/rom.sh @@ -24,6 +24,13 @@ mkserprog() [ "$XBMK_RELEASE" = "y" ] && mkrom_tarball "bin/serprog_$1"; return 0 } +copyps1bios() +{ + x_ rm -Rf bin/playstation + x_ mkdir -p bin/playstation + x_ cp src/pcsx-redux/src/mips/openbios/openbios.bin bin/playstation +} + mkpayload_grub() { eval `setvars "" grub_modules grub_install_modules` diff --git a/script/trees b/script/trees index 01df28a0..5be43dcc 100755 --- a/script/trees +++ b/script/trees @@ -12,7 +12,7 @@ set -u -e eval `setvars "" xarch srcdir premake cmakedir xlang mode makeargs elfdir cmd \ project target target_dir targets xtree _f release bootstrapargs mkhelper \ autoconfargs listfile autogenargs btype tree rev tree_depend build_depend \ - defconfig postmake mkhelpercfg dry dest_dir mdir`; badhash="n" + defconfig postmake mkhelpercfg dry dest_dir mdir cleanargs`; badhash="n" main() { @@ -111,7 +111,8 @@ handle_defconfig() configure_project() { eval `setvars "" xarch xlang build_depend autoconfargs xtree postmake \ - tree_depend makeargs btype mkhelper bootstrapargs premake release` + tree_depend makeargs btype mkhelper bootstrapargs premake release \ + cleanargs` _tcfg="$1/target.cfg"; badhash="n"; [ -f "$_tcfg" ] || btype="auto" [ -f "$datadir/mkhelper.cfg" ] && eval `setcfg "$datadir/mkhelper.cfg"` @@ -224,7 +225,7 @@ elfcheck() handle_makefile() { - $dry check_makefile "$srcdir" && x_ make clean -C "$srcdir" + $dry check_makefile "$srcdir" && x_ make -C "$srcdir" $cleanargs clean [ -f "$defconfig" ] && x_ cp "$defconfig" "$srcdir/.config" [ -n "$mode" ] || [ -n "$btype" ] || $dry make -C \ "$srcdir" silentoldconfig || make -C "$srcdir" oldconfig || : @@ -236,7 +237,7 @@ handle_makefile() $dry x_ cp "$srcdir/$_copy" "$defconfig" [ -e "$srcdir/.git" ] && [ "$project" = "u-boot" ] && \ - [ "$mode" = "distclean" ] && $dry x_ git -C "$srcdir" clean -fdx; : + [ "$mode" = "distclean" ] && $dry x_ git -C "$srcdir" $cleanargs clean -fdx; : } run_make_command() @@ -248,7 +249,8 @@ run_make_command() $dry make -C "$srcdir" $mode -j$XBMK_THREADS $makeargs || $err "!$mode" [ -z "$mkhelper" ] || [ -n "$mode" ] || $mkhelper || $err "!$mkhelper" - [ "$mode" = "clean" ] && $dry make -C "$srcdir" distclean || :; : + [ "$mode" = "clean" ] && \ + $dry make -C "$srcdir" $cleanargs distclean || :; : } check_cmake() @@ -280,7 +282,7 @@ copy_elf() { [ -f "$listfile" ] && x_ mkdir -p "$dest_dir" && while read -r f; do [ -f "$srcdir/$f" ] && x_ cp "$srcdir/$f" "$dest_dir" - done < "$listfile"; x_ make clean -C "$srcdir" + done < "$listfile"; x_ make clean -C "$srcdir" $cleanargs } main $@ || exit 0 -- cgit v1.2.1