3 MOD_IMG="usr/modules.img"
5 NCPUS=`grep ^processor /proc/cpuinfo | wc -l`
8 # Check this system has ccache
12 if [ "$?" -eq "0" ]; then
17 function mk_modules() {
18 [ -e /usr/bin/make_ext4fs ] && USE_MAKE_EXT4FS=1
19 if [ "$USE_MAKE_EXT4FS" != "1" ]; then
23 make ARCH=${ARCH} CROSS_COMPILE="$CROSS_COMPILER" modules_prepare
24 make ARCH=${ARCH} CROSS_COMPILE="$CROSS_COMPILER" modules -j ${NCPUS}
26 if [ "$?" != "0" ]; then
27 echo "Failed to make modules"
31 [ -d ${MOD_DIR} ] || mkdir ${MOD_DIR}
33 make ARCH=${ARCH} CROSS_COMPILE="$CROSS_COMPILER" modules_install INSTALL_MOD_PATH=${MOD_DIR} INSTALL_MOD_STRIP=1
35 if [ "$USE_MAKE_EXT4FS" == "1" ]; then
36 /usr/bin/make_ext4fs -b 4096 -L modules -l ${MOD_SIZE}M $MOD_IMG ${MOD_DIR}/lib/modules/
38 dd if=/dev/zero of=${MOD_IMG} bs=1M count=${MOD_SIZE}
39 mkfs.ext4 -F -b 4096 -L modules ${MOD_IMG}
40 [ -d ${MOD_DIR}/mnt ] || mkdir ${MOD_DIR}/mnt
41 sudo mount -o loop ${MOD_IMG} ${MOD_DIR}/mnt
42 sudo cp -rf ${MOD_DIR}/lib/modules/* ${MOD_DIR}/mnt
44 sudo umount ${MOD_DIR}/mnt
53 rm -f arch/riscv/boot/Image
54 rm -f arch/riscv/boot/dts/starfive/*.dtb
57 rm -f output/modules.img
60 CROSS_COMPILER=riscv64-linux-gnu-
62 if ! [ -e .config ] ; then
63 make ARCH=${ARCH} CROSS_COMPILE="$CROSS_COMPILER" tizen_visionfive2_defconfig
65 make ARCH=${ARCH} CROSS_COMPILE="$CROSS_COMPILER" -j8
66 if [ ! -f "./arch/riscv/boot/Image" ]; then
71 # Make module.img file
74 if [ ! -d output ] ; then
78 cp usr/modules.img ./output
80 cp ./arch/riscv/boot/Image ./output
81 cp ./arch/riscv/boot/dts/starfive/*.dtb ./output
82 tar cvf linux-visionfive2.tar -C output Image jh7110-starfive-visionfive-2-v1.2a.dtb jh7110-starfive-visionfive-2-v1.3b.dtb modules.img
83 mv linux-visionfive2.tar ./output/