Skip to content
Snippets Groups Projects
Verified Commit f2f118be authored by Johannes Schauer Marin Rodrigues's avatar Johannes Schauer Marin Rodrigues
Browse files

build u-boot image for sd as well as for emmc

 - switch to POSIX shell
 - set -u
 - make shellcheck clean
 - avoid cd in favour of -C and env --chdir
 - bump u-boot version from v2023.10-rc4 to v2023.10
 - verify top git hashes for u-boot and atf
 - verify that BPI Block Copy src is correct for sd and emmc
 - verify that sd and emmc images differ only in the Block Copy src
parent 0bc4da6c
No related branches found
No related tags found
1 merge request!3Draft: u-boot on emmc and /boot on sata
Pipeline #1489 passed
......@@ -8,4 +8,5 @@ build:
./build.sh
artifacts:
paths:
- flash.bin
- flash-sd.bin
- flash-emmc.bin
#!/bin/bash
#!/bin/sh
set -xe
set -xeu
if [ -z ${SOURCE_DATE_EPOCH:+x} ] && git -C . rev-parse 2>/dev/null; then
export SOURCE_DATE_EPOCH=$(git log -1 --format=%ct)
SOURCE_DATE_EPOCH="$(git log -1 --format=%ct)"
export SOURCE_DATE_EPOCH
fi
export CROSS_COMPILE=aarch64-linux-gnu-
export ARCH=arm64
export LDFLAGS=--no-warn-rwx-segments
# build Reset Configuration Word
cd rcw/ls1028a-mnt-reform2
make
cd ../..
make -C rcw/ls1028a-mnt-reform2
# build u-boot
# TODO: customize dts
git clone --branch v2023.10-rc4 --depth 1 https://github.com/u-boot/u-boot.git
cd u-boot
#git checkout 252592214f79d8206c3cf0056a8827a0010214e0
cp ../u-boot-config ./.config
for p in ../patches/*.patch
do
patch -p1 <"$p"
done
make -j$(nproc)
cd ..
if [ ! -d u-boot ]; then
git clone --branch v2023.10 --depth 1 https://github.com/u-boot/u-boot.git
if [ "$(git -C u-boot rev-parse --verify HEAD)" != "4459ed60cb1e0562bc5b40405e2b4b9bbf766d57" ]; then
echo "unexpected top atf commit" >&2
exit 1
fi
#git checkout 252592214f79d8206c3cf0056a8827a0010214e0
cp ./u-boot-config ./u-boot/.config
for p in ./patches/*.patch
do
env --chdir=u-boot patch -p1 <"$p"
done
make -C u-boot -j"$(nproc)"
fi
# build ARM Trusted Firmware
git clone https://source.mnt.re/reform/reform-ls1028a-atf.git atf
export DDR_BIST=no
export DDR_DEBUG=yes
export DDR_PHY_DEBUG=yes
if [ ! -d atf ]; then
git clone https://source.mnt.re/reform/reform-ls1028a-atf.git atf
if [ "$(git -C atf rev-parse --verify HEAD)" != "289be80193cd79029f1f897ddb9c175306bce227" ]; then
echo "unexpected top atf commit" >&2
exit 1
fi
fi
cd atf
make -j$(nproc) PLAT=ls1028ardb fip pbl BOOT_MODE=sd RCW=../rcw/ls1028a-mnt-reform2/R_PSPH_0xb8be/rcw_1500_sdboot.bin BL33=../u-boot/u-boot-dtb.bin
cd ..
for bm in sd emmc; do
rm -f "atf/build/ls1028ardb/release/bl2_sd.pbl" "atf/build/ls1028ardb/release/bl2_emmc.pbl"
env DDR_BIST=no DDR_DEBUG=yes DDR_PHY_DEBUG=yes \
make -C atf -j"$(nproc)" \
PLAT=ls1028ardb fip pbl \
BOOT_MODE="$bm" \
RCW=../rcw/ls1028a-mnt-reform2/R_PSPH_0xb8be/rcw_1500_sdboot.bin \
BL33=../u-boot/u-boot-dtb.bin
cp "atf/build/ls1028ardb/release/bl2_$bm.pbl" "flash-$bm.bin"
dd if=atf/build/ls1028ardb/release/fip.bin of="flash-$bm.bin" bs=512 seek=2040
done
cp atf/build/ls1028ardb/release/bl2_sd.pbl flash.bin
dd if=atf/build/ls1028ardb/release/fip.bin of=flash.bin bs=512 seek=2040
# make sure that BPI Block Copy src is 9 for emmc and 8 for sd
printf '\010' | cmp --ignore-initial=0:156 --bytes=1 - flash-sd.bin
printf '\011' | cmp --ignore-initial=0:156 --bytes=1 - flash-emmc.bin
# make sure that the remainder is identical
cp flash-sd.bin flash-sd.bin.tmp
printf '\011' | dd of=flash-sd.bin.tmp seek=1 bs=156 conv=notrunc
cmp flash-sd.bin.tmp flash-emmc.bin
rm flash-sd.bin.tmp
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment