Project

General

Profile

Openwrt-package-builder » builder.sh

Linus Lüssing, 03/24/2010 03:00 PM

 
1
#!/bin/sh
2

    
3
CODENAME="kamikaze"
4
VERSIONS="8.09.2"
5

    
6
PACKAGES="kmod-batman-advanced"
7
TARGETS="ppc40x ppc44x atheros ar71xx avr32 brcm47xx ifxmips adm5120 ixp4xx magicbox rb532 rdc au1000 ar7 uml x86"
8

    
9
CONFIG=".config"
10
ERRORLOG="error.log"
11
THREADS="1"
12

    
13
for version in $VERSIONS; do
14
	# Checkout svn tag $version
15
	svn co svn://svn.openwrt.org/openwrt/tags/$version openwrt-$version
16
	cd openwrt-$version
17

    
18
	# Update feeds to latest versions
19
	cp feeds.conf.default feeds.conf
20
	sid -i "s/svn-src packages .*/svn-src svn://svn.openwrt.org/openwrt/packages" feeds.conf
21
	scripts/feeds update
22

    
23
	# Add $PACKAGES from feeds if necessary
24
	for package in $PACKAGES; do
25
		[ -d package/$package ] && continue
26
		scripts/feeds install $package || {
27
			echo Feed $package not found! >> $ERRORLOG
28
		}
29
	done
30

    
31
	for target in $TARGETS; do
32
		## Creating .config ##
33
		# Create default config for $target
34
		echo CONFIG_TARGET_$target=y > $CONFIG
35
		make defconfig
36
	
37
		# Remove all target images
38
		#sed -i "s/CONFIG_TARGET_ROOTFS_\(.*\)=y$/# CONFIG_TARGET_ROOTFS_\1 is not set/" $CONFIG
39
		# and packages
40
		sed -i "s/CONFIG_PACKAGE_\(.*\)=y$/# CONFIG_PACKAGE_\1 is not set/" $CONFIG
41

    
42

    
43
		# Now explicitly select all $PACKAGES
44
		for package in $PACKAGES; do
45
			sed -i "s/^# CONFIG_PACKAGE_$package is not set$/CONFIG_PACKAGE_$package=y/" $CONFIG
46
		done
47

    
48
		# And add default options for those packages
49
		make defconfig
50

    
51

    
52
		## Making packages ##
53
		# output directories
54
		mkdir -p ../$CODENAME/$version/$target/packages
55

    
56
		# build process
57
		make -j $THREADS || {
58
			echo Error compiling $target! >> ../$ERRORLOG
59
			continue
60
		}
61

    
62
		# saving packages
63
		mv bin/packages/*/* ../$CODENAME/$version/$target/packages/
64
	done
65

    
66
	cd ..
67
done
    (1-1/1)