3 CROSS_COMPILE=${CROSS_COMPILE:-aarch64-linux-gnu-}
5 NCPUS=`cat /proc/cpuinfo | grep processor | wc -l`
7 # Check this system has ccache
11 if [ "$?" -eq "0" ]; then
18 if [ -d output ]; then
30 DTB1=meson64_odroidc4.dtb
31 DTB2=meson64_odroidn2_drm.dtb
46 # set EXTRAVERSION for each board
47 sed -i "s/^EXTRAVERSION.*/EXTRAVERSION = -TIZEN-amlogic-${OUT_DIR}/" Makefile
53 sed -i "s/^EXTRAVERSION.*/EXTRAVERSION =/" Makefile
58 rm -f arch/arm64/boot/Image*
60 [ -d output/${OUT_DIR} ] || mkdir -p output/${OUT_DIR}
62 if ! [ -e .config ]; then
63 make tizen_${CONFIG}_defconfig
65 make -j $NCPUS Image.gz dtbs
66 if [ ! -f "./arch/arm64/boot/Image.gz" ]; then
72 cp arch/arm64/boot/dts/amlogic/${DTB1} ./output/
73 cp arch/arm64/boot/dts/amlogic/${DTB2} ./output/
74 cp arch/arm64/boot/Image.gz ./output/${OUT_DIR}/
79 [ -e /usr/bin/make_ext4fs ] && USE_MAKE_EXT4FS=1
80 if [ "$USE_MAKE_EXT4FS" != "1" ]; then
81 # get sudo permission for mount
82 sudo echo "dummy" > /dev/null
90 [ -d ${MOD_DIR} ] || mkdir ${MOD_DIR}
92 make -j $NCPUS modules
93 make modules_install INSTALL_MOD_PATH=${MOD_DIR} INSTALL_MOD_STRIP=1
99 MOD_IMG="usr/modules.img"
102 if [ "$USE_MAKE_EXT4FS" == "1" ]; then
103 /usr/bin/make_ext4fs -b 4096 -L modules -l ${MOD_SIZE}M $MOD_IMG ${MOD_DIR}/lib/modules/
105 dd if=/dev/zero of=${MOD_IMG} bs=1M count=${MOD_SIZE}
106 mkfs.ext4 -F -b 4096 -L modules ${MOD_IMG}
108 [ -d ${MOD_DIR}/mnt ] || mkdir ${MOD_DIR}/mnt
110 sudo mount -o loop ${MOD_IMG} ${MOD_DIR}/mnt
111 sudo cp -rf ${MOD_DIR}/lib/modules/* ${MOD_DIR}/mnt
112 sudo -n chown root:root ${MOD_DIR}/mnt -R
114 sudo umount ${MOD_DIR}/mnt
116 cp usr/modules.img ./output
124 # Create boot tarball for the lthor flashing
126 BOOT_TARBALL=tizen-local-${DATE}-boot-arm64-${BOARDS}.tar.gz
129 OUTPUT_FILES=`find * -type f`
131 tar czf output/${BOOT_TARBALL} -C output ${OUTPUT_FILES}
132 if [ "$?" != "0" ]; then
133 echo "Failed to create boot tarball"
137 echo "Crated output/${BOOT_TARBALL}"
146 # in kernel tree, c4 and n2 are built as a result
147 # and vim3 and vim3l are built as a result.
152 echo "linux kernel building script for tizen amlogic boards"
153 echo "usage: $0 target"
154 echo "where target is one of: c4 n2 vim3 vim3l all"
163 export ARCH=${ARM_ARCH}
164 export CROSS_COMPILE="$CCACHE $CROSS_COMPILE"
166 if [ "$1" = "all" ]; then
167 echo "It will remove local .config to build entire boards"
169 if [ -e .config ]; then
170 CHECK_ODROID=`grep CONFIG_ARCH_MESON64_ODROID_COMMON=y .config`
171 if [ "$BOARDS" = "c4" ] || [ "$BOARDS" = "n2" ]; then
172 if [ "z${CHECK_ODROID}" = "z" ]; then
173 echo "There is local .config, but it is differen from ${BOARD}."
174 echo "Please try after removing .config."
178 if [ "z${CHECK_ODROID}" != "z" ]; then
179 echo "There is local .config, but it is differen from ${BOARD}."
180 echo "Please try after removing .config."
184 echo "There is local .config and build with the file."
190 if [ "$1" = "all" ]; then
201 if [ "$1" = "all" ]; then