summaryrefslogtreecommitdiffstats
path: root/resources/scripts/helpers/build/roms
diff options
context:
space:
mode:
Diffstat (limited to 'resources/scripts/helpers/build/roms')
-rwxr-xr-xresources/scripts/helpers/build/roms/withdepthcharge83
-rwxr-xr-xresources/scripts/helpers/build/roms/withgrub7
-rwxr-xr-xresources/scripts/helpers/build/roms/withgrub_helper36
3 files changed, 70 insertions, 56 deletions
diff --git a/resources/scripts/helpers/build/roms/withdepthcharge b/resources/scripts/helpers/build/roms/withdepthcharge
index 1c37102..32e5623 100755
--- a/resources/scripts/helpers/build/roms/withdepthcharge
+++ b/resources/scripts/helpers/build/roms/withdepthcharge
@@ -2,7 +2,7 @@
# helper script: build ROM images with depthcharge and put them in ./bin/
#
-# Copyright (C) 2014, 2015 Francis Rowe <info@gluglug.org.uk>
+# Copyright (C) 2014, 2015, 2016 Francis Rowe <info@gluglug.org.uk>
# Copyright (C) 2015 Paul Kocialkowski <contact@paulk.fr>
#
# This program is free software: you can redistribute it and/or modify
@@ -32,13 +32,23 @@ then
mkdir "bin/"
fi
+if [ -f "version" ]; then
+ # _src release archive is being used
+ version="$(cat "version")"
+else
+ # git repo is being used
+ version="$(git describe --tags HEAD)" # note: in libreboot, coreboot/.git doesn't exist, this uses libreboot .git
+fi
+
# Build libpayload
# ------------------------------------------------------------------------------
buildlibpayload() {
- family="$1"
+ family="${1}"
+ board="${2}"
- cd "coreboot/payloads/libpayload"
+ (
+ cd "coreboot/depthcharge/${board}/payloads/libpayload/"
make distclean
rm -Rf "install/"
@@ -46,95 +56,92 @@ buildlibpayload() {
make KBUILD_DEFCONFIG="configs/config.$family" defconfig
make -j"$(nproc)"
make DESTDIR="install" install
-
- cd "../../../"
+ )
}
# Build depthcharge
# ------------------------------------------------------------------------------
builddepthcharge() {
- board="$1"
+ board="${1}"
+ (
cd "depthcharge/"
make distclean
- rm -f "../coreboot/depthcharge.elf"
+ rm -f "../coreboot/depthcharge/${board:?}/depthcharge.elf"
- make BOARD="$board" defconfig
- make BOARD="$board" LIBPAYLOAD_DIR="$(pwd)/../coreboot/payloads/libpayload/install/libpayload" VB_SOURCE="$(pwd)/../coreboot/3rdparty/vboot" -j"$(nproc)" depthcharge_unified
+ make BOARD="${board}" defconfig
+ make BOARD="${board}" LIBPAYLOAD_DIR="$(pwd)/../coreboot/depthcharge/${board}/payloads/libpayload/install/libpayload" VB_SOURCE="$(pwd)/../coreboot/depthcharge/${board}/3rdparty/vboot" -j"$(nproc)" depthcharge_unified
- cp "build/depthcharge.elf" "../coreboot/"
-
- cd "../"
+ cp "build/depthcharge.elf" "../coreboot/depthcharge/${board}/"
+ )
}
# Build coreboot
# ------------------------------------------------------------------------------
buildcoreboot() {
- board="$1"
+ board="${1}"
- cd "coreboot/"
+ (
+ cd "coreboot/depthcharge/${board}/"
make distclean
rm -f ".coreboot-version"
rm -f *.img
- if [ -f "../version" ]; then
- # _src release archive is being used
- version="$(cat ../version)"
- else
- # git repo is being used
- version="$(git describe --tags HEAD)" # note: in libreboot, coreboot/.git doesn't exist, this uses libreboot .git
- fi
printf 'libreboot-%s' "${version}" > "ro-frid"
printf 'libreboot-%s\n' "${version}" > ".coreboot-version" # needed for reproducible builds in coreboot
- make KBUILD_DEFCONFIG="$(pwd)/../resources/libreboot/config/depthcharge/${board}/config" defconfig
+ make KBUILD_DEFCONFIG="$(pwd)/../../../resources/libreboot/config/depthcharge/${board}/config" defconfig
make -j"$(nproc)"
cbfs_size=$( grep CONFIG_CBFS_SIZE ".config" | sed "s/.*[[:space:]]*=[[:space:]]*//g" )
- cbfs_size=$( printf "%d\n" "$cbfs_size" )
+ cbfs_size=$( printf "%d\n" "${cbfs_size}" )
cbfs_size=$(( $cbfs_size / 1024 ))
- dd if="build/coreboot.rom" of="coreboot.img" bs=1024 count="$cbfs_size"
+ dd if="build/coreboot.rom" of="coreboot.img" bs=1024 count="${cbfs_size}"
objcopy -I binary -O binary --pad-to=0x100 --gap-fill=0x00 "ro-frid" "ro-frid.img"
# prepare directory for new images
rm -Rf "${board:?}/"
- mkdir "$board/"
+ mkdir "${board}/"
# move the images into the newly created directory
- mv "coreboot.img" "$board/"
- mv "ro-frid.img" "$board/"
+ mv "coreboot.img" "${board}/"
+ mv "ro-frid.img" "${board}/"
# copy the scripts too
- cp "../resources/libreboot/install/depthcharge/cros-flash-replace" "$board/"
- cp "../resources/libreboot/install/depthcharge/${board}/layout.txt" "$board/"
+ cp "../../../resources/libreboot/install/depthcharge/cros-flash-replace" "${board}/"
+ cp "../../../resources/libreboot/install/depthcharge/${board}/layout.txt" "${board}/"
# delete the old images from ../bin
- rm -Rf "../bin/depthcharge/${board}/"
+ rm -Rf "../../../bin/depthcharge/${board}/"
# now put the new images in ./bin/depthcharge/
- [ ! -d "../bin/depthcharge/" ] && mkdir -p "../bin/depthcharge/"
- mv "$board/" "../bin/depthcharge/"
+ [ ! -d "../../../bin/depthcharge/" ] && mkdir -p "../../../bin/depthcharge/"
+ mv "${board}/" "../../../bin/depthcharge/"
- cd "../"
+ # clean this up
+ rm -f "depthcharge.elf"
+ rm -f *.img
+ )
}
# Build ROM images for supported boards
buildrom() {
- board="$1"
+ board="${1}"
+
if [ -f "resources/libreboot/config/depthcharge/${board}/config" ]; then
family=$( echo ${board} |sed "s/_.*//g" )
- buildlibpayload "$family"
- builddepthcharge "$board"
- buildcoreboot "$board"
+ buildlibpayload "${family}" "${board}"
+ builddepthcharge "${board}"
+ buildcoreboot "${board}"
fi
}
if [ $# -gt 0 ]; then
for board in "${@}"; do
- buildrom "$board"
+ buildrom "${board}"
done
else
for board in resources/libreboot/config/depthcharge/*; do
diff --git a/resources/scripts/helpers/build/roms/withgrub b/resources/scripts/helpers/build/roms/withgrub
index fd1aa5d..f3c0c05 100755
--- a/resources/scripts/helpers/build/roms/withgrub
+++ b/resources/scripts/helpers/build/roms/withgrub
@@ -3,7 +3,7 @@
#
# helper script: build ROM images with GRUB and put them in ./bin/
#
-# Copyright (C) 2014, 2015 Francis Rowe <info@gluglug.org.uk>
+# Copyright (C) 2014, 2015, 2016 Francis Rowe <info@gluglug.org.uk>
# Copyright (C) 2015 Klemens Nanni <contact@autoboot.org>
#
# This program is free software: you can redistribute it and/or modify
@@ -28,6 +28,10 @@ set -u -e
printf "Building ROM images with the GRUB payload\n"
+# The GRUB files should be deleted first
+rm -f "coreboot/grub"*.{elf,cfg}
+rm -f "coreboot/"*/*/grub*.{elf,cfg}
+
[ -d bin ] || mkdir "bin/"
# Put GRUB payloads and config files
@@ -136,5 +140,6 @@ fi
# The GRUB files are no longer needed
rm -f "coreboot/grub"*.{elf,cfg}
+rm -f "coreboot/"*/*/grub*.{elf,cfg}
printf "\n\n"
diff --git a/resources/scripts/helpers/build/roms/withgrub_helper b/resources/scripts/helpers/build/roms/withgrub_helper
index b952417..009028e 100755
--- a/resources/scripts/helpers/build/roms/withgrub_helper
+++ b/resources/scripts/helpers/build/roms/withgrub_helper
@@ -2,7 +2,7 @@
# helper script: create ROM images for a given system, with GRUB
#
-# Copyright (C) 2014, 2015 Francis Rowe <info@gluglug.org.uk>
+# Copyright (C) 2014, 2015, 2016 Francis Rowe <info@gluglug.org.uk>
# Copyright (C) 2015 Klemens Nanni <contact@autoboot.org>
#
# This program is free software: you can redistribute it and/or modify
@@ -36,7 +36,11 @@ boardtarget="${1}"
printf "GRUB Helper script: build ROM images for '%s'\n" "${boardtarget}"
-cd "coreboot/"
+(
+cd "coreboot/grub/${boardtarget}/"
+
+# Make sure to remove these first
+rm -f "grub."*{elf,cfg}
if [ -f "../version" ]; then
# release archive is being used
@@ -53,11 +57,11 @@ if [ "${boardtarget}" = "qemu_i440fx_piix4" ] || [ "${boardtarget}" = "qemu_q35_
then
# assume that the default config enable framebuffer mode, duplicate and patch for text-mode
# necessary, otherwise it will ask you to enter the Y/X resolution of the framebuffer at build time
- cp "../resources/libreboot/config/grub/${boardtarget}/config" "config_vesafb"
+ cp "../../../resources/libreboot/config/grub/${boardtarget}/config" "config_vesafb"
sed 's/CONFIG_FRAMEBUFFER_KEEP_VESA_MODE=y/# CONFIG_FRAMEBUFFER_KEEP_VESA_MODE is not set/' < "config_vesafb" > "config_txtmode"
else
# assume that the default config enables text-mode, duplicate and patch for framebuffer mode
- cp "../resources/libreboot/config/grub/${boardtarget}/config" "config_txtmode"
+ cp "../../../resources/libreboot/config/grub/${boardtarget}/config" "config_txtmode"
sed 's/# CONFIG_FRAMEBUFFER_KEEP_VESA_MODE is not set/CONFIG_FRAMEBUFFER_KEEP_VESA_MODE=y/' < "config_txtmode" > "config_vesafb"
fi
@@ -83,9 +87,9 @@ do
# Build coreboot ROM image
make clean
mv "config_${romtype}" ".config"
- mv "grub_${romtype}.elf" "grub.elf"
+ cp "../../grub_${romtype}.elf" "grub.elf"
make -j"$(nproc)"
- mv "grub.elf" "grub_${romtype}.elf"
+ rm -f "grub.elf"
mv "build/coreboot.rom" "${boardtarget}_${romtype}.rom"
# .config no longer needed
rm -f ".config"
@@ -95,14 +99,14 @@ do
then
if [ "$1" = "macbook21" ] || [ "$1" = "x200_4mb" ] || [ "$1" = "x200_8mb" ] || [ "$1" = "r400_4mb" ] || [ "$1" = "r400_8mb" ] || [ "$1" = "r500_4mb" ] || [ "$1" = "r500_8mb" ] || [ "$1" = "t400_4mb" ] || [ "$1" = "t400_8mb" ] || [ "$1" = "t500_4mb" ] || [ "$1" = "t500_8mb" ]
then
- ./util/cbfstool/cbfstool "${boardtarget}_${romtype}.rom" add -f ../resources/grub/background/background1280x800.png -n background.png -t raw
+ ./util/cbfstool/cbfstool "${boardtarget}_${romtype}.rom" add -f ../../../resources/grub/background/background1280x800.png -n background.png -t raw
else
- ./util/cbfstool/cbfstool "${boardtarget}_${romtype}.rom" add -f ../resources/grub/background/background1024x768.png -n background.png -t raw
+ ./util/cbfstool/cbfstool "${boardtarget}_${romtype}.rom" add -f ../../../resources/grub/background/background1024x768.png -n background.png -t raw
fi
fi
# Add the correct GRUB configuration file for this image.
- for keylayout in ../resources/utilities/grub-assemble/keymap/original/*
+ for keylayout in ../../../resources/utilities/grub-assemble/keymap/original/*
do
keymap="${keylayout##*/}"
@@ -110,9 +114,9 @@ do
cp "${boardtarget}_${romtype}.rom" "${boardtarget}_${keymap}_${romtype}.rom"
# Insert grub config into the image
- ./util/cbfstool/cbfstool "${boardtarget}_${keymap}_${romtype}.rom" add -f "grub_${keymap}_${romtype}.cfg" -n grub.cfg -t raw
+ ./util/cbfstool/cbfstool "${boardtarget}_${keymap}_${romtype}.rom" add -f ../../"grub_${keymap}_${romtype}.cfg" -n grub.cfg -t raw
# Insert grub test config into the image (for the user to test modifications to before modifying the main one)
- ./util/cbfstool/cbfstool "${boardtarget}_${keymap}_${romtype}.rom" add -f "grub_${keymap}_${romtype}_test.cfg" -n grubtest.cfg -t raw
+ ./util/cbfstool/cbfstool "${boardtarget}_${keymap}_${romtype}.rom" add -f ../../"grub_${keymap}_${romtype}_test.cfg" -n grubtest.cfg -t raw
done
# This config-less ROM is no longer needed
@@ -127,15 +131,13 @@ mkdir "${boardtarget}/"
mv "${boardtarget}"*.rom "${boardtarget}/"
# delete old ROM images
-rm -Rf "../bin/grub/${boardtarget}/"
+rm -Rf "../../../bin/grub/${boardtarget}/"
# put new ROM images in ../bin/grub/
-[ -d "../bin/grub/" ] || mkdir -p "../bin/grub/"
-mv "${boardtarget}/" "../bin/grub/"
+[ -d "../../../bin/grub/" ] || mkdir -p "../../../bin/grub/"
+mv "${boardtarget}/" "../../../bin/grub/"
# version info file no longer needed
rm -f ".coreboot-version"
-
-# go back to main source directory
-cd "../"
+)
printf "\n\n"