standard_build/build.sh

71 lines
1.8 KiB
Bash
Raw Normal View History

2024-11-08 14:50:39 +08:00
#!/bin/bash
2024-11-27 11:30:36 +08:00
PACKAGE_CONFIG=${PACKAGE_CONFIG:-package.config}
. ${PACKAGE_CONFIG}
2024-11-08 14:50:39 +08:00
FOLDER="`pwd`/${FOLDER_NAME}/"
echo "build dtb"
DTB_PATH=system-top.dtb
echo "dtc compile [${DTS_FOLDER}] to system-top.dtb"
cd ${DTS_FOLDER}
make ${DTB_TARGET} > /dev/null
E=$?
cd -
if [ "0${E}" -eq "0" ]; then
echo "dtb create ok"
else
echo "cmd [cd ${DTS_FOLDER} && make ${DTB_TARGET}] is error. try your self"
exit 1
fi
echo "copy kernel"
echo "cp ${FOLDER}/arch/arm64/boot/Image ./images/Image"
cp ${FOLDER}/arch/arm64/boot/Image ./images/Image
cd images/
echo "======make uimage=========================================="
mkimage -A arm64 -O linux -T kernel -C none -a ${KERNEL_ADDRESS} -e ${ENTRY_POINT} -n "${UIMAGE_DESC}" -d Image ${UIMAGE_NAME}
cd -
echo "done ./images/${UIMAGE_NAME}"
if [ "_$1" == "_1" ]; then
# if [ "_$2" == "_1" ]; then
echo "repack ramdisk"
TOP=`pwd`
cd images
T=`pwd`
echo "clean old, pwd:${T}"
fakeroot -- rm -fr rootfs_tmp/
echo "update modules"
mkdir -p rootfs_tmp/
fakeroot -- tar -xf ${RAM_ROOTFS} -C rootfs_tmp/
if [ -e "rootfs_tmp/rootfs_tmp" ]; then
fakeroot -- mv rootfs_tmp/rootfs_tmp/* rootfs_tmp/
fi
if [ -f "linux-5.15.0+-arm64.tar.gz" ]; then
fakeroot -- tar --keep-directory-symlink -xf "linux-5.15.0+-arm64.tar.gz" -C rootfs_tmp/
fi
fakeroot cp -r ramdisk_files/* rootfs_tmp/
cd rootfs_tmp/
echo "recreate ramdisk"
if [ ! -e "init" ]; then
echo -e "#!/bin/bash\\nexec /linuxrc" > init
chmod a+x init
fi
fakeroot -- bash -c "find ./* | cpio -H newc -o" | gzip -c > ../initrd.img
#sudo rm -fr rootfs_tmp/
cd ${TOP}
# fi
# echo "ramdisk boot ub"
# mkimage -f conf/fitImage-ramdisk.its -E -p 0x800 -B 0x200 ./images/boot-ramdisk.img
# echo "done ./images/boot-ramdisk.img"
else
echo "done"
fi