forked from CPEN391-Team-4/hardware
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.sh
executable file
·86 lines (63 loc) · 2.4 KB
/
build.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
#!/usr/bin/env bash
export SOCEDS_DEST_ROOT=/opt/intelFPGA/20.1/embedded
export QUARTUS_ROOTDIR=/opt/intelFPGA_lite/20.1/quartus
. /opt/intelFPGA_lite/20.1/quartus/adm/qenv.sh
. /opt/intelFPGA/20.1/embedded/env.sh
export PATH=/opt/intelFPGA/20.1/embedded/host_tools/linaro/gcc/bin:$PATH
export PATH=/opt/intelFPGA_lite/20.1/quartus/sopc_builder/bin:$PATH
set -e
cd /src/
export ARCH=arm
export CROSS_COMPILE=arm-eabi-
pushd hw/quartus
make rbf
make dtb
# make preloader
# pushd software/spl_bsp
# [ ! -d "u-boot-socfpga" ] \
# && git clone --depth=1 --branch=ACDS20.1STD_REL_GSRD_PR https://github.com/altera-opensource/u-boot-socfpga
# pushd u-boot-socfpga
# ./arch/arm/mach-socfpga/qts-filter.sh cyclone5 ../../../ ../ ./board/altera/cyclone5-socdk/qts/
# make socfpga_cyclone5_defconfig
# make -j5
# popd
# popd
popd
pushd sw/boot
../../hw/quartus/software/spl_bsp/u-boot-socfpga/tools/mkimage -A arm -O linux -T script -C none -a 0 -e 0 -n "Cyclone V script" -d u-boot.txt u-boot.scr
popd
pushd sw
if [ ! -d "linux-socfpga" ]
then
git clone --depth=1 --branch=ACDS20.1STD_REL_GSRD_PR https://github.com/altera-opensource/linux-socfpga
echo "#include \"soc_system.dtsi\"" >> arch/arm/boot/dts/socfpga_cyclone5_socdk.dts
fi
pushd linux-socfpga
cp -f ../kernelconfig .config
cp -f ../../hw/quartus/soc_system.dts arch/arm/boot/dts/soc_system.dtsi
# make socfpga_defconfig
make -j 5 zImage modules dtbs
make modules_install INSTALL_MOD_PATH=modules_install
rm -rf modules_install/lib/modules/*/build
rm -rf modules_install/lib/modules/*/source
popd
if [ ! -d "rootfs" ]
then
wget https://rcn-ee.com/rootfs/eewiki/minfs/ubuntu-20.04-minimal-armhf-2020-05-10.tar.xz
mkdir rootfs
tar xvf ubuntu-20.04-minimal-armhf-2020-05-10.tar.xz
tar xf ubuntu-20.04-minimal-armhf-2020-05-10/armhf-rootfs-ubuntu-focal.tar -C rootfs
fi
cp -f ../hw/quartus/software/spl_bsp/u-boot-socfpga/u-boot-with-spl.sfp .
cp -f ../hw/quartus/output_files/soc_system.rbf boot
cp -f ../hw/quartus/output_files/soc_system.dtb boot/socfpga_cyclone5_socdk.dtb
cp -f linux-socfpga/arch/arm/boot/zImage boot
mkdir -p rootfs/lib/modules
rm -rf rootfs/lib/modules/*
cp -rfv linux-socfpga/modules_install/lib/modules/* rootfs/lib/modules
python3 make_sdimage_p3.py -f \
-P u-boot-with-spl.sfp,num=3,format=raw,size=10M,type=A2 \
-P rootfs/*,num=2,format=ext2,size=1500M \
-P boot/*,num=1,format=fat32,size=500M -s 2G \
-n sdcard.img
popd