aboutsummaryrefslogtreecommitdiffstats
path: root/main/u-boot/APKBUILD
blob: 9cd3ad31466826baefbab4713a95ef8faa9fdae0 (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
# Contributor: William Pitcock <nenolod@dereferenced.org>
# Contributor: Timo Teras <timo.teras@iki.fi>
# Maintainer: Leonardo Arena <rnalrd@alpinelinux.org>
pkgname=u-boot
pkgver=2015.01
pkgrel=1
pkgdesc="Bootloader for ARM"
url="http://www.denx.de/wiki/U-Boot/"
arch="armhf"
license="GPL2"
depends=""
depends_dev=""
makedepends="$depends_dev"
install=""
subpackages=""
source="ftp://ftp.denx.de/pub/u-boot/u-boot-$pkgver.tar.bz2
	include-sys-types.patch
	config-wandboard.patch
	alpine-bootscript.h
	"

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

board_configs="
	wandboard:wandboard_solo,wandboard_dl,wandboard_quad
	beagleboard:am335x_boneblack"

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

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

	cp "$srcdir"/alpine-bootscript.h "$_srcdir"/include/configs/alpine-bootscript.h
}

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/doc/$pkgname
	echo "Dummy package" > "$pkgdir"/usr/share/doc/$pkgname/README
}

_split_boards() {
	cd "$_builddir"
	pkgdesc="u-boot for $1"
	shift
	local board
	for board; do
		msg "Including board $board"
		mkdir -p "$subpkgdir"/usr/share/$pkgname/$board
		export BUILD_DIR="$_builddir"/$board
		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
			fi
		done
	done
}

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

md5sums="7f08dc9e98a71652bd6968888ed6ec95  u-boot-2015.01.tar.bz2
946644b87937315253151db8b1ba98ec  include-sys-types.patch
a81d24110cf527f0eaab0de5ef15b7a1  config-wandboard.patch
581d2a5a617e0dce93a295fb4f6d4cf6  alpine-bootscript.h"
sha256sums="383051a656ebe11757b17d38a3326387e4a1b0949ca8a9e8ee506bf71dac9fde  u-boot-2015.01.tar.bz2
675676d857758d2eafab39592ad0f937be4021deb5cc47e44bea174a744871b3  include-sys-types.patch
aa5a047ea3dddf434ffaca13f284f78facf190d582e26513ea02835e3184726b  config-wandboard.patch
1c185db1fe3de4e5c224c831141863745a8970a39fc9801f45ec92b2e6950b69  alpine-bootscript.h"
sha512sums="6697c6da5f463bdfa75b8025a2dd302e9cda58ce36bc3252590f11976807aeccc1ca76be93cbc83d3367a7557878516bb57130ffb76197ffd513640c48e18938  u-boot-2015.01.tar.bz2
3e3a3a1d0f0fb9a41fe0e1427f91d05ec3c70103d5a185ed1d287ea23032ddcd01c0786ddca1d45d05e34df1b4a54a961bd123115798148205a22f6083142a57  include-sys-types.patch
8236cf2bc838d8f5231c825f660486c5be770e76db60127f5b7bc902d77fefbb5026fb5d63269748057a5f034bb738401a31d54a2f12bcbded5c0cb6099619f0  config-wandboard.patch
4ce96a48010b061fa77a15992824e7ac161672cab4d933ba91a995dd784bf1c263b6e907a967b02f54dba263677900d62c5eb9e31784672229f9cdac4cde696a  alpine-bootscript.h"