diff options
Diffstat (limited to 'include/rom.sh')
-rw-r--r-- | include/rom.sh | 95 |
1 files changed, 74 insertions, 21 deletions
diff --git a/include/rom.sh b/include/rom.sh index ed3dddf2..d04e9ee4 100644 --- a/include/rom.sh +++ b/include/rom.sh @@ -24,14 +24,23 @@ 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 + + printf "MIT License\n\nCopyright (c) 2019-2024 PCSX-Redux authors\n\n" \ + > bin/playstation/COPYING.txt || $err "!pcsx-redux copyright" + cat config/snippet/mit >>bin/playstation/COPYING.txt || $err "!pcsx MIT" +} + mkpayload_grub() { eval `setvars "" grub_modules grub_install_modules` $dry eval `setcfg "$grubdata/module/$tree"` - - $dry x_ rm -f "$srcdir/grub.elf" - - $dry "$srcdir/grub-mkstandalone" --grub-mkimage="$srcdir/grub-mkimage" \ + $dry x_ rm -f "$srcdir/grub.elf"; $dry \ + "$srcdir/grub-mkstandalone" --grub-mkimage="$srcdir/grub-mkimage" \ -O i386-coreboot -o "$srcdir/grub.elf" -d "${srcdir}/grub-core/" \ --fonts= --themes= --locales= --modules="$grub_modules" \ --install-modules="$grub_install_modules" \ @@ -43,6 +52,7 @@ mkpayload_grub() mkvendorfiles() { + [ -z "$mode" ] && $dry cook_coreboot_config check_coreboot_utils "$tree" printf "%s\n" "${version%%-*}" > "$srcdir/.coreboot-version" || \ $err "!mk $srcdir .coreboot-version" @@ -50,11 +60,18 @@ mkvendorfiles() x_ ./vendor download $target; return 0 } +cook_coreboot_config() +{ + [ -f "$srcdir/.config" ] || return 0 + printf "CONFIG_CCACHE=y\n" >> "$srcdir/.config" || \ + $err "$srcdir/.config: Could not enable ccache" + make -C "$srcdir" oldconfig || $err "Could not cook $srcdir/.config"; : +} + check_coreboot_utils() { for util in cbfstool ifdtool; do - [ "$badhash" = "n" ] || rm -f "elf/$util/$1/$util" || \ - $err "!rm badelf elf/$util/$1/$util" + [ "$badhash" = "y" ] && x_ rm -f "elf/$util/$1/$util" e "elf/$util/$1/$util" f && continue utilelfdir="elf/$util/$1" @@ -73,7 +90,9 @@ mkcorebootbin() { [ "$target" = "$tree" ] && return 0 - tmprom="$srcdir/build/coreboot.rom" + tmprom="$TMPDIR/coreboot.rom" + $dry x_ cp "$srcdir/build/coreboot.rom" "$tmprom" + initmode="${defconfig##*/}"; displaymode="${initmode##*_}" initmode="${initmode%%_*}" [ -n "$displaymode" ] && displaymode="_$displaymode" @@ -92,19 +111,14 @@ mkcorebootbin() [ "$payload_memtest" = "y" ] || payload_memtest="n" [ "$(uname -m)" = "x86_64" ] || payload_memtest="n" - if grep "CONFIG_PAYLOAD_NONE=y" "$defconfig"; then + + if $dry grep "CONFIG_PAYLOAD_NONE=y" "$defconfig"; then [ "$payload_seabios" = "y" ] && pname="seabios" && \ $dry add_seabios [ "$payload_uboot" = "y" ] && pname="uboot" && $dry add_uboot else - pname="custom" # coreboot's build system added payloads - fi - newrom="bin/$target/${pname}_${target}_$initmode$displaymode.rom" - $dry x_ mkdir -p "${newrom%/*}"; $dry x_ mv "$tmprom" "$newrom" - - [ "$XBMK_RELEASE" = "y" ] || return 0 - $dry mksha512sum "$newrom" "vendorhashes"; $dry ./vendor inject \ - -r "$newrom" -b "$target" -n nuke || $err "!nuke $newrom" + pname="custom" && $dry cprom; : + fi; : } add_seabios() @@ -123,7 +137,11 @@ add_seabios() [ "$payload_memtest" = "y" ] && cbfs "$tmprom" \ "elf/memtest86plus/memtest.bin" img/memtest - [ "$payload_grub" = "y" ] && pname="seagrub" && add_grub; return 0 + [ "$payload_uboot_i386" = "y" ] && $dry add_uboot + + [ "$payload_grub" = "y" ] && add_grub + + cprom && [ "$payload_grub" = "y" ] && pname="seagrub" && mkseagrub; : } add_grub() @@ -132,21 +150,56 @@ add_grub() printf "set grub_scan_disk=\"%s\"\n" "$grub_scan_disk" \ > "$TMPDIR/tmpcfg" || $err "$target: !insert scandisk" cbfs "$tmprom" "$TMPDIR/tmpcfg" scan.cfg raw +} + +mkseagrub() +{ cbfs "$tmprom" "$grubdata/bootorder" bootorder raw + for keymap in config/data/grub/keymap/*.gkb; do + [ -f "$keymap" ] && cprom "${keymap##*/}"; : + done; : } add_uboot() { - ubdir="elf/u-boot/$target/$uboot_config" + # TODO: re-work to allow each coreboot target to say which ub tree + # instead of hardcoding as in the current logic below: + + ubcbfsargs="" + [ "$payload_uboot_i386" = "y" ] && \ + ubcbfsargs="-l 0x1110000 -e 0x1110000" + + ubpath="fallback/payload" + [ "$payload_uboot_i386" = "y" ] && ubpath="u-boot" + + ubtarget="$target" + [ "$payload_uboot_i386" = "y" ] && ubtarget="i386coreboot" + + ubdir="elf/u-boot/$ubtarget/$uboot_config" ubootelf="$ubdir/u-boot.elf" && [ ! -f "$ubootelf" ] && \ ubootelf="$ubdir/u-boot" - [ -f "$ubootelf" ] || $err "cb/$target: Can't find u-boot" + [ "$payload_uboot_i386" = "y" ] && ubootelf="$ubdir/u-boot-dtb.bin" - cbfs "$tmprom" "$ubootelf" "fallback/payload" + [ -f "$ubootelf" ] || $err "cb/$ubtarget: Can't find u-boot" + cbfs "$tmprom" "$ubootelf" "$ubpath" $ubcbfsargs; cprom +} + +cprom() +{ + newrom="bin/$target/${pname}_${target}_$initmode$displaymode.rom" + [ $# -gt 0 ] && newrom="${newrom%.rom}_${1%.gkb}.rom" + + x_ mkdir -p "bin/$target" + x_ cp "$tmprom" "$newrom" && [ $# -gt 0 ] && \ + cbfs "$newrom" "config/data/grub/keymap/$1" keymap.gkb raw + + [ "$XBMK_RELEASE" = "y" ] || return 0 + $dry mksha512sum "$newrom" "vendorhashes"; $dry ./vendor inject \ + -r "$newrom" -b "$target" -n nuke || $err "!nuke $newrom" } mkcoreboottar() { [ "$target" = "$tree" ] && return 0; [ "$XBMK_RELEASE" = "y" ] && \ - [ "$release" != "n" ] && $dry mkrom_tarball "bin/$target"; return 0 + [ "$release" != "n" ] && $dry mkrom_tarball "bin/$target"; : } |