Skip to content

Ds08msa internal v0.4 #619

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: dasharo-24.02.1
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
87 changes: 64 additions & 23 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ usage() {
}

SDKVER="2024-02-18_732134932b"

DASHARO_SDK=${DASHARO_SDK:-"ghcr.io/dasharo/dasharo-sdk:latest"}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should point to a stable tag?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So I assume we can merge and make v1.6.0 release Dasharo/dasharo-sdk#11 ?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, it has been approved long time ago. Feel free to merge and tag it @pietrushnic

BUILD_TIMELESS=${BUILD_TIMELESS:-0}

function build_optiplex_9010 {
DEFCONFIG=$1
Expand All @@ -43,13 +44,13 @@ function build_optiplex_9010 {

# Get FW version
FW_VERSION=$(cat ${DEFCONFIG} | grep CONFIG_LOCALVERSION | cut -d '=' -f 2 | tr -d '"')

# Combine FW flavor with version
FW_VERSION="${FW_FLAVOR}_${FW_VERSION}"

docker run --rm -t -u $UID -v $PWD:/home/coreboot/coreboot \
-v $HOME/.ssh:/home/coreboot/.ssh \
-w /home/coreboot/coreboot coreboot/coreboot-sdk:$SDKVER \
-w /home/coreboot/coreboot ${DASHARO_SDK} \
/bin/bash -c "make distclean"

cp "${DEFCONFIG}" .config
Expand All @@ -60,7 +61,7 @@ function build_optiplex_9010 {

docker run --rm -t -u $UID -v $PWD:/home/coreboot/coreboot \
-v $HOME/.ssh:/home/coreboot/.ssh \
-w /home/coreboot/coreboot coreboot/coreboot-sdk:$SDKVER \
-w /home/coreboot/coreboot ${DASHARO_SDK} \
/bin/bash -c "make olddefconfig && make -j$(nproc)"

cp build/coreboot.rom ${BOARD}_${FW_VERSION}.rom
Expand All @@ -79,7 +80,7 @@ function build_msi {

docker run --rm -t -u $UID -v $PWD:/home/coreboot/coreboot \
-v $HOME/.ssh:/home/coreboot/.ssh \
-w /home/coreboot/coreboot coreboot/coreboot-sdk:$SDKVER \
-w /home/coreboot/coreboot ${DASHARO_SDK} \
/bin/bash -c "make distclean"

cp "${DEFCONFIG}" .config
Expand All @@ -90,7 +91,7 @@ function build_msi {

docker run --rm -t -u $UID -v $PWD:/home/coreboot/coreboot \
-v $HOME/.ssh:/home/coreboot/.ssh \
-w /home/coreboot/coreboot coreboot/coreboot-sdk:$SDKVER \
-w /home/coreboot/coreboot ${DASHARO_SDK} \
/bin/bash -c "make olddefconfig && make -j$(nproc)"

cp build/coreboot.rom ${BOARD}_${FW_VERSION}_$1.rom
Expand Down Expand Up @@ -122,7 +123,7 @@ function build_protectli_vault {

docker run --rm -t -u $UID -v $PWD:/home/coreboot/coreboot \
-v $HOME/.ssh:/home/coreboot/.ssh \
-w /home/coreboot/coreboot coreboot/coreboot-sdk:$SDKVER \
-w /home/coreboot/coreboot ${DASHARO_SDK} \
/bin/bash -c "make olddefconfig && make -j$(nproc)"

cp build/coreboot.rom protectli_${BOARD}_${FW_VERSION}.rom
Expand All @@ -145,7 +146,7 @@ function build_v1x10 {

docker run --rm -t -u $UID -v $PWD:/home/coreboot/coreboot \
-v $HOME/.ssh:/home/coreboot/.ssh \
-w /home/coreboot/coreboot coreboot/coreboot-sdk:$SDKVER \
-w /home/coreboot/coreboot ${DASHARO_SDK} \
/bin/bash -c "make distclean"

cp $DEFCONFIG .config
Expand All @@ -154,7 +155,7 @@ function build_v1x10 {

docker run --rm -t -u $UID -v $PWD:/home/coreboot/coreboot \
-v $HOME/.ssh:/home/coreboot/.ssh \
-w /home/coreboot/coreboot coreboot/coreboot-sdk:$SDKVER \
-w /home/coreboot/coreboot ${DASHARO_SDK} \
/bin/bash -c "make olddefconfig && make -j$(nproc)"

cp build/coreboot.rom protectli_$1_${FW_VERSION}.rom
Expand All @@ -180,7 +181,7 @@ function build_pcengines {

docker run --rm -t -u $UID -v $PWD:/home/coreboot/coreboot \
-v $HOME/.ssh:/home/coreboot/.ssh \
-w /home/coreboot/coreboot coreboot/coreboot-sdk:$SDKVER \
-w /home/coreboot/coreboot ${DASHARO_SDK} \
/bin/bash -c "make distclean"

cp $DEFCONFIG .config
Expand All @@ -189,7 +190,8 @@ function build_pcengines {

docker run --rm -t -u $UID -v $PWD:/home/coreboot/coreboot \
-v $HOME/.ssh:/home/coreboot/.ssh \
-w /home/coreboot/coreboot coreboot/coreboot-sdk:$SDKVER \
-e BUILD_TIMELESS=${BUILD_TIMELESS} \
-w /home/coreboot/coreboot ${DASHARO_SDK} \
/bin/bash -c "make olddefconfig && make -j$(nproc)"

cp build/coreboot.rom pcengines_${VARIANT}_${FW_VERSION}.rom
Expand All @@ -213,7 +215,7 @@ function build_qemu {

docker run --rm -t -u $UID -v $PWD:/home/coreboot/coreboot \
-v $HOME/.ssh:/home/coreboot/.ssh \
-w /home/coreboot/coreboot coreboot/coreboot-sdk:$SDKVER \
-w /home/coreboot/coreboot ${DASHARO_SDK} \
/bin/bash -c "make distclean"

cp $DEFCONFIG .config
Expand All @@ -222,7 +224,8 @@ function build_qemu {

docker run --rm -t -u $UID -v $PWD:/home/coreboot/coreboot \
-v $HOME/.ssh:/home/coreboot/.ssh \
-w /home/coreboot/coreboot coreboot/coreboot-sdk:$SDKVER \
-e BUILD_TIMELESS=${BUILD_TIMELESS} \
-w /home/coreboot/coreboot ${DASHARO_SDK} \
/bin/bash -c "make olddefconfig && make -j$(nproc)"

cp build/coreboot.rom qemu_q35_${FW_VERSION}.rom
Expand All @@ -236,27 +239,60 @@ function build_qemu {
}

function build_odroid_h4 {
DEFCONFIG="configs/config.hardkernel_odroid_h4"
DEFCONFIG=$1
FW_VERSION=$(cat ${DEFCONFIG} | grep CONFIG_LOCALVERSION | cut -d '=' -f 2 | tr -d '"')

# checkout several submodules needed by these boards (some others are checked
# out by coreboot's Makefile)
git submodule update --init --force --checkout \
3rdparty/dasharo-blobs

docker run --rm -t -u $UID -v $PWD:/home/coreboot/coreboot \
-v $HOME/.ssh:/home/coreboot/.ssh \
-w /home/coreboot/coreboot coreboot/coreboot-sdk:$SDKVER \
/bin/bash -c "make distclean"
if [ "${AIRGAP}" -eq 1 ]; then
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be applied to all boards, not just selected ones. Mayeb it would also be worth to separate it into a function to reduce the LOC and overall boilerplate.

docker run --rm -t -u $UID -v $PWD:/home/coreboot/coreboot \
-v $HOME/.ssh:/home/coreboot/.ssh \
-w /home/coreboot/coreboot ${DASHARO_SDK} \
/bin/bash -c "make clean"
else
docker run --rm -t -u $UID -v $PWD:/home/coreboot/coreboot \
-v $HOME/.ssh:/home/coreboot/.ssh \
-w /home/coreboot/coreboot ${DASHARO_SDK} \
/bin/bash -c "make distclean"
fi

cp $DEFCONFIG .config

echo "Building Dasharo compatbile with Hardkernel ODROID H4 (version $FW_VERSION)"

docker run --rm -t -u $UID -v $PWD:/home/coreboot/coreboot \
-v $HOME/.ssh:/home/coreboot/.ssh \
-w /home/coreboot/coreboot coreboot/coreboot-sdk:$SDKVER \
/bin/bash -c "make olddefconfig && make -j$(nproc)"
if [ "${AIRGAP}" -eq 1 ]; then

# In this situation we assume that provided repository is ready to be used
# and nothing should be downloaded during build process.

if [ -d "${EDK2_REPO_PATH}" ]; then
# Without following sequence workspce would be created by docker with root
# privilidges and build will fail.
# Target directory
TARGET_DIR="payloads/external/edk2/workspace/Dasharo"
mkdir -p "$TARGET_DIR"
chown -R $(id -u):$(id -g) "$TARGET_DIR"
chmod -R 755 "$TARGET_DIR"
docker run --rm -t -u $UID -v $PWD:/home/coreboot/coreboot \
-v $HOME/.ssh:/home/coreboot/.ssh \
--network none \
${EDK2_REPO_PATH:+-v $EDK2_REPO_PATH:/home/coreboot/coreboot/payloads/external/edk2/workspace/Dasharo} \
-e BUILD_TIMELESS=${BUILD_TIMELESS} \
-w /home/coreboot/coreboot ${DASHARO_SDK} \
/bin/bash -c "make olddefconfig && make -j$(nproc)"
else
echo "EDK2_REPO_PATH is not defined in AIRGAP!"
exit 1
fi
else
docker run --rm -t -u $UID -v $PWD:/home/coreboot/coreboot \
-v $HOME/.ssh:/home/coreboot/.ssh \
-w /home/coreboot/coreboot ${DASHARO_SDK} \
/bin/bash -c "make olddefconfig && make -j$(nproc)"
fi
Comment on lines +266 to +295
Copy link
Contributor

@miczyg1 miczyg1 Mar 27, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be applied to all boards, not just selected ones. Maybe it would also be worth to separate it into a function to reduce the LOC and overall boilerplate. I think the docker commands to start the build are the same for every board.


cp build/coreboot.rom hardkernel_odroid_h4_${FW_VERSION}.rom
if [ $? -eq 0 ]; then
Expand Down Expand Up @@ -350,7 +386,12 @@ case "$CMD" in
build_qemu "_all_menus"
;;
"odroid_h4" | "odroid_H4" | "ODROID_H4" )
build_odroid_h4
BOARD="odroid_h4"
build_odroid_h4 "configs/config.hardkernel_odroid_h4"
;;
"odroid_h4_btg" )
BOARD="odroid_h4"
build_odroid_h4 "configs/config.hardkernel_odroid_h4_btg"
;;
*)
echo "Invalid command: \"$CMD\""
Expand Down