-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.sh
More file actions
executable file
·60 lines (56 loc) · 2.2 KB
/
build.sh
File metadata and controls
executable file
·60 lines (56 loc) · 2.2 KB
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
#!/bin/bash
# vivado -mode batch -source build_hw_project.tcl -nolog -nojournal -notrace -tclargs minized_sbc base
# xsct -sdx -nodisp build_fsbl.tcl minized_sbc base
# xsct -sdx -nodisp build_dtb.tcl minized_sbc base
# Initialization
SECONDS=0
cores=$(nproc)
cores=$((cores+1))
[ ! -d "output/linux" ] && mkdir -p output/linux
[[ ! -f "buildroot/Makefile" ||
! -d "auxiliary/bdf/minized" ||
! -d "auxiliary/dts/device_tree" ||
! -d "auxiliary/hdl/scripts" ||
! -d "auxiliary/meta/recipes-bsp" ]] && git submodule update --init --jobs $cores
# Generate HW project if missing
if [ ! -f "output/fpga/minized_sbc_base.xsa" ]; then
echo "Generating hardware project..."
vivado -mode batch -source build_hw_project.tcl -nolog -nojournal -notrace
echo "Hardware project generated in output/fpga"
else
# Generate FSBL & DTS if needed
fsbl_gen=true
dts_gen=true
if [ -f "output/fsbl/hardware_description.xsa" ]; then
if cmp -s -- "output/fpga/minized_sbc_base.xsa" "output/fsbl/hardware_description.xsa"; then
fsbl_gen=false
fi
fi
if [ -f "output/dts/hardware_description.xsa" ]; then
if cmp -s -- "output/fpga/minized_sbc_base.xsa" "output/dts/hardware_description.xsa"; then
dts_gen=false
fi
fi
if [ "$fsbl_gen" = true ]; then
echo "Generating FSBL..."
xsct -sdx -nodisp build_fsbl.tcl
echo "FSBL generated in output/fsbl"
fi
if [ "$dts_gen" = true ]; then
echo "Generating DTS..."
xsct -sdx -nodisp build_dts.tcl
echo "DTS generated in output/dts"
fi
if [[ "$fsbl_gen" = true || "$dts_gen" = true ]]; then
echo "Generating loadable FPGA image..."
cp output/fsbl/minized_sbc_base.bit output/fpga/image_raw.bit
bootgen -w on -image config/bitstream.bif -arch zynq -process_bitstream bin
mv output/fpga/image_raw.bit.bin output/fpga/image_loadable.bit
fi
# Run buildroot
cd buildroot
make defconfig BR2_DEFCONFIG=../config/buildroot.cfg BR2_EXTERNAL=../extra BR2_JLEVEL=$cores O=../output/linux
cd ../output/linux
make BR2_JLEVEL=$cores $@
fi
echo "Finished in $((SECONDS/3600))h $(((SECONDS/60)%60))m $((SECONDS%60))s"