Skip to content
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

scripts: refine build process #151

Merged
merged 1 commit into from
Nov 28, 2024
Merged
Show file tree
Hide file tree
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
22 changes: 15 additions & 7 deletions scripts/envsetup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -783,7 +783,7 @@ function build_rv_ubuntu_kernel()
fi

local KERNELRELEASE=$(make ARCH=riscv LOCALVERSION="" kernelrelease)
make -j$(nproc) ARCH=riscv CROSS_COMPILE=$RISCV64_LINUX_CROSS_COMPILE LOCALVERSION="" bindeb-pkg
make -j$(nproc) ARCH=riscv CROSS_COMPILE=$RISCV64_LINUX_CROSS_COMPILE LOCALVERSION="" bindeb-pkg dtbs
ret=$?
if [ $ret -ne 0 ]; then
popd
Expand All @@ -798,6 +798,9 @@ function build_rv_ubuntu_kernel()
mv ../linux-image-${KERNELRELEASE}_*.deb $RV_DEB_INSTALL_DIR/linux-image-${KERNELRELEASE}.deb
mv ../linux-headers-${KERNELRELEASE}_*.deb $RV_DEB_INSTALL_DIR/linux-headers-${KERNELRELEASE}.deb
mv ../linux-libc-dev_${KERNELRELEASE}-*.deb $RV_DEB_INSTALL_DIR/linux-libc-dev_${KERNELRELEASE}.deb

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

popd
}

Expand All @@ -806,6 +809,7 @@ function clean_rv_ubuntu_kernel()
RV_KERNEL_BUILD_DIR=$RV_TOP_DIR/build/$CHIP/linux-riscv/ubuntu
rm -rf $RV_KERNEL_BUILD_DIR
rm -f $RV_DEB_INSTALL_DIR/linux-*.deb
rm -f $RV_FIRMWARE_INSTALL_DIR/*.dtb
}

function build_rv_fedora_kernel()
Expand Down Expand Up @@ -916,7 +920,7 @@ EOT
RPMBUILD_DIR=$RV_KERNEL_SRC_DIR/rpmbuild
fi

make -j$(nproc) ARCH=riscv CROSS_COMPILE=$RISCV64_LINUX_CROSS_COMPILE LOCALVERSION="" rpm-pkg
make -j$(nproc) ARCH=riscv CROSS_COMPILE=$RISCV64_LINUX_CROSS_COMPILE LOCALVERSION="" rpm-pkg dtbs
ret=$?
rm ~/.rpmmacros
if [ -e ~/.rpmmacros.orig ]; then
Expand All @@ -938,6 +942,7 @@ EOT
fi

cp $RPMBUILD_DIR/RPMS/riscv64/*.rpm $RV_RPM_INSTALL_DIR/
cp $RV_KERNEL_SRC_DIR/arch/riscv/boot/dts/sophgo/${CHIP}-*.dtb $RV_FIRMWARE_INSTALL_DIR
make ARCH=riscv CROSS_COMPILE=$RISCV64_LINUX_CROSS_COMPILE distclean
rm *.tar.gz
rm -rf $RPMBUILD_DIR
Expand All @@ -950,6 +955,7 @@ function clean_rv_euler_kernel()
make distclean
popd
rm -f $RV_RPM_INSTALL_DIR/kernel-*.rpm
rm -f $RV_FIRMWARE_INSTALL_DIR/*.dtb
}

RAMDISK_CPU_TYPES=(
Expand Down Expand Up @@ -1446,12 +1452,14 @@ function build_rv_firmware()
if [ "$CHIP" = "bm1690" ];then
build_rv_kernel ap
build_rv_kernel tp
else
build_rv_uroot
elif [ "$CHIP" = "mango" ];then
build_rv_kernel
build_rv_uroot
build_rv_edk2
elif [ "$CHIP" = "sg2044" ];then
build_rv_edk2
fi

build_rv_uroot
}

function clean_rv_firmware()
Expand All @@ -1471,7 +1479,7 @@ function build_rv_firmware_bin()

if [ ! -e "$RELEASED_NOTE_MD" ] || [ ! -s "$RELEASED_NOTE_MD" ];then
version="1.0.0"
else
else
version=$(awk 'END {split($1, a, "_"); print a[1]}' $RELEASED_NOTE_MD)
fi

Expand All @@ -1488,7 +1496,7 @@ function build_rv_firmware_bin()
cp firmware-$version.bin image-bmc
$RV_SCRIPTS_DIR/gen-tar-for-bmc.sh image-bmc -o obmc-bios.tar.gz -m ast2600-sophgo -v $version -s
fi
rm -f image-bmc *.xml
rm -f image-bmc *.xml

popd
}
Expand Down
6 changes: 2 additions & 4 deletions scripts/gen_sg2044_img.sh
Original file line number Diff line number Diff line change
Expand Up @@ -96,19 +96,17 @@ function build_rv_image()
sudo cp -v $RV_FIRMWARE_INSTALL_DIR/u-boot.bin $EFI_PARTITION_DIR/riscv64
fi

sudo cp -v $RV_FIRMWARE_INSTALL_DIR/initrd.img $EFI_PARTITION_DIR/riscv64
sudo cp -v $RV_FIRMWARE_INSTALL_DIR/zsbl.bin $EFI_PARTITION_DIR/riscv64
sudo cp -v $RV_FIRMWARE_INSTALL_DIR/fw_dynamic.bin $EFI_PARTITION_DIR/riscv64

if [ "$CHIP" = "bm1690" ]; then
sudo cp -v $RV_FIRMWARE_INSTALL_DIR/initrd.img $EFI_PARTITION_DIR/riscv64
sudo cp -v $RV_FIRMWARE_INSTALL_DIR/rp_Image $EFI_PARTITION_DIR/riscv64
sudo cp -v $RV_TOP_DIR/bootloader-riscv/scripts/bm1690-config.ini $RV_FIRMWARE_INSTALL_DIR/conf.ini
sudo cp -v $RV_FIRMWARE_INSTALL_DIR/conf.ini $EFI_PARTITION_DIR/riscv64
else
sudo cp -v $RV_FIRMWARE_INSTALL_DIR/riscv64_Image $EFI_PARTITION_DIR/riscv64
fi

sudo cp -v $RV_FIRMWARE_INSTALL_DIR/*.dtb $EFI_PARTITION_DIR/riscv64
sudo cp -v $RV_FIRMWARE_INSTALL_DIR/${CHIP}-*.dtb $EFI_PARTITION_DIR/riscv64

echo 'mount system files'
sudo mount --bind /proc $RV_OUTPUT_DIR/root/proc
Expand Down
Loading