summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/lib.sh1
-rw-r--r--include/rom.sh12
-rw-r--r--include/vendor.sh18
3 files changed, 21 insertions, 10 deletions
diff --git a/include/lib.sh b/include/lib.sh
index 4911c34f..4e56b34a 100644
--- a/include/lib.sh
+++ b/include/lib.sh
@@ -10,6 +10,7 @@ _ua="Mozilla/5.0 (Windows NT 10.0; rv:91.0) Gecko/20100101 Firefox/91.0"
ifdtool="elf/ifdtool/default/ifdtool"
cbfstool="elf/cbfstool/default/cbfstool"
+rmodtool="elf/cbfstool/default/rmodtool"
tmpgit="$PWD/tmp/gitclone"
grubdata="config/data/grub"
err="err_"
diff --git a/include/rom.sh b/include/rom.sh
index 0ea791d2..01a8607f 100644
--- a/include/rom.sh
+++ b/include/rom.sh
@@ -84,10 +84,14 @@ check_coreboot_utils()
utilmode="" && [ -n "$mode" ] && utilmode="clean"
x_ make -C "$utilsrcdir" $utilmode -j$XBMK_THREADS $makeargs
- [ -z "$mode" ] && [ ! -f "$utilelfdir/$util" ] && \
- x_ mkdir -p "$utilelfdir" && \
- x_ cp "$utilsrcdir/$util" "elf/$util/$1"
- [ -z "$mode" ] || x_ rm -Rf "$utilelfdir"; continue
+ if [ -z "$mode" ] && [ ! -f "$utilelfdir/$util" ]; then
+ x_ mkdir -p "$utilelfdir"
+ x_ cp "$utilsrcdir/$util" "$utilelfdir"
+ [ "$util" = "cbfstool" ] || continue
+ x_ cp "$utilsrcdir/rmodtool" "$utilelfdir"
+ elif [ -n "$mode" ]; then
+ x_ rm -Rf "$utilelfdir"
+ fi; continue
done; return 0
}
diff --git a/include/vendor.sh b/include/vendor.sh
index 7d1356f2..5fad62fb 100644
--- a/include/vendor.sh
+++ b/include/vendor.sh
@@ -383,6 +383,7 @@ readcfg()
cbdir="src/coreboot/$tree"
cbfstool="elf/cbfstool/$tree/cbfstool"
+ rmodtool="elf/cbfstool/$tree/rmodtool"
mecleaner="$PWD/$cbdir/util/me_cleaner/me_cleaner.py"
kbc1126_ec_dump="$PWD/$cbdir/util/kbc1126/kbc1126_ec_dump"
cbfstool="elf/cbfstool/$tree/cbfstool"
@@ -425,10 +426,10 @@ patch_rom()
rom="$1"
readkconfig || return 1
- [ "$CONFIG_HAVE_MRC" = "y" ] && inject "mrc.bin" "$CONFIG_MRC_FILE" \
- "mrc" "0xfffa0000"
[ -n "$CONFIG_HAVE_REFCODE_BLOB" ] && inject "fallback/refcode" \
"$CONFIG_REFCODE_BLOB_FILE" "stage"
+ [ "$CONFIG_HAVE_MRC" = "y" ] && inject "mrc.bin" "$CONFIG_MRC_FILE" \
+ "mrc" "0xfffa0000"
[ "$CONFIG_HAVE_ME_BIN" = "y" ] && inject IFD "$CONFIG_ME_BIN_PATH" me
[ "$CONFIG_KBC1126_FIRMWARE" = "y" ] && inject ecfw1.bin \
"$CONFIG_KBC1126_FW1" raw "$CONFIG_KBC1126_FW1_OFFSET" && inject \
@@ -487,10 +488,15 @@ inject()
"$cbfstool" "$rom" remove -n "$cbfsname" || \
$err "inject $rom: can't remove $cbfsname"; return 0
fi
- [ "$_t" != "stage" ] || "$cbfstool" "$rom" add-stage -f \
- "$_dest" -n "$cbfsname" -t stage -c lzma || $err "$rom: !add ref"
- [ "$_t" = "stage" ] || "$cbfstool" "$rom" add -f "$_dest" \
- -n "$cbfsname" -t $_t $_offset || $err "$rom !add $_t ($_dest)"; :
+ if [ "$_t" = "stage" ]; then # the only stage we handle in refcode
+ x_ mkdir -p tmp; x_ rm -f "tmp/refcode"
+ "$rmodtool" -i "$_dest" -o "tmp/refcode" || "!reloc refcode"
+ "$cbfstool" "$rom" add-stage -f "tmp/refcode" -n "$cbfsname" \
+ -t stage || $err "$rom: !add ref"
+ else
+ "$cbfstool" "$rom" add -f "$_dest" -n "$cbfsname" \
+ -t $_t $_offset || $err "$rom !add $_t ($_dest)"
+ fi; :
}
modify_gbe()