Skip to content

Commit

Permalink
scripts: refine mango and sg2044 build scripts
Browse files Browse the repository at this point in the history
 - Moved the DTB copy earlier to avoid issues with kernel Makefile version or
   rpmbuild tool version inconsistencies.

 - FSBL source code is not publicly available; the daily build system updates
   the SG2044 binary at a fixed link and will automatically download it if
   missing locally.

Signed-off-by: Jingyu Li <[email protected]>
  • Loading branch information
jingyu-li98 authored and xingxg2022 committed Dec 3, 2024
1 parent a052f45 commit 828af44
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 11 deletions.
21 changes: 10 additions & 11 deletions scripts/envsetup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -923,7 +923,16 @@ EOT
RPMBUILD_DIR=$RV_KERNEL_SRC_DIR/rpmbuild
fi

make -j$(nproc) ARCH=riscv CROSS_COMPILE=$RISCV64_LINUX_CROSS_COMPILE LOCALVERSION="" rpm-pkg dtbs
make -j$(nproc) ARCH=riscv CROSS_COMPILE=$RISCV64_LINUX_CROSS_COMPILE LOCALVERSION="" dtbs
if [ ! -d $RV_FIRMWARE_INSTALL_DIR ]; then
mkdir -p $RV_FIRMWARE_INSTALL_DIR
else
rm -f $RV_FIRMWARE_INSTALL_DIR/${CHIP}-*.dtb
fi

cp $RV_KERNEL_SRC_DIR/arch/riscv/boot/dts/sophgo/${CHIP}-*.dtb $RV_FIRMWARE_INSTALL_DIR

make -j$(nproc) ARCH=riscv CROSS_COMPILE=$RISCV64_LINUX_CROSS_COMPILE LOCALVERSION="" rpm-pkg
ret=$?
rm ~/.rpmmacros
if [ -e ~/.rpmmacros.orig ]; then
Expand All @@ -944,18 +953,8 @@ EOT
rm -f $RV_RPM_INSTALL_DIR/kernel-*.rpm
fi

if [ ! -d $RV_FIRMWARE_INSTALL_DIR ]; then
mkdir -p $RV_FIRMWARE_INSTALL_DIR
else
rm -f $RV_FIRMWARE_INSTALL_DIR/${CHIP}-*.dtb
fi

cp $RPMBUILD_DIR/RPMS/riscv64/*.rpm $RV_RPM_INSTALL_DIR/
if [[ ${KERNELRELEASE:0:4} == "6.1." ]]; then
cp $RPMBUILD_DIR/BUILD/kernel-${KERNELRELEASE}/arch/riscv/boot/dts/sophgo/${CHIP}-*.dtb $RV_FIRMWARE_INSTALL_DIR
else
cp $RV_KERNEL_SRC_DIR/arch/riscv/boot/dts/sophgo/${CHIP}-*.dtb $RV_FIRMWARE_INSTALL_DIR
fi
make ARCH=riscv CROSS_COMPILE=$RISCV64_LINUX_CROSS_COMPILE distclean
rm *.tar.gz
rm -rf $RPMBUILD_DIR
Expand Down
8 changes: 8 additions & 0 deletions scripts/gen_sg2044_img.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ RV_EULER_OFFICIAL_IMAGE=openEuler-24.03-riscv64-sg2044-20241025.template.img
DOWNLOAD_RV_EULER_OFFICIAL_IMAGE="wget https://github.com/sophgo/bootloader-riscv/releases/download/sg2044-v0.1/openEuler-24.03-riscv64-sg2044-20241025.template.img.xz"
UNCOMPRESS_RV_EULER_OFFICIAL_IMAGE="unxz $RV_EULER_OFFICIAL_IMAGE.xz"

RV_SG2044_FSBL_BIN="https://github.com/sophgo/bootloader-riscv/releases/download/sg2044-v0.1/fsbl.bin"

function get_distro_info()
{
DISTRO_NAME=`echo $1 | awk -F '-' '{print $1}'`
Expand Down Expand Up @@ -86,6 +88,12 @@ function build_rv_image()

sudo mkdir $EFI_PARTITION_DIR/riscv64

if [ "$CHIP" = "sg2044" ]; then
if [ ! -f "$RV_FIRMWARE_INSTALL_DIR/fsbl.bin" ]; then
wget -O "$RV_FIRMWARE_INSTALL_DIR/fsbl.bin" "$RV_SG2044_FSBL_BIN"
fi
fi

sudo cp -v $RV_FIRMWARE_INSTALL_DIR/fsbl.bin $EFI_PARTITION_DIR/riscv64

if [ -f $RV_FIRMWARE_INSTALL_DIR/${CHIP^^}.fd ]; then
Expand Down

0 comments on commit 828af44

Please sign in to comment.