build/boot/roms: dont do init/displaymode argument
These are only ever initialised globally, and set once. Other instances where they are set are only in cases where they are passed as argument, at the start of a function, so they are being *needlessly* re-set. Set them only once and use them globally. Signed-off-by: Leah Rowe <leah@libreboot.org>btrfsvols
parent
42d4fa9b12
commit
2a6fcf7022
|
@ -187,7 +187,7 @@ build_target()
|
||||||
[ "$displaymode" != "txtmode" ] && continue
|
[ "$displaymode" != "txtmode" ] && continue
|
||||||
cbcfg="${targetdir}/config/${initmode}_${displaymode}"
|
cbcfg="${targetdir}/config/${initmode}_${displaymode}"
|
||||||
[ "${initmode}" = "normal" ] && cbcfg="${cbcfg%_*}"
|
[ "${initmode}" = "normal" ] && cbcfg="${cbcfg%_*}"
|
||||||
build_roms "${cbcfg}" "${displaymode}" "${initmode}"
|
build_roms "${cbcfg}"
|
||||||
done
|
done
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
@ -196,8 +196,6 @@ build_target()
|
||||||
build_roms()
|
build_roms()
|
||||||
{
|
{
|
||||||
cbcfg="${1}"
|
cbcfg="${1}"
|
||||||
displaymode="${2}"
|
|
||||||
initmode="${3}"
|
|
||||||
|
|
||||||
[ ! -f "${cbcfg}" ] && \
|
[ ! -f "${cbcfg}" ] && \
|
||||||
printf "'%s' does not exist. Skipping build for %s %s %s\n" \
|
printf "'%s' does not exist. Skipping build for %s %s %s\n" \
|
||||||
|
@ -222,8 +220,7 @@ build_roms()
|
||||||
[ "${payload_seabios}" = "y" ] && \
|
[ "${payload_seabios}" = "y" ] && \
|
||||||
build_seabios_roms
|
build_seabios_roms
|
||||||
[ "${payload_grub}" != "y" ] || \
|
[ "${payload_grub}" != "y" ] || \
|
||||||
build_grub_roms "${corebootrom}" "${initmode}" \
|
build_grub_roms "${corebootrom}" "grub" || \
|
||||||
"${displaymode}" "grub" || \
|
|
||||||
err "build_roms: build_grub_roms failed"
|
err "build_roms: build_grub_roms failed"
|
||||||
[ "${payload_uboot}" = "y" ] || return 0
|
[ "${payload_uboot}" = "y" ] || return 0
|
||||||
build_uboot_roms
|
build_uboot_roms
|
||||||
|
@ -235,13 +232,11 @@ build_seabios_roms()
|
||||||
tmprom=$(mktemp -t coreboot_rom.XXXXXXXXXX)
|
tmprom=$(mktemp -t coreboot_rom.XXXXXXXXXX)
|
||||||
cp "${corebootrom}" "${tmprom}" || \
|
cp "${corebootrom}" "${tmprom}" || \
|
||||||
err "build_seabios_roms: cannot copy to tmprom"
|
err "build_seabios_roms: cannot copy to tmprom"
|
||||||
build_grub_roms "${tmprom}" "${initmode}" \
|
build_grub_roms "${tmprom}" "seabios_withgrub" || \
|
||||||
"${displaymode}" "seabios_withgrub" || \
|
|
||||||
err "build_roms: cannot build grub roms, seabios w/grub"
|
err "build_roms: cannot build grub roms, seabios w/grub"
|
||||||
rm -f "${tmprom}" || err "build_roms: can't remove tmprom"
|
rm -f "${tmprom}" || err "build_roms: can't remove tmprom"
|
||||||
else
|
else
|
||||||
t=$(mkSeabiosRom "${corebootrom}" "fallback/payload" \
|
t=$(mkSeabiosRom "${corebootrom}" "fallback/payload") || \
|
||||||
"${initmode}") || \
|
|
||||||
err "build_seabios_roms: cannot build tmprom"
|
err "build_seabios_roms: cannot build tmprom"
|
||||||
newrom="${romdir}/seabios_${board}_${initmode}_${displaymode}"
|
newrom="${romdir}/seabios_${board}_${initmode}_${displaymode}"
|
||||||
[ "${initmode}" = "normal" ] && newrom="${romdir}/seabios" \
|
[ "${initmode}" = "normal" ] && newrom="${romdir}/seabios" \
|
||||||
|
@ -256,20 +251,18 @@ build_seabios_roms()
|
||||||
# Make separate ROM images with GRUB payload, for each supported keymap
|
# Make separate ROM images with GRUB payload, for each supported keymap
|
||||||
build_grub_roms() {
|
build_grub_roms() {
|
||||||
tmprompath="${1}"
|
tmprompath="${1}"
|
||||||
initmode="${2}"
|
firstpayloadname="${2}" # allow values: grub, seabios, seabios_withgrub
|
||||||
displaymode="${3}"
|
|
||||||
firstpayloadname="${4}" # allow values: grub, seabios, seabios_withgrub
|
|
||||||
grubelf_cbfs="fallback/payload"
|
grubelf_cbfs="fallback/payload"
|
||||||
|
|
||||||
if [ "${payload_grub_withseabios}" = "y" ] && \
|
if [ "${payload_grub_withseabios}" = "y" ] && \
|
||||||
[ "${firstpayloadname}" = "grub" ]; then
|
[ "${firstpayloadname}" = "grub" ]; then
|
||||||
mv "$(mkSeabiosRom "${tmprompath}" "seabios.elf" \
|
mv "$(mkSeabiosRom "${tmprompath}" "seabios.elf")" \
|
||||||
"${initmode}")" "${tmprompath}" || \
|
"${tmprompath}" || \
|
||||||
err "build_grub_roms: cannot move tmp rom (seabios.elf)"
|
err "build_grub_roms: cannot move tmp rom (seabios.elf)"
|
||||||
elif [ "${payload_seabios_withgrub}" = "y" ] && \
|
elif [ "${payload_seabios_withgrub}" = "y" ] && \
|
||||||
[ "${firstpayloadname}" != "grub" ]; then
|
[ "${firstpayloadname}" != "grub" ]; then
|
||||||
mv "$(mkSeabiosRom "${tmprompath}" "fallback/payload" \
|
mv "$(mkSeabiosRom "${tmprompath}" "fallback/payload")" \
|
||||||
"${initmode}")" "${tmprompath}" || \
|
"${tmprompath}" || \
|
||||||
err "build_grub_roms: cannot move SeaBIOS ROM to tmprom"
|
err "build_grub_roms: cannot move SeaBIOS ROM to tmprom"
|
||||||
grubelf_cbfs="img/grub2"
|
grubelf_cbfs="img/grub2"
|
||||||
fi
|
fi
|
||||||
|
@ -355,8 +348,7 @@ mkSeabiosRom() {
|
||||||
target_cbrom="${1}" # rom to insert seabios in. will not be touched
|
target_cbrom="${1}" # rom to insert seabios in. will not be touched
|
||||||
# (a tmpfile will be made instead)
|
# (a tmpfile will be made instead)
|
||||||
target_seabios_cbfs_path="${2}" # e.g. fallback/payload
|
target_seabios_cbfs_path="${2}" # e.g. fallback/payload
|
||||||
target_initmode="${3}" # e.g. libgfxinit
|
target_seabioself="elf/seabios/default/${initmode}/bios.bin.elf"
|
||||||
target_seabioself="elf/seabios/default/${target_initmode}/bios.bin.elf"
|
|
||||||
tmprom=$(mktemp -t coreboot_rom.XXXXXXXXXX)
|
tmprom=$(mktemp -t coreboot_rom.XXXXXXXXXX)
|
||||||
|
|
||||||
cp "${target_cbrom}" "${tmprom}" || \
|
cp "${target_cbrom}" "${tmprom}" || \
|
||||||
|
@ -367,12 +359,12 @@ mkSeabiosRom() {
|
||||||
"${cbfstool}" "${tmprom}" add-int -i 3000 -n etc/ps2-keyboard-spinup \
|
"${cbfstool}" "${tmprom}" add-int -i 3000 -n etc/ps2-keyboard-spinup \
|
||||||
|| err "mkSeabiosRom: cbfs add-int etc/ps2-keyboard-spinup 3000"
|
|| err "mkSeabiosRom: cbfs add-int etc/ps2-keyboard-spinup 3000"
|
||||||
|
|
||||||
z="2"; [ "${target_initmode}" = "vgarom" ] && z="0"
|
z="2"; [ "${initmode}" = "vgarom" ] && z="0"
|
||||||
"${cbfstool}" "${tmprom}" add-int -i $z -n etc/pci-optionrom-exec || \
|
"${cbfstool}" "${tmprom}" add-int -i $z -n etc/pci-optionrom-exec || \
|
||||||
err "mkSeabiosRom: cbfs add-int etc/pci-optionrom-exec 0"
|
err "mkSeabiosRom: cbfs add-int etc/pci-optionrom-exec 0"
|
||||||
"${cbfstool}" "${tmprom}" add-int -i 0 -n etc/optionroms-checksum || \
|
"${cbfstool}" "${tmprom}" add-int -i 0 -n etc/optionroms-checksum || \
|
||||||
err "mkSeabiosRom: cbfs add-int etc/optionroms-checksum 0"
|
err "mkSeabiosRom: cbfs add-int etc/optionroms-checksum 0"
|
||||||
[ "${target_initmode}" != "libgfxinit" ] || \
|
[ "${initmode}" != "libgfxinit" ] || \
|
||||||
"${cbfstool}" "${tmprom}" add -f "${seavgabiosrom}" \
|
"${cbfstool}" "${tmprom}" add -f "${seavgabiosrom}" \
|
||||||
-n vgaroms/seavgabios.bin -t raw || \
|
-n vgaroms/seavgabios.bin -t raw || \
|
||||||
err "mkSeabiosRom: cbfs add-raw vgaroms/seavgabios.bin"
|
err "mkSeabiosRom: cbfs add-raw vgaroms/seavgabios.bin"
|
||||||
|
|
Loading…
Reference in New Issue