summaryrefslogtreecommitdiff
path: root/script/build
diff options
context:
space:
mode:
Diffstat (limited to 'script/build')
-rwxr-xr-xscript/build/roms160
-rwxr-xr-xscript/build/serprog6
2 files changed, 118 insertions, 48 deletions
diff --git a/script/build/roms b/script/build/roms
index 9e7c69ee..1ed64004 100755
--- a/script/build/roms
+++ b/script/build/roms
@@ -20,23 +20,33 @@ cfgsdir="config/coreboot"
# target.cfg files have to specifically enable [a] payload(s)
pv="payload_grub payload_grub_withseabios payload_seabios payload_memtest t"
pv="${pv} payload_seabios_withgrub payload_seabios_grubonly payload_uboot memtest_bin"
-v="romdir cbrom initmode displaymode cbcfg targetdir tree keymaps"
-v="${v} grub_timeout ubdir board grub_scan_disk uboot_config"
+v="romdir cbrom initmode displaymode cbcfg targetdir tree keymaps release"
+v="${v} grub_timeout ubdir board grub_scan_disk uboot_config status"
eval "$(setvars "n" ${pv})"
-eval "$(setvars "" ${v} boards _displaymode _payload _keyboard all targets)"
+eval "$(setvars "" ${v} boards _displaymode _payload _keyboard all targets \
+ skipped listboards list_type)"
main()
{
check_project
while [ $# -gt 0 ]; do
+
+ if [ "$listboards" = "y" ]; then
+ list_type="$list_type $1"
+ list_type="${list_type# }"
+ shift 1; continue
+ fi
+
case ${1} in
help)
usage
exit 0 ;;
list)
- items config/coreboot || :
- exit 0 ;;
+ boards=$(items config/coreboot) || \
+ $err "Cannot generate list of boards for list"
+ listboards="y"
+ shift 1; continue ;;
-d) _displaymode="${2}" ;;
-p) _payload="${2}" ;;
-k) _keyboard="${2}" ;;
@@ -49,20 +59,47 @@ main()
done
[ "${all}" != "y" ] || boards=$(items config/coreboot) || \
- err "Cannot generate list of boards for building"
+ $err "Cannot generate list of boards for building"
for x in ${boards}; do
eval "$(setvars "n" ${pv}) $(setvars "" ${v})"
grub_background="background1280x800.png"
board="${x}"
+ status="unknown"
+
configure_target
+ [ "$board" = "$tree" ] && \
+ continue
+
+ if [ "$listboards" = "y" ]; then
+ [ -z "$list_type" ] && printf "%s\n" "$board"
+ for _list_type in $list_type; do
+ [ "$status" != "$_list_type" ] && continue
+ printf "%s\n" "$board"
+ done; continue
+ fi
+
+ # exclude certain targets from the release
+ skip_board && \
+ printf "Skip target %s(%s)\n" "$board" "$status" && \
+ skipped="* $board($status)\n$skipped" && continue
+
build_payloads
build_target_mainboard
+
[ -d "bin/${board}" ] || continue
targets="* bin/${board}\n${targets}"
done
- [ -z "${targets}" ] && err "No ROM images were compiled"
+ [ "$listboards" = "y" ] && return 0
+
+ if [ -n "$skipped" ]; then
+ printf "\nThese targets were skipped:\n"
+ eval "printf \"${skipped}\""
+ printf "^^ These targets were skipped.\n\n"
+ fi
+
+ [ -z "${targets}" ] && $err "No ROM images were compiled"
printf "\nROM images available in these directories:\n"
eval "printf \"${targets}\""
printf "^^ ROM images available in these directories.\n\n"
@@ -74,7 +111,7 @@ configure_target()
{
targetdir="${cfgsdir}/${board}"
[ -f "${targetdir}/target.cfg" ] || \
- err "Missing target.cfg for target: ${board}"
+ $err "Missing target.cfg for target: ${board}"
# Override the above defaults using target.cfg
. "${targetdir}/target.cfg"
@@ -84,7 +121,7 @@ configure_target()
&& [ "${grub_scan_disk}" != "ahci" ] && \
grub_scan_disk="both"
- [ -z "$tree" ] && err "$board: tree not defined"
+ [ -z "$tree" ] && $err "$board: tree not defined"
[ "${payload_memtest}" != "y" ] && payload_memtest="n"
[ "${payload_grub_withseabios}" = "y" ] && payload_grub="y"
@@ -101,7 +138,7 @@ configure_target()
[ "${payload_uboot}" != "y" ] && \
for configfile in "${targetdir}/config/"*; do
[ -e "${configfile}" ] || continue
- err "target '${board}' defines no payload"
+ $err "target '${board}' defines no payload"
done
[ "$payload_uboot" != "n" ] && [ "$payload_uboot" != "y" ] && \
@@ -118,6 +155,35 @@ configure_target()
eval "payload_${_payload}=y"
}
+skip_board()
+{
+ [ "$listboards" != "y" ] && [ "$status" != "stable" ] && \
+ printf "WARNING: %s not stable (status=%s):\n\n" \
+ "$board" "$status"
+
+ if [ -f "$targetdir/warn.txt" ] && [ "$listboards" != "y" ]; then
+ printf "Regarding board '%s' (status '%s'):\n" \
+ "$board" "$status"
+ cat -u "$targetdir/warn.txt" || \
+ $err "!cat $targetdir/warn.txt"
+ fi
+
+ [ "$lbmk_release" = "y" ] && [ "$release" = "n" ] && return 0
+ [ "$lbmk_release" = "y" ] && [ "$status" != "broken" ] && return 1
+ [ "$lbmk_status" = "y" ] || return 1
+ [ "$status" = "stable" ] && return 1
+
+ printf "\nTo disable this dialog when building, do:\n"
+ printf "export LBMK_STATUS=n\n\n"
+ while true; do
+ printf "Board %s has status '%s'. Skip? [y/n]" \
+ "$board" "$status"
+ read -r skip
+ [ "$skip" = "y" ] && return 0
+ [ "$skip" = "n" ] && return 1; continue
+ done
+}
+
build_payloads()
{
romdir="bin/${board}"
@@ -149,7 +215,7 @@ build_grub_payload()
keymaps="${keymaps} ${keymapfile}"
done
[ -z "$_keyboard" ] || [ -f "$grubcfgsdir/keymap/$_keyboard.gkb" ] || \
- err "build_grub_payload: $_keyboard layout not defined"
+ $err "build_grub_payload: $_keyboard layout not defined"
[ -n "$_keyboard" ] && keymaps="${grubcfgsdir}/keymap/${_keyboard}.gkb"
[ -f "$grubelf" ] && return 0
[ -f "src/grub/grub-mkstandalone" ] || x_ ./update trees -b grub
@@ -164,7 +230,7 @@ build_grub_payload()
--install-modules="${grub_install_modules}" \
"/boot/grub/grub.cfg=${grubcfgsdir}/config/grub_memdisk.cfg" \
"/boot/grub/grub_default.cfg=${grubcfgsdir}/config/grub.cfg" || \
- err "could not generate grub.elf"
+ $err "could not generate grub.elf"
}
build_uboot_payload()
@@ -175,12 +241,12 @@ build_uboot_payload()
[ ! -f "${ubootelf}" ] && [ -f "${ubdir}/u-boot" ] && \
ubootelf="${ubdir}/u-boot"
[ -f "${ubootelf}" ] && return 0
- err "Can't find u-boot build for board, $board";
+ $err "Can't find u-boot build for board, $board";
}
build_target_mainboard()
{
- rm -f "${romdir}/"* || err "!prepare, rm files, ${romdir}"
+ rm -f "${romdir}/"* || $err "!prepare, rm files, ${romdir}"
for x in "normal" "vgarom" "libgfxinit"; do
initmode="${x}"
@@ -194,7 +260,8 @@ build_target_mainboard()
[ "$displaymode" != "txtmode" ] && continue
cbcfg="${targetdir}/config/${initmode}_${displaymode}"
[ "${initmode}" = "normal" ] && cbcfg="${cbcfg%_*}"
- build_roms "${cbcfg}"
+ build_roms "${cbcfg}"
+ x_ rm -f "$cbrom"
done
done
}
@@ -237,7 +304,7 @@ build_seabios_roms()
x_ build_grub_roms "${t}" "seabios_withgrub"
else
t=$(mkSeabiosRom "${cbrom}" "fallback/payload") || \
- err "build_seabios_roms: cannot build tmprom"
+ $err "build_seabios_roms: cannot build tmprom"
newrom="${romdir}/seabios_${board}_${initmode}_${displaymode}"
[ "${initmode}" = "normal" ] && newrom="${romdir}/seabios" \
&& newrom="${newrom}_${board}_${initmode}"
@@ -256,13 +323,13 @@ build_grub_roms()
if [ "$payload1" = "grub" ] && [ "$payload_grub_withseabios" = "y" ]
then
_tmpmvrom=$(mkSeabiosRom "$tmprom" "seabios.elf") || \
- err "build_grub_roms 1 $board: can't build tmprom"
+ $err "build_grub_roms 1 $board: can't build tmprom"
x_ mv "$_tmpmvrom" "$tmprom"
elif [ "$payload1" != "grub" ] && [ "$payload_seabios_withgrub" = "y" ]
then
grub_cbfs="img/grub2"
_tmpmvrom=$(mkSeabiosRom "$tmprom" fallback/payload) || \
- err "build_grub_roms 2 $board: can't build tmprom"
+ $err "build_grub_roms 2 $board: can't build tmprom"
x_ mv "$_tmpmvrom" "$tmprom"
fi
@@ -276,16 +343,16 @@ build_grub_roms()
backgroundfile="config/grub/background/${grub_background}"
"${cbfstool}" "${tmprom}" add -f ${backgroundfile} \
-n background.png -t raw || \
- err "insert background, ${backgroundfile}"
+ $err "insert background, ${backgroundfile}"
fi
tmpcfg=$(mktemp -t coreboot_rom.XXXXXXXXXX)
printf "set grub_scan_disk=\"%s\"\n" "$grub_scan_disk" >"$tmpcfg" \
- || err "set grub_scandisk, $grub_scan_disk, $tmpcfg"
+ || $err "set grub_scandisk, $grub_scan_disk, $tmpcfg"
[ "${grub_scan_disk}" = "both" ] || \
x_ "$cbfstool" "$tmprom" add -f "$tmpcfg" -n scan.cfg -t raw
printf "set timeout=%s\n" "${grub_timeout}" > "${tmpcfg}" || \
- err "set timeout, ${grub_timeout}, ${tmpcfg}"
+ $err "set timeout, ${grub_timeout}, ${tmpcfg}"
[ -z "${grub_timeout}" ] || x_ "${cbfstool}" "${tmprom}" add \
-f "${tmpcfg}" -n timeout.cfg -t raw
x_ rm -f "${tmpcfg}"
@@ -306,8 +373,14 @@ build_grub_roms()
newrom="${romdir}/${payload1}_${board}_" && \
newrom="${newrom}${initmode}_${keymap}.rom"
x_ moverom "${tmpgrubrom}" "${newrom}"
- [ "${payload_seabios_grubonly}" = "y" ] && \
- mkSeabiosGrubonlyRom "${tmpgrubrom}" "${newrom}"
+ if [ "${payload_seabios_grubonly}" = "y" ]; then
+ x_ "$cbfstool" "$tmpgrubrom" add \
+ -f "config/grub/bootorder" -n bootorder -t raw
+ x_ moverom "$tmpgrubrom" "${newrom%.rom}_grubfirst.rom"
+ x_ "$cbfstool" "$tmpgrubrom" add-int -i 0 \
+ -n etc/show-boot-menu
+ x_ moverom "$tmpgrubrom" "${newrom%.rom}_grubonly.rom"
+ fi
x_ rm -f "${tmpgrubrom}"
done
}
@@ -335,28 +408,10 @@ mkSeabiosRom() {
printf "%s\n" "${tmprom}"
}
-# SeaGRUB configuration
-mkSeabiosGrubonlyRom()
-{
- _grubrom="${1}"
- _newrom="${2}"
-
- tmpbootorder=$(mktemp -t coreboot_rom.XXXXXXXXXX)
-
- # only load grub, by inserting a custom bootorder file
- printf "/rom@img/grub2\n" > "$tmpbootorder" || err "printf bootorder"
- x_ "${cbfstool}" "${_grubrom}" \
- add -f "${tmpbootorder}" -n bootorder -t raw
- x_ rm -f "${tmpbootorder}"
-
- x_ "${cbfstool}" "${_grubrom}" add-int -i 0 -n etc/show-boot-menu
- x_ moverom "${_grubrom}" "${_newrom%.rom}_grubonly.rom"
-}
-
build_uboot_roms()
{
tmprom=$(mkUbootRom "${cbrom}" "fallback/payload") || \
- err "build_uboot_roms $board: could not create tmprom"
+ $err "build_uboot_roms $board: could not create tmprom"
newrom="${romdir}/uboot_payload_${board}_${initmode}_${displaymode}.rom"
x_ moverom "${tmprom}" "${newrom}"
x_ rm -f "${tmprom}"
@@ -370,7 +425,7 @@ mkUbootRom() {
_ubdir="elf/u-boot/${board}/${uboot_config}"
_ubootelf="${_ubdir}/u-boot.elf"
[ -f "${_ubootelf}" ] || _ubootelf="${_ubdir}/u-boot"
- [ -f "$_ubootelf" ] || err "mkUbootRom: $board: cant find u-boot"
+ [ -f "$_ubootelf" ] || $err "mkUbootRom: $board: cant find u-boot"
tmprom=$(mktemp -t coreboot_rom.XXXXXXXXXX)
@@ -407,8 +462,23 @@ usage()
./build roms x200_8mb x60
./build roms x60 -p grub -d corebootfb -k usqwerty
- possible values for 'target':
- $(items "config/coreboot")
+ to see possible values for 'target':
+
+ ./build roms list
+
+ to see targets of only a given status (stable, unstable,
+ broken, untested and unknown), try e.g.
+
+ ./build roms list stable
+ ./build roms list unstable untested
+ ./build roms list unknown
+ ./build roms list broken
+ ./build roms list broken stable
+
+ the value is set in target.cfg for each board. if status
+ is unitialised, it defaults to "unknown". only stable/unstable
+ targets are permitted in releases; broken, untested and
+ unknown are not allowed, but are accessible via normal building
Refer to the ${projectname} documentation for more information.
EOF
diff --git a/script/build/serprog b/script/build/serprog
index 8b003add..ea2c02bf 100755
--- a/script/build/serprog
+++ b/script/build/serprog
@@ -17,8 +17,8 @@ usage="usage: ./build firmware serprog <rp2040|stm32> [board]"
main()
{
- [ -z "${1+x}" ] && err "${usage}"
- [ "$1" != "rp2040" ] && [ "$1" != "stm32" ] && err "$usage"
+ [ -z "${1+x}" ] && $err "${usage}"
+ [ "$1" != "rp2040" ] && [ "$1" != "stm32" ] && $err "$usage"
if [ "${1}" = "rp2040" ]; then
boards_dir=${pico_sdk_dir}/src/boards/include/boards
[ -d "$pico_src_dir" ] || x_ ./update trees -f "pico-serprog"
@@ -71,7 +71,7 @@ print_boards()
list_boards()
{
- basename -a -s .h "${1}/"*.h || err "list_boards $1: can't list boards"
+ basename -a -s .h "${1}/"*.h || $err "list_boards $1: can't list boards"
}
main $@