summaryrefslogtreecommitdiff
path: root/script/build/roms
diff options
context:
space:
mode:
Diffstat (limited to 'script/build/roms')
-rwxr-xr-xscript/build/roms157
1 files changed, 131 insertions, 26 deletions
diff --git a/script/build/roms b/script/build/roms
index 9e7c69ee..ea7ef62c 100755
--- a/script/build/roms
+++ b/script/build/roms
@@ -20,23 +20,37 @@ 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
+ [ "$1" = "stable" ] || [ "$1" = "unstable" ] || \
+ [ "$1" = "broken" ] || [ "$1" = "untested" ] || \
+ [ "$1" = "unknown" ] || \
+ $err "invalid list type '$1'"
+ 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}" ;;
@@ -48,21 +62,52 @@ main()
shift 2
done
+ [ "$listboards" = "y" ] && [ -z "$list_type" ] && \
+ list_type="stable unstable broken untested unknown"
+
[ "${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}"
+
configure_target
+ [ "$board" = "$tree" ] && \
+ continue
+
+ handle_status
+
+ if [ "$listboards" = "y" ]; then
+ 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 +119,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 +129,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 +146,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 +163,50 @@ configure_target()
eval "payload_${_payload}=y"
}
+handle_status()
+{
+ [ "$status" = "stable" ] || [ "$status" = "unstable" ] || \
+ [ "$status" = "broken" ] || [ "$status" = "untested" ] || \
+ status="unknown"
+
+ [ "$listboards" != "y" ] && \
+ printf "Handling target: %s (status=%s)\n" "$board" "$status"
+
+ [ "$status" = "broken" ] && release="n"
+ [ "$status" = "unknown" ] && release="n"
+ [ "$status" = "untested" ] && release="n"
+
+ [ "$listboards" != "y" ] && \
+ [ "$status" != "stable" ] && [ "$status" != "$release_type" ] && \
+ printf "WARNING: %s not marked stable (status=%s):\n\n" \
+ "$board" "$status"; return 0
+}
+
+skip_board()
+{
+ [ "$release" = "n" ] && [ "$lbmk_release" = "y" ] && \
+ return 0
+ [ -n "$release_type" ] && [ "$status" = "$release_type" ] && \
+ return 1
+
+ if [ "$lbmk_release" != "y" ] && [ "$status" != "stable" ] && \
+ [ "$status" != "$release_type" ]; then
+ if [ -f "$targetdir/warn.txt" ]; then
+ printf "Regarding board '%s' (status '%s'):\n" \
+ "$board" "$status"
+ cat -u "$targetdir/warn.txt" || \
+ $err "!cat $targetdir/warn.txt"
+ fi
+ 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
+ fi; return 1
+}
+
build_payloads()
{
romdir="bin/${board}"
@@ -149,7 +238,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 +253,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 +264,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 +283,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 +327,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 +346,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 +366,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}"
@@ -344,7 +434,7 @@ mkSeabiosGrubonlyRom()
tmpbootorder=$(mktemp -t coreboot_rom.XXXXXXXXXX)
# only load grub, by inserting a custom bootorder file
- printf "/rom@img/grub2\n" > "$tmpbootorder" || err "printf bootorder"
+ printf "/rom@img/grub2\n" > "$tmpbootorder" || $err "printf bootorder"
x_ "${cbfstool}" "${_grubrom}" \
add -f "${tmpbootorder}" -n bootorder -t raw
x_ rm -f "${tmpbootorder}"
@@ -356,7 +446,7 @@ mkSeabiosGrubonlyRom()
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 +460,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 +497,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