diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/git.sh | 13 | ||||
-rw-r--r-- | include/lib.sh | 19 | ||||
-rw-r--r-- | include/rom.sh | 34 | ||||
-rw-r--r-- | include/vendor.sh | 19 |
4 files changed, 67 insertions, 18 deletions
diff --git a/include/git.sh b/include/git.sh index 8c86b4c2..2c43cd22 100644 --- a/include/git.sh +++ b/include/git.sh @@ -91,21 +91,24 @@ fetch_submodule() "$mdir/${1##*/}/patches" } +livepull="n" tmpclone() { [ "$repofail" = "y" ] && \ - printf "Cached clone failed; trying online.\n" 1>&2; repofail="n" + printf "Cached clone failed; trying online.\n" 1>&2 && livepull="y" + + repofail="n" [ $# -lt 6 ] || rm -Rf "$3" || $err "git retry: !rm $3 ($1)" repodir="$XBMK_CACHE/repo/${1##*/}" && [ $# -gt 5 ] && repodir="$3" mkdir -p "$XBMK_CACHE/repo" || $err "!rmdir $XBMK_CACHE/repo" - if [ -d "$repodir" ] && [ $# -lt 6 ]; then + if [ "$livepull" = "y" ] && [ ! -d "$repodir" ]; then + git clone $1 "$repodir" || git clone $2 "$repodir" || \ + $err "!clone $1 $2 $repodir $4 $5" # + elif [ -d "$repodir" ] && [ $# -lt 6 ]; then git -C "$repodir" pull || sleep 3 || git -C "$repodir" pull \ || sleep 3 || git -C "$repodir" pull || : - else - git clone $1 "$repodir" || git clone $2 "$repodir" || \ - $err "!clone $1 $2 $repodir $4 $5" fi ( [ $# -gt 5 ] || git clone "$repodir" "$3" || $err "!clone $repodir $3" diff --git a/include/lib.sh b/include/lib.sh index c5df639c..9a5faabb 100644 --- a/include/lib.sh +++ b/include/lib.sh @@ -209,9 +209,24 @@ vendor_checksum() cbfs() { + fRom="$1" # image to operate on + fAdd="$2" # file to add + fName="$3" # filename when added in CBFS + ccmd="add-payload" && [ $# -gt 3 ] && ccmd="add" - lzma="-c lzma" && [ $# -gt 3 ] && lzma="-t raw" - x_ "$cbfstool" "$1" $ccmd -f "$2" -n "$3" $lzma + lzma="-c lzma" && [ $# -gt 3 ] && [ $# -lt 5 ] && lzma="-t $4" + + # hack. TODO: do it better. this whole function is cursed + if [ $# -gt 4 ]; then + # add flat binary for U-Boot (u-boot.bin) on x86 + if [ "$5" = "0x1110000" ]; then + ccmd="add-flat-binary" + lzma="-c lzma -l 0x1110000 -e 0x1110000" + fi + fi + + "$cbfstool" "$fRom" $ccmd -f "$fAdd" -n "$fName" $lzma || \ + $err "CBFS fail: $fRom $ccmd -f '$fAdd' -n '$fName' $lzma"; : } mk() diff --git a/include/rom.sh b/include/rom.sh index 80643c48..d04e9ee4 100644 --- a/include/rom.sh +++ b/include/rom.sh @@ -24,6 +24,17 @@ 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` @@ -100,6 +111,7 @@ mkcorebootbin() [ "$payload_memtest" = "y" ] || payload_memtest="n" [ "$(uname -m)" = "x86_64" ] || payload_memtest="n" + if $dry grep "CONFIG_PAYLOAD_NONE=y" "$defconfig"; then [ "$payload_seabios" = "y" ] && pname="seabios" && \ $dry add_seabios @@ -125,6 +137,8 @@ add_seabios() [ "$payload_memtest" = "y" ] && cbfs "$tmprom" \ "elf/memtest86plus/memtest.bin" img/memtest + [ "$payload_uboot_i386" = "y" ] && $dry add_uboot + [ "$payload_grub" = "y" ] && add_grub cprom && [ "$payload_grub" = "y" ] && pname="seagrub" && mkseagrub; : @@ -148,12 +162,26 @@ mkseagrub() 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"; cprom + [ -f "$ubootelf" ] || $err "cb/$ubtarget: Can't find u-boot" + cbfs "$tmprom" "$ubootelf" "$ubpath" $ubcbfsargs; cprom } cprom() diff --git a/include/vendor.sh b/include/vendor.sh index c5b6560d..0f97a641 100644 --- a/include/vendor.sh +++ b/include/vendor.sh @@ -23,7 +23,7 @@ eval `setvars "" EC_url_bkup EC_hash DL_hash DL_url_bkup MRC_refcode_gbe vcfg \ E6400_VGA_romname SCH5545EC_DL_url_bkup SCH5545EC_DL_hash _dest tree \ mecleaner kbc1126_ec_dump MRC_refcode_cbtree new_mac _dl SCH5545EC_DL_url \ archive EC_url boarddir rom cbdir DL_url nukemode cbfstoolref vrelease \ - verify _7ztest ME_bootguard $cv` + verify _7ztest ME_bootguard IFD_platform ifdprefix $cv` vendor_download() { @@ -160,12 +160,12 @@ extract_deguard_me() git -C "$1/disreguard" commit -m "tmp" || \ $err "!commit $1/disreguard" fi - git -C "$1/disreguard" am config/data/deguard/appdir.patch || \ + git -C "$1/disreguard" am "$PWD/config/data/deguard/appdir.patch" || \ $err "Cannot temporarily patch deguard clone in $1/disreguard" ( cd "$1/disreguard" || $err "Cannot cd to '$1/disreguard'" x_ ./RUNME.sh - ) + ) || $err "$1/disreguard: RUNME.sh returned error status" "$mecleaner" --whitelist MFS --truncate "$1/disreguard/me.bin" || \ $err "extract_intel_me: Can't truncate disreguarded ME" cp "$cdir/disreguard/me.bin" "$2" || \ @@ -296,6 +296,7 @@ readcfg() kbc1126_ec_dump="$PWD/$cbdir/util/kbc1126/kbc1126_ec_dump" cbfstool="elf/cbfstool/$tree/cbfstool" ifdtool="elf/ifdtool/$tree/ifdtool" + [ -n "$IFD_platform" ] && ifdprefix="-p $IFD_platform" x_ ./mk -d coreboot $tree } @@ -365,10 +366,11 @@ inject() e "$_dest" f n && [ "$nukemode" != "nuke" ] && $err "!inject $dl_type" if [ "$cbfsname" = "IFD" ]; then - [ "$nukemode" = "nuke" ] || "$ifdtool" -i $_t:$_dest "$rom" \ - -O "$rom" || $err "failed: inject '$_t' '$_dest' on '$rom'" - [ "$nukemode" != "nuke" ] || "$ifdtool" --nuke $_t "$rom" \ - -O "$rom" || $err "$rom: can't nuke $_t in IFD"; return 0 + [ "$nukemode" = "nuke" ] || "$ifdtool" $ifdprefix -i \ + $_t:$_dest "$rom" -O "$rom" || \ + $err "failed: inject '$_t' '$_dest' on '$rom'" + [ "$nukemode" != "nuke" ] || "$ifdtool" $ifdprefix --nuke $_t \ + "$rom" -O "$rom" || $err "$rom: !nuke IFD/$_t"; return 0 elif [ "$nukemode" = "nuke" ]; then "$cbfstool" "$rom" remove -n "$cbfsname" || \ $err "inject $rom: can't remove $cbfsname"; return 0 @@ -388,5 +390,6 @@ modify_gbe() x_ cp "${CONFIG_GBE_BIN_PATH##*../}" "$TMPDIR/gbe" x_ "util/nvmutil/nvm" "$TMPDIR/gbe" setmac $new_mac - x_ "$ifdtool" -i GbE:"$TMPDIR/gbe" "$1" -O "$1" + "$ifdtool" $ifdprefix -i GbE:"$TMPDIR/gbe" "$1" -O "$1" || \ + $err "Cannot insert modified GbE region into target image." } |