aboutsummaryrefslogtreecommitdiffstats
path: root/main/u-boot/APKBUILD
blob: 0cc52555200a892f87354537ff3ff34547c93af0 (plain)
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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
# Contributor: William Pitcock <nenolod@dereferenced.org>
# Contributor: Timo Teras <timo.teras@iki.fi>
# Maintainer: Leonardo Arena <rnalrd@alpinelinux.org>
pkgname=u-boot
pkgver=2017.01
pkgrel=0
pkgdesc="u-boot bootloader common files"
url="http://www.denx.de/wiki/U-Boot/"
arch="armhf aarch64"
license="GPL2"
depends=""
depends_dev=""
makedepends="$depends_dev bc dtc"
install=""
source="ftp://ftp.denx.de/pub/u-boot/u-boot-${pkgver//_/-}.tar.bz2
	README.txt
	update-u-boot
	"

_srcdir="$srcdir"/u-boot-${pkgver//_/-}
builddir="$srcdir"/build

case "$CARCH" in
armhf) board_configs="
	beagleboard:am335x_boneblack
	cubieboard:Cubieboard,Cubieboard2
	raspberrypi:rpi,rpi_2,rpi_3_32b
	wandboard:wandboard
	";;
aarch64) board_configs="
	thunderx:thunderx_88xx
	";;
esac

_allboards=""
for board_config in $board_configs; do
	_allboards="$_allboards $pkgname-${board_config%%:*}"
done
subpackages="$pkgname-all:_all $_allboards"

build() {
	cd "$_srcdir"
	touch include/config.h
	LC_ALL=C date +'#define U_BOOT_DATE "%b %d %C%y"' > include/timestamp_autogenerated.h
	LC_ALL=C date +'#define U_BOOT_TIME "%T"' >> include/timestamp_autogenerated.h

	local board_config board
	for board_config in $board_configs; do
		local configs="${board_config#*:}"
		for board in ${configs//,/ }; do
			msg "Building u-boot for $board"
			export BUILD_DIR="$builddir"/$board
			mkdir -p "$BUILD_DIR"
			make O="$BUILD_DIR" ${board}_config || return 1
			make O="$BUILD_DIR" all || return 1
		done
	done
}

package() {
	cd "$builddir"
	mkdir -p "$pkgdir"/usr/share/$pkgname "$pkgdir"/usr/sbin
	install "$srcdir"/README.txt "$pkgdir"/usr/share/$pkgname/README.txt || return 1
	install "$srcdir"/update-u-boot "$pkgdir"/usr/sbin || return 1
}

_all() {
	pkgdesc="u-boot for all boards (meta package)"
	depends="$_allboards"

	mkdir -p "$subpkgdir"/
}

_split_boards() {
	cd "$builddir"
	pkgdesc="u-boot for $1"
	depends="u-boot"
	shift
	local board
	for board; do
		msg "Including board $board"
		mkdir -p "$subpkgdir"/usr/share/$pkgname/$board
		export BUILD_DIR="$builddir"/$board
		local ok=no
		for image in u-boot-sunxi-with-spl.bin -- MLO SPL u-boot.img -- u-boot.bin; do
			if [ "$image" = "--" ]; then
				[ "$ok" = yes ] && break
				continue
			fi
			if [ -e "$BUILD_DIR"/$image ]; then
				cp "$BUILD_DIR"/$image "$subpkgdir"/usr/share/$pkgname/$board \
					|| return 1
				ok=yes
			fi
		done
		[ "$ok" = yes ] || return 1
	done
}

for board_config in $board_configs; do
	_board="${board_config%%:*}"
	_configs="${board_config#*:}"
	eval "${_board}() { _split_boards $_board ${_configs//,/ }; }"
done

md5sums="ad2d82d5b4fa548b2b95bbc26c9bad79  u-boot-2017.01.tar.bz2
13684d0a2495da42144e1805fc5492d1  README.txt
c863032a8a2cd94b3ab9b837a640edfc  update-u-boot"
sha256sums="6c425175f93a4bcf2ec9faf5658ef279633dbd7856a293d95bd1ff516528ecf2  u-boot-2017.01.tar.bz2
80538ab8339bf84b8e3cfe8eb1cab9cb5d25bbecc6ba45824fb83e868df9160e  README.txt
af8cef011c90dd44385a6105aee16f900fbf37c021841c927483e9d402aaab5c  update-u-boot"
sha512sums="d24c7d1305d81326a0f18071c073cd80c5ac43fcc8d8495509c56a8207620acc3d3e86afa873f738953841b3f6273e345493aad449f2464673275cc221270527  u-boot-2017.01.tar.bz2
f8c9bb6e84d6f0620c976ac7ad5dd7ec7ff9dfdd4b1d03d2bf6653e7beccf80bdf2debfc92fb1f696dba92fb40287d3c45897e0078951451d0835cb61a5f16d1  README.txt
d57796ce018afa15e12521a90761ab1ae6411acf1fc0c1ce95f0d48630e0949568d8a7e577ba52d91c56918a9d414951c608aa49389ac7f8b50cb8aba5da9697  update-u-boot"