mirror of
https://codeberg.org/libreboot/lbmk.git
synced 2026-07-11 14:02:52 +02:00
rom.sh: Safer cprom()
Don't insert special files like GRUB keymaps after copying to the final destination. Instead, copy the tmprom to /tmp and operate on that, in these instances. This is less efficient, depending on the user's configuration; if /tmp is on the same file system as the user's xbmkpwd, it should be fine. However, the actual performance hit isn't that bad in practise, on most setups. If the user's /tmp is a tmpfs, then that means using tmpfs, but it's one image at a time. It should be OK. Signed-off-by: Leah Rowe <leah@libreboot.org>
This commit is contained in:
+12
-4
@@ -241,16 +241,24 @@ add_uboot()
|
||||
|
||||
cprom()
|
||||
{
|
||||
cpcmd="cp"
|
||||
|
||||
tmpnew=""; newrom="bin/$target/${pname}_${target}_$initmode.rom"
|
||||
[ -n "$displaymode" ] && newrom="${newrom%.rom}_$displaymode.rom"
|
||||
[ $# -gt 0 ] && [ "${1%.gkb}" != "$1" ] && tmpnew="${1##*/}" && \
|
||||
newrom="${newrom%.rom}_${tmpnew%.gkb}.rom"
|
||||
|
||||
x_ mkdir -p "bin/$target"
|
||||
x_ cp "$tmprom" "$newrom" && [ $# -gt 0 ] && [ "${1%.gkb}" != "$1" ] \
|
||||
&& cbfs "$newrom" "$grubdata/keymap/$tmpnew" keymap.gkb raw
|
||||
irom="$tmprom"
|
||||
[ $# -lt 1 ] || irom="`mktemp`" || err "!mk irom, $(echo "$@")"
|
||||
[ $# -gt 0 ] && x_ cp "$tmprom" "$irom" && cpcmd="mv"
|
||||
|
||||
[ $# -gt 0 ] && [ "${1%.gkb}" != "$1" ] && \
|
||||
cbfs "$irom" "$grubdata/keymap/$tmpnew" keymap.gkb raw
|
||||
[ $# -gt 0 ] && [ "$1" = "seauboot" ] && \
|
||||
cbfs "$newrom" "$grubdata/bootorder_uboot" bootorder raw; :
|
||||
cbfs "$irom" "$grubdata/bootorder_uboot" bootorder raw; :
|
||||
|
||||
x_ mkdir -p "bin/$target"
|
||||
x_ $cpcmd "$irom" "$newrom"
|
||||
}
|
||||
|
||||
cbfs()
|
||||
|
||||
Reference in New Issue
Block a user