aboutsummaryrefslogtreecommitdiffstats
path: root/main/u-boot/APKBUILD
blob: f7387ed8d01b4fe84b7199d1c99eeac8ceb5720f (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
115
116
117
118
119
# Contributor: William Pitcock <nenolod@dereferenced.org>
# Contributor: Timo Teras <timo.teras@iki.fi>
# Maintainer: Leonardo Arena <rnalrd@alpinelinux.org>
pkgname=u-boot
pkgver=2015.04
pkgrel=1
pkgdesc="Bootloader for ARM"
url="http://www.denx.de/wiki/U-Boot/"
arch="armhf"
license="GPL2"
depends=""
depends_dev=""
makedepends="$depends_dev bc"
install=""
subpackages=""
source="ftp://ftp.denx.de/pub/u-boot/u-boot-${pkgver//_/-}.tar.bz2
	distroconfig-beaglebone.patch
	distroconfig-wandboard.patch
	include-sys-types.patch
	README.txt
	"

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

board_configs="
	beagleboard:am335x_boneblack
	cubieboard:Cubieboard,Cubieboard2
	raspberrypi:rpi,rpi_2
	wandboard:wandboard_solo,wandboard_dl,wandboard_quad
	"

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

prepare() {
	local i
	cd "$_srcdir"
	for i in $source; do
		case $i in
		*.patch) msg $i; patch -p1 -i "$srcdir"/$i || return 1;;
		esac
	done
}

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 distclean
			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
	install "$srcdir"/README.txt "$pkgdir"/usr/share/$pkgname/README.txt
}

_split_boards() {
	cd "$_builddir"
	pkgdesc="u-boot for $1"
	depends=""
	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 MLO u-boot.imx u-boot.img; do
			if [ -e "$BUILD_DIR"/$image ]; then
				cp "$BUILD_DIR"/$image "$subpkgdir"/usr/share/$pkgname/$board \
					|| return 1
				ok=yes
			fi
		done
		if [ "$ok" = "no" ]; then
			cp "$BUILD_DIR"/u-boot.bin "$subpkgdir"/usr/share/$pkgname/$board \
				|| return 1
		fi
	done
}

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

md5sums="570bdc2c47270c2a98ca60ff6c5c74cd  u-boot-2015.04.tar.bz2
a5b2aab8f3613e6f4154714b16ea9ad3  distroconfig-beaglebone.patch
880f99276de9722b8d85d03a06784d5b  distroconfig-wandboard.patch
2c144ed08a9aab244c0d8ea45e578ce5  include-sys-types.patch
8880da2612846147eafb65b271934af9  README.txt"
sha256sums="0a1a70df586655f527befa6f12e184e96ed61b126e5a567382321b17200f5d60  u-boot-2015.04.tar.bz2
4a49c939184c25f216b35e800669874a46354f805218a91b1db2bb27aa979310  distroconfig-beaglebone.patch
fc4b571e840e171f6fb6f4923697cd0768eca3b52aac912b87dfe22f61b0c753  distroconfig-wandboard.patch
ac7fc4678aa6018ae8730536ab55ed1e1d2bc93f699a25f8bd4504132cb27302  include-sys-types.patch
5d6e33e775e63acccde42d784348cd760b75052749cbc2ee1196b6e4ef64f78c  README.txt"
sha512sums="e50a3d7e44bf588a7cf8e28cdf3342bc38bd1bf55231d579c2501b75386cfff0fbc7a34648d893971e0095510c9d582b7180427832cb78470b4e7af2ce0e3646  u-boot-2015.04.tar.bz2
e840c2928afdab14442fe276a934d5d3ee615fdf32370819a1c988bf2dba99f27ccf479943f664aadaa14fbf48841e4d7d22973bb911db2d77f13aa2b4c40f88  distroconfig-beaglebone.patch
ce22043cfe65ba3a09f965dbf69985345fa0d56ef093703a595fde2dc3cb1ddcf1012e2fdcd56eed216de2bd8b3ec3a8de08266d70ad373cf33faa79d94ad93f  distroconfig-wandboard.patch
bb237aceacc0470c12778559fb3c7b1b8e9481f5113743ca76937d1d0052f1639c2da1d0b34069f73311aac44f9dcf628241d9322912ea7e8bd2c440a1d121bb  include-sys-types.patch
578c48223d4f355a7e59afd4a1bbc266c06bd422fd264035c1cdedfa812098b61880d6d9d24503e4cb6a9d799a3929d9619dcadeb1f88f1f686ec94ef5b9fe44  README.txt"