-
Notifications
You must be signed in to change notification settings - Fork 15
/
Copy pathbuild.sh
49 lines (39 loc) · 1 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
#!/bin/sh
## script to build bootloader binaries for:
## Omega2 - 64MB DRAM = 512Mb
## Omega2+ - 128MB DRAM = 1024Mb
CONFIG=".config"
BIN="uboot.bin"
DATE=`date +%Y%m%d`
# disable all dram components
resetDramSelection () {
sed -i "s/ON_BOARD_\(.*\)_DRAM_COMPONENT=y/\# ON_BOARD_\1_DRAM_COMPONENT is not set/" $CONFIG
}
# set a specific dram component
# $1 - Mb of DRAM
setDramSelection () {
sed -i "s/\# ON_BOARD_${1}M_DRAM_COMPONENT is not set/ON_BOARD_${1}M_DRAM_COMPONENT=y/" $CONFIG
}
# build bootloader binary for specific
# $1 - device name
# $2 - device DRAM in Mb
buildBinary () {
local device="$1"
local dram="$2"
make clean
# make DRAM selection
resetDramSelection
setDramSelection "$dram"
# apply the new config
(
echo x
echo y
) | make menuconfig
# build and rename the image
make
mv $BIN "uboot-${device}-${DATE}.bin"
}
# main program
buildBinary "omega2" "512"
buildBinary "omega2p" "1024"
echo "> Done"