se505-buildsystem/Makefile

681 lines
22 KiB
Makefile
Raw Permalink Normal View History

2007-06-15 15:12:22 +02:00
CROSS_COMPILE := mipsel-linux-uclibc-
CROSS_TOOLS := CC=$(CROSS_COMPILE)gcc \
AR=$(CROSS_COMPILE)ar \
AS=$(CROSS_COMPILE)as \
LD=$(CROSS_COMPILE)ld \
LDD=$(CROSS_COMPILE)ldd \
NM=$(CROSS_COMPILE)nm \
RANLIB=$(CROSS_COMPILE)ranlib \
STRIP=$(CROSS_COMPILE)strip \
SIZE=$(CROSS_COMPILE)size
CROSS_CONFIGURE := ./configure --target=mipsel-linux-uclibc --build=i386-pc-linux-gnu --host=mipsel-linux-uclibc $(CROSS_TOOLS)
CROSS_STRIP := $(CROSS_COMPILE)strip
WGET := /usr/bin/wget --passive-ftp -nd
2007-06-15 15:11:23 +02:00
_SRCBASE=$(shell /bin/pwd)
_CONFIGS=$(_SRCBASE)/configs
_DOWNLOAD_DIR=$(_SRCBASE)/download
2007-06-15 15:12:22 +02:00
_PATCHES=$(_SRCBASE)/patches
2007-06-15 15:11:23 +02:00
_SOURCE=$(_SRCBASE)/source
_TOOLS=$(_SRCBASE)/tools
2007-06-15 15:12:22 +02:00
_TOOLCHAIN=$(_SRCBASE)/toolchain
2007-06-15 15:11:23 +02:00
_STAGE1_SKEL=stage1.skel
_STAGE1=$(shell /bin/pwd)/stage1
_STAGE1_IMG=stage1.img
_STAGE2_SKEL=stage2.skel
_STAGE2=$(shell /bin/pwd)/stage2
2007-06-15 15:12:22 +02:00
export PATH := $(_TOOLCHAIN)/bin:$(PATH)
2007-06-15 15:11:23 +02:00
# #####################################################################
# build firmware and filesystem
all: stage1 stage2
# stage1 (firmware)
_STAGE1_TARGETS=kernel-zImage busybox-stage1 cramfs tools
# stage2 (filesystem)
_STAGE2_TARGETS=kernel-modules busybox-stage2 strace bridge-utils iproute2 pppd
# fetch all needed sources
2007-06-15 15:12:22 +02:00
fetch: toolchain-fetch stage1-fetch stage2-fetch
2007-06-15 15:11:23 +02:00
# trigger rebuild of all packages
clean: stage1-clean stage2-clean
# remove all builddirs
distclean: stage1-distclean stage2-distclean
# #####################################################################
2007-06-15 15:12:22 +02:00
# TARGET HOST KERNEL
2007-06-15 15:11:23 +02:00
# #####################################################################
_PACKAGE_KERNEL=$(_DOWNLOAD_DIR)/linux-2.4.20.tar.bz2
_DOWNLOAD_KERNEL=ftp://ftp.kernel.org/pub/linux/kernel/v2.4/linux-2.4.20.tar.bz2
_BUILD_KERNEL=$(_SOURCE)/linux-2.4.20
_KERNELHEADERS=$(_BUILD_KERNEL)/include
2007-06-15 15:12:22 +02:00
kernel: $(_BUILD_KERNEL)/.zImage.all-done $(_BUILD_KERNEL)/.modules.all-done
2007-06-15 15:11:23 +02:00
2007-06-15 15:12:22 +02:00
kernel-zImage: kernel-zImage-clean $(_BUILD_KERNEL)/.zImage.all-done
kernel-modules: kernel-modules-clean $(_BUILD_KERNEL)/.modules.all-done
2007-06-15 15:11:23 +02:00
2007-06-15 15:12:22 +02:00
kernel-fetch: $(_PACKAGE_KERNEL)
2007-06-15 15:11:23 +02:00
kernel-zImage-fetch: $(_PACKAGE_KERNEL)
kernel-modules-fetch: $(_PACKAGE_KERNEL)
$(_PACKAGE_KERNEL):
$(WGET) -P $(_DOWNLOAD_DIR) $(_DOWNLOAD_KERNEL)
2007-06-15 15:12:22 +02:00
$(_BUILD_KERNEL)/.unpacked: $(_PACKAGE_KERNEL)
2007-06-15 15:11:23 +02:00
tar -C $(_SOURCE) -xjf $(_PACKAGE_KERNEL)
2007-06-15 15:12:22 +02:00
touch $(_BUILD_KERNEL)/.unpacked
$(_BUILD_KERNEL)/.patched: $(_BUILD_KERNEL)/.unpacked
(cd $(_BUILD_KERNEL); bzcat $(_PATCHES)/???_kernel*.patch.bz2 | patch -lp1 );
2007-06-15 15:11:23 +02:00
(cd $(_BUILD_KERNEL); tar -xjf $(_CONFIGS)/wl-rel_3_01_05.tar.bz2 );
2007-06-15 15:12:22 +02:00
touch $(_BUILD_KERNEL)/.patched
2007-06-15 15:11:23 +02:00
2007-06-15 15:12:22 +02:00
$(_BUILD_KERNEL)/.configured: $(_BUILD_KERNEL)/.patched
2007-06-15 15:11:23 +02:00
cp $(_CONFIGS)/kernel-config $(_BUILD_KERNEL)/.config
2007-06-15 15:12:22 +02:00
make -C $(_BUILD_KERNEL) oldconfig include/linux/version.h
touch $(_BUILD_KERNEL)/.configured
2007-06-15 15:11:23 +02:00
2007-06-15 15:12:22 +02:00
$(_BUILD_KERNEL)/.dep: $(_BUILD_KERNEL)/.configured
2007-06-15 15:11:23 +02:00
make -C $(_BUILD_KERNEL) dep
2007-06-15 15:12:22 +02:00
touch $(_BUILD_KERNEL)/.dep
2007-06-15 15:11:23 +02:00
2007-06-15 15:12:22 +02:00
$(_BUILD_KERNEL)/.zImage.all-done: $(_BUILD_KERNEL)/.dep
2007-06-15 15:11:23 +02:00
make -C $(_BUILD_KERNEL) zImage
2007-06-15 15:12:22 +02:00
touch $(_BUILD_KERNEL)/.zImage.all-done
2007-06-15 15:11:23 +02:00
2007-06-15 15:12:22 +02:00
$(_BUILD_KERNEL)/.modules.all-done: $(_BUILD_KERNEL)/.zImage.all-done
2007-06-15 15:11:23 +02:00
make -C $(_BUILD_KERNEL) modules
2007-06-15 15:12:22 +02:00
touch $(_BUILD_KERNEL)/.modules.all-done
2007-06-15 15:11:23 +02:00
2007-06-15 15:12:22 +02:00
kernel-zImage-install: $(_STAGE1) $(_BUILD_KERNEL)/.zImage.all-done
2007-06-15 15:11:23 +02:00
2007-06-15 15:12:22 +02:00
kernel-modules-install: $(_STAGE2) $(_BUILD_KERNEL)/.modules.all-done
2007-06-15 15:11:23 +02:00
make -C $(_BUILD_KERNEL) modules_install DEPMOD=/bin/true INSTALL_MOD_PATH=$(_STAGE2)
rm -rf $(_STAGE2)/lib/modules/2.4.20/build
rm -rf $(_STAGE2)/lib/modules/2.4.20/pcmcia
kernel-clean: kernel-zImage-clean kernel-modules-clean
kernel-distclean:
2007-06-15 15:12:22 +02:00
rm -rf $(_BUILD_KERNEL)
2007-06-15 15:11:23 +02:00
kernel-zImage-clean:
2007-06-15 15:12:22 +02:00
rm -f $(_BUILD_KERNEL)/.zImage.all-done
2007-06-15 15:11:23 +02:00
kernel-zImage-distclean: kernel-distclean
kernel-modules-clean:
2007-06-15 15:12:22 +02:00
rm -f $(_BUILD_KERNEL)/.modules.all-done
2007-06-15 15:11:23 +02:00
kernel-modules-distclean: kernel-distclean
# #####################################################################
2007-06-15 15:12:22 +02:00
# TARGET HOST
2007-06-15 15:11:23 +02:00
# #####################################################################
_PACKAGE_BUSYBOX=$(_DOWNLOAD_DIR)/busybox-1.00.tar.bz2
_DOWNLOAD_BUSYBOX=http://www.busybox.net/downloads/busybox-1.00.tar.bz2
_BUILD_BUSYBOX=$(_SOURCE)/busybox-1.00
_BUILD_BUSYBOX_STAGE1=$(_SOURCE)/busybox-stage1
2007-06-15 15:12:22 +02:00
busybox-stage1: busybox-stage1-clean $(_BUILD_BUSYBOX_STAGE1)/.all_done
2007-06-15 15:11:23 +02:00
busybox-stage1-fetch: $(_PACKAGE_BUSYBOX)
$(_PACKAGE_BUSYBOX):
$(WGET) -P $(_DOWNLOAD_DIR) $(_DOWNLOAD_BUSYBOX)
2007-06-15 15:12:22 +02:00
$(_BUILD_BUSYBOX_STAGE1)/.unpacked: $(_PACKAGE_BUSYBOX)
2007-06-15 15:11:23 +02:00
tar -C $(_SOURCE) -xjf $(_PACKAGE_BUSYBOX)
rm -rf $(_BUILD_BUSYBOX_STAGE1)
mv $(_BUILD_BUSYBOX) $(_BUILD_BUSYBOX_STAGE1)
2007-06-15 15:12:22 +02:00
touch $(_BUILD_BUSYBOX_STAGE1)/.unpacked
2007-06-15 15:11:23 +02:00
2007-06-15 15:12:22 +02:00
$(_BUILD_BUSYBOX_STAGE1)/.configured: $(_BUILD_BUSYBOX_STAGE1)/.unpacked
2007-06-15 15:11:23 +02:00
cp $(_CONFIGS)/busybox-stage1.conf $(_BUILD_BUSYBOX_STAGE1)/.config
2007-06-15 15:12:22 +02:00
touch $(_BUILD_BUSYBOX_STAGE1)/.configured
2007-06-15 15:11:23 +02:00
2007-06-15 15:12:22 +02:00
$(_BUILD_BUSYBOX_STAGE1)/.compiled: $(_BUILD_BUSYBOX_STAGE1)/.configured
make -C $(_BUILD_BUSYBOX_STAGE1) $(CROSS_TOOLS) all
touch $(_BUILD_BUSYBOX_STAGE1)/.compiled
2007-06-15 15:11:23 +02:00
2007-06-15 15:12:22 +02:00
$(_BUILD_BUSYBOX_STAGE1)/.all_done: $(_BUILD_BUSYBOX_STAGE1)/.compiled
make -C $(_BUILD_BUSYBOX_STAGE1) $(CROSS_TOOLS) install
2007-06-15 15:11:23 +02:00
chmod 4775 $(_BUILD_BUSYBOX_STAGE1)/_install/bin/busybox
2007-06-15 15:12:22 +02:00
touch $(_BUILD_BUSYBOX_STAGE1)/.all_done
2007-06-15 15:11:23 +02:00
2007-06-15 15:12:22 +02:00
busybox-stage1-install: $(_STAGE1) $(_BUILD_BUSYBOX_STAGE1)/.all_done
2007-06-15 15:11:23 +02:00
cp -r $(_BUILD_BUSYBOX_STAGE1)/_install/* $(_STAGE1)
busybox-stage1-clean:
2007-06-15 15:12:22 +02:00
rm -f $(_BUILD_BUSYBOX_STAGE1)/.configured $(_BUILD_BUSYBOX_STAGE1)/.compiled \
$(_BUILD_BUSYBOX_STAGE1)/.all_done
2007-06-15 15:11:23 +02:00
2007-06-15 15:12:22 +02:00
busybox-stage1-distclean:
2007-06-15 15:11:23 +02:00
rm -rf $(_BUILD_BUSYBOX_STAGE1)
# #####################################################################
_BUILD_BUSYBOX_STAGE2=$(_SOURCE)/busybox-stage2
2007-06-15 15:12:22 +02:00
busybox-stage2: busybox-stage2-clean $(_BUILD_BUSYBOX_STAGE2)/.all_done
2007-06-15 15:11:23 +02:00
busybox-stage2-fetch: $(_PACKAGE_BUSYBOX)
2007-06-15 15:12:22 +02:00
$(_BUILD_BUSYBOX_STAGE2)/.unpacked: $(_PACKAGE_BUSYBOX)
2007-06-15 15:11:23 +02:00
tar -C $(_SOURCE) -xjf $(_PACKAGE_BUSYBOX)
rm -rf $(_BUILD_BUSYBOX_STAGE2)
mv $(_BUILD_BUSYBOX) $(_BUILD_BUSYBOX_STAGE2)
2007-06-15 15:12:22 +02:00
touch $(_BUILD_BUSYBOX_STAGE2)/.unpacked
2007-06-15 15:11:23 +02:00
2007-06-15 15:12:22 +02:00
$(_BUILD_BUSYBOX_STAGE2)/.configured: $(_BUILD_BUSYBOX_STAGE2)/.unpacked
2007-06-15 15:11:23 +02:00
cp $(_CONFIGS)/busybox-stage2.conf $(_BUILD_BUSYBOX_STAGE2)/.config
2007-06-15 15:12:22 +02:00
touch $(_BUILD_BUSYBOX_STAGE2)/.configured
2007-06-15 15:11:23 +02:00
2007-06-15 15:12:22 +02:00
$(_BUILD_BUSYBOX_STAGE2)/.compiled: $(_BUILD_BUSYBOX_STAGE2)/.configured
make -C $(_BUILD_BUSYBOX_STAGE2) $(CROSS_TOOLS) all
touch $(_BUILD_BUSYBOX_STAGE2)/.compiled
2007-06-15 15:11:23 +02:00
2007-06-15 15:12:22 +02:00
$(_BUILD_BUSYBOX_STAGE2)/.all_done: $(_BUILD_BUSYBOX_STAGE2)/.compiled
make -C $(_BUILD_BUSYBOX_STAGE2) $(CROSS_TOOLS) install
2007-06-15 15:11:23 +02:00
chmod 4775 $(_BUILD_BUSYBOX_STAGE2)/_install/bin/busybox
2007-06-15 15:12:22 +02:00
touch $(_BUILD_BUSYBOX_STAGE2)/.all_done
2007-06-15 15:11:23 +02:00
2007-06-15 15:12:22 +02:00
busybox-stage2-install: $(_STAGE2) $(_BUILD_BUSYBOX_STAGE2)/.all_done
2007-06-15 15:11:23 +02:00
cp -r $(_BUILD_BUSYBOX_STAGE2)/_install/* $(_STAGE2)
busybox-stage2-clean:
2007-06-15 15:12:22 +02:00
rm -f $(_BUILD_BUSYBOX_STAGE2)/.configured $(_BUILD_BUSYBOX_STAGE2)/.compiled \
$(_BUILD_BUSYBOX_STAGE2)/.all_done
2007-06-15 15:11:23 +02:00
2007-06-15 15:12:22 +02:00
busybox-stage2-distclean:
2007-06-15 15:11:23 +02:00
rm -rf $(_BUILD_BUSYBOX_STAGE2)
# #####################################################################
_PACKAGE_STRACE=$(_DOWNLOAD_DIR)/strace-4.5.7.tar.bz2
_DOWNLOAD_STRACE=http://mesh.dl.sourceforge.net/sourceforge/strace/strace-4.5.7.tar.bz2
_BUILD_STRACE=$(_SOURCE)/strace-4.5.7
2007-06-15 15:12:22 +02:00
strace: strace-clean $(_BUILD_STRACE)/.all_done
2007-06-15 15:11:23 +02:00
strace-fetch: $(_PACKAGE_STRACE)
$(_PACKAGE_STRACE):
$(WGET) -P $(_DOWNLOAD_DIR) $(_DOWNLOAD_STRACE)
2007-06-15 15:12:22 +02:00
$(_BUILD_STRACE)/.unpacked: $(_PACKAGE_STRACE)
2007-06-15 15:11:23 +02:00
tar -C $(_SOURCE) -xjf $(_PACKAGE_STRACE)
2007-06-15 15:12:22 +02:00
touch $(_BUILD_STRACE)/.unpacked
2007-06-15 15:11:23 +02:00
2007-06-15 15:12:22 +02:00
$(_BUILD_STRACE)/.configured: $(_BUILD_STRACE)/.unpacked
(cd $(_BUILD_STRACE); $(CROSS_CONFIGURE) --prefix=/usr );
touch $(_BUILD_STRACE)/.configured
2007-06-15 15:11:23 +02:00
2007-06-15 15:12:22 +02:00
$(_BUILD_STRACE)/.compiled: $(_BUILD_STRACE)/.configured
make -C $(_BUILD_STRACE) $(CROSS_TOOLS) all
touch $(_BUILD_STRACE)/.compiled
2007-06-15 15:11:23 +02:00
2007-06-15 15:12:22 +02:00
$(_BUILD_STRACE)/.all_done: $(_BUILD_STRACE)/.compiled
$(CROSS_STRIP) --strip-all $(_BUILD_STRACE)/strace
touch $(_BUILD_STRACE)/.all_done
2007-06-15 15:11:23 +02:00
2007-06-15 15:12:22 +02:00
strace-install: $(_STAGE2) $(_BUILD_STRACE)/.all_done
2007-06-15 15:11:23 +02:00
cp $(_BUILD_STRACE)/strace $(_STAGE2)/usr/bin
strace-clean:
2007-06-15 15:12:22 +02:00
rm -f $(_BUILD_STRACE)/.configured $(_BUILD_STRACE)/.compiled \
$(_BUILD_STRACE)/.all_done
2007-06-15 15:11:23 +02:00
2007-06-15 15:12:22 +02:00
strace-distclean:
2007-06-15 15:11:23 +02:00
rm -rf $(_BUILD_STRACE)
# #####################################################################
_PACKAGE_BRIDGE_UTILS=$(_DOWNLOAD_DIR)/bridge-utils-1.0.4.tar.gz
_DOWNLOAD_BRIDGE_UTILS=http://mesh.dl.sourceforge.net/sourceforge/bridge/bridge-utils-1.0.4.tar.gz
_BUILD_BRIDGE_UTILS=$(_SOURCE)/bridge-utils-1.0.4
2007-06-15 15:12:22 +02:00
bridge-utils: bridge-utils-clean $(_BUILD_BRIDGE_UTILS)/.all_done
2007-06-15 15:11:23 +02:00
bridge-utils-fetch: $(_PACKAGE_BRIDGE_UTILS)
$(_PACKAGE_BRIDGE_UTILS):
$(WGET) -P $(_DOWNLOAD_DIR) $(_DOWNLOAD_BRIDGE_UTILS)
2007-06-15 15:12:22 +02:00
$(_BUILD_BRIDGE_UTILS)/.unpacked: $(_PACKAGE_BRIDGE_UTILS)
2007-06-15 15:11:23 +02:00
tar -C $(_SOURCE) -xzf $(_PACKAGE_BRIDGE_UTILS)
2007-06-15 15:12:22 +02:00
touch $(_BUILD_BRIDGE_UTILS)/.unpacked
2007-06-15 15:11:23 +02:00
2007-06-15 15:12:22 +02:00
$(_BUILD_BRIDGE_UTILS)/.configured: $(_BUILD_BRIDGE_UTILS)/.unpacked
(cd $(_BUILD_BRIDGE_UTILS); $(CROSS_CONFIGURE) --prefix=/usr --with-linux-headers=$(_KERNELHEADERS));
touch $(_BUILD_BRIDGE_UTILS)/.configured
2007-06-15 15:11:23 +02:00
2007-06-15 15:12:22 +02:00
$(_BUILD_BRIDGE_UTILS)/.compiled: $(_BUILD_BRIDGE_UTILS)/.configured
make -C $(_BUILD_BRIDGE_UTILS) $(CROSS_TOOLS) all
touch $(_BUILD_BRIDGE_UTILS)/.compiled
2007-06-15 15:11:23 +02:00
2007-06-15 15:12:22 +02:00
$(_BUILD_BRIDGE_UTILS)/.all_done: $(_BUILD_BRIDGE_UTILS)/.compiled
$(CROSS_STRIP) --strip-all $(_BUILD_BRIDGE_UTILS)/brctl/brctl
touch $(_BUILD_BRIDGE_UTILS)/.all_done
2007-06-15 15:11:23 +02:00
2007-06-15 15:12:22 +02:00
bridge-utils-install: $(_STAGE2) $(_BUILD_BRIDGE_UTILS)/.all_done
2007-06-15 15:11:23 +02:00
cp $(_BUILD_BRIDGE_UTILS)/brctl/brctl $(_STAGE2)/usr/sbin
bridge-utils-clean:
2007-06-15 15:12:22 +02:00
rm -f $(_BUILD_BRIDGE_UTILS)/.configured $(_BUILD_BRIDGE_UTILS)/.compiled \
$(_BUILD_BRIDGE_UTILS)/.all_done
2007-06-15 15:11:23 +02:00
2007-06-15 15:12:22 +02:00
bridge-utils-distclean:
2007-06-15 15:11:23 +02:00
rm -rf $(_BUILD_BRIDGE_UTILS)
# #####################################################################
_PACKAGE_IPROUTE2=$(_DOWNLOAD_DIR)/iproute2-2.6.10-050209.tar.gz
_DOWNLOAD_IPROUTE2=http://developer.osdl.org/dev/iproute2/download/iproute2-2.6.10-050209.tar.gz
_BUILD_IPROUTE2=$(_SOURCE)/iproute2-2.6.9-050209
2007-06-15 15:12:22 +02:00
iproute2: iproute2-clean $(_BUILD_IPROUTE2)/.all_done
2007-06-15 15:11:23 +02:00
iproute2-fetch: $(_PACKAGE_IPROUTE2)
$(_PACKAGE_IPROUTE2):
$(WGET) -P $(_DOWNLOAD_DIR) $(_DOWNLOAD_IPROUTE2)
2007-06-15 15:12:22 +02:00
$(_BUILD_IPROUTE2)/.unpacked: $(_PACKAGE_IPROUTE2)
2007-06-15 15:11:23 +02:00
tar -C $(_SOURCE) -xzf $(_PACKAGE_IPROUTE2)
2007-06-15 15:12:22 +02:00
touch $(_BUILD_IPROUTE2)/.unpacked
2007-06-15 15:11:23 +02:00
2007-06-15 15:12:22 +02:00
$(_BUILD_IPROUTE2)/.configured: $(_BUILD_IPROUTE2)/.unpacked
(cd $(_BUILD_IPROUTE2); $(CROSS_CONFIGURE) --prefix=/usr);
touch $(_BUILD_IPROUTE2)/.configured
2007-06-15 15:11:23 +02:00
2007-06-15 15:12:22 +02:00
$(_BUILD_IPROUTE2)/.compiled: $(_BUILD_IPROUTE2)/.configured
make -C $(_BUILD_IPROUTE2) $(CROSS_TOOLS) all
touch $(_BUILD_IPROUTE2)/.compiled
2007-06-15 15:11:23 +02:00
2007-06-15 15:12:22 +02:00
$(_BUILD_IPROUTE2)/.all_done: $(_BUILD_IPROUTE2)/.compiled
$(CROSS_STRIP) --strip-all $(_BUILD_IPROUTE2)/ip/ip
$(CROSS_STRIP) --strip-all $(_BUILD_IPROUTE2)/tc/tc
touch $(_BUILD_IPROUTE2)/.all_done
2007-06-15 15:11:23 +02:00
2007-06-15 15:12:22 +02:00
iproute2-install: $(_STAGE2) $(_BUILD_IPROUTE2)/.all_done
2007-06-15 15:11:23 +02:00
cp $(_BUILD_IPROUTE2)/ip/ip $(_STAGE2)/sbin
cp $(_BUILD_IPROUTE2)/tc/tc $(_STAGE2)/sbin
iproute2-clean:
2007-06-15 15:12:22 +02:00
rm -f $(_BUILD_IPROUTE2)/.configured $(_BUILD_IPROUTE2)/.compiled \
$(_BUILD_IPROUTE2)/.all_done
2007-06-15 15:11:23 +02:00
2007-06-15 15:12:22 +02:00
iproute2-distclean:
2007-06-15 15:11:23 +02:00
rm -rf $(_BUILD_IPROUTE2)
# #####################################################################
_PACKAGE_PPPD=$(_DOWNLOAD_DIR)/ppp-2.4.2.tar.gz
_DOWNLOAD_PPPD=ftp://ftp.samba.org/pub/ppp/ppp-2.4.2.tar.gz
_BUILD_PPPD=$(_SOURCE)/ppp-2.4.2
2007-06-15 15:12:22 +02:00
pppd: pppd-clean $(_BUILD_PPPD)/.all_done
2007-06-15 15:11:23 +02:00
pppd-fetch: $(_PACKAGE_PPPD)
$(_PACKAGE_PPPD):
$(WGET) -P $(_DOWNLOAD_DIR) $(_DOWNLOAD_PPPD)
2007-06-15 15:12:22 +02:00
$(_BUILD_PPPD)/.unpacked: $(_PACKAGE_PPPD)
2007-06-15 15:11:23 +02:00
tar -C $(_SOURCE) -xzf $(_PACKAGE_PPPD)
2007-06-15 15:12:22 +02:00
touch $(_BUILD_PPPD)/.unpacked
$(_BUILD_PPPD)/.patched: $(_BUILD_PPPD)/.unpacked
(cd $(_BUILD_PPPD); cat $(_PATCHES)/???_ppp-*.patch | patch -p1 );
touch $(_BUILD_PPPD)/.patched
$(_BUILD_PPPD)/.configured: $(_BUILD_PPPD)/.patched
(cd $(_BUILD_PPPD); $(CROSS_CONFIGURE) --prefix=/usr);
touch $(_BUILD_PPPD)/.configured
$(_BUILD_PPPD)/.compiled: $(_BUILD_PPPD)/.configured
make -C $(_BUILD_PPPD) $(CROSS_TOOLS) all
touch $(_BUILD_PPPD)/.compiled
$(_BUILD_PPPD)/.all_done: $(_BUILD_PPPD)/.compiled
$(CROSS_STRIP) --strip-all $(_BUILD_PPPD)/chat/chat
$(CROSS_STRIP) --strip-all $(_BUILD_PPPD)/pppd/pppd
$(CROSS_STRIP) --strip-all $(_BUILD_PPPD)/pppd/plugins/rp-pppoe/rp-pppoe.so
$(CROSS_STRIP) --strip-all $(_BUILD_PPPD)/pppstats/pppstats
touch $(_BUILD_PPPD)/.all_done
pppd-install: $(_STAGE2) $(_BUILD_PPPD)/.all_done
2007-06-15 15:11:23 +02:00
cp $(_BUILD_PPPD)/chat/chat $(_STAGE2)/usr/bin
cp $(_BUILD_PPPD)/pppd/pppd $(_STAGE2)/usr/sbin
cp $(_BUILD_PPPD)/pppd/plugins/rp-pppoe/rp-pppoe.so $(_STAGE2)/etc/ppp/plugins/
cp $(_BUILD_PPPD)/pppstats/pppstats $(_STAGE2)/usr/bin
pppd-clean:
2007-06-15 15:12:22 +02:00
rm -f $(_BUILD_PPPD)/.configured $(_BUILD_PPPD)/.compiled $(_BUILD_PPPD)/.all_done
2007-06-15 15:11:23 +02:00
2007-06-15 15:12:22 +02:00
pppd-distclean:
2007-06-15 15:11:23 +02:00
rm -rf $(_BUILD_PPPD)
2007-06-15 15:12:22 +02:00
# #####################################################################
# BUILD HOST TOOLCHAIN
# #####################################################################
_PACKAGE_BINUTILS=$(_DOWNLOAD_DIR)/binutils-2.13.2.1.tar.bz2
_DOWNLOAD_BINUTILS=ftp://ftp.fu-berlin.de/unix/gnu/binutils/binutils-2.13.2.1.tar.bz2
_BUILD_BINUTILS_SRC=$(_SOURCE)/binutils-2.13.2.1
_BUILD_BINUTILS=$(_SOURCE)/binutils-2.13.2.1-host
binutils: binutils-clean $(_BUILD_BINUTILS)/.all-done
binutils-fetch: $(_PACKAGE_BINUTILS)
$(_PACKAGE_BINUTILS):
$(WGET) -P $(_DOWNLOAD_DIR) $(_DOWNLOAD_BINUTILS)
$(_BUILD_BINUTILS_SRC)/.unpacked: $(_PACKAGE_BINUTILS)
tar -C $(_SOURCE) -xjf $(_PACKAGE_BINUTILS)
touch $(_BUILD_BINUTILS_SRC)/.unpacked
$(_BUILD_BINUTILS_SRC)/.patched: $(_BUILD_BINUTILS_SRC)/.unpacked
(cd $(_BUILD_BINUTILS_SRC); cat $(_PATCHES)/???_binutils-*.patch | patch -p1 );
touch $(_BUILD_BINUTILS_SRC)/.patched
$(_BUILD_BINUTILS)/.configured: $(_BUILD_BINUTILS_SRC)/.patched
mkdir -p $(_BUILD_BINUTILS)
(cd $(_BUILD_BINUTILS); $(_BUILD_BINUTILS_SRC)/configure \
--build=i386-pc-linux-gnu \
--host=i386-pc-linux-gnu \
--target=mipsel-linux-uclibc \
--prefix=$(_TOOLCHAIN) \
--disable-nls \
--with-bcm4710a0 );
touch $(_BUILD_BINUTILS)/.configured
$(_BUILD_BINUTILS)/.all-done: $(_BUILD_BINUTILS)/.configured
make -C $(_BUILD_BINUTILS) all
touch $(_BUILD_BINUTILS)/.all-done
binutils-install: $(_BUILD_BINUTILS)/.all-done
mkdir -p $(_TOOLCHAIN)/lib $(_TOOLCHAIN)/mipsel-linux-uclibc
(cd $(_TOOLCHAIN)/mipsel-linux-uclibc; ln -s ../lib lib);
make -C $(_BUILD_BINUTILS) install
binutils-clean:
rm -f $(_BUILD_BINUTILS)/.configured $(_BUILD_BINUTILS)/.compiled $(_BUILD_BINUTILS)/.all-done
binutils-distclean:
rm -rf $(_BUILD_BINUTILS)
# #####################################################################
_PACKAGE_GCC=$(_DOWNLOAD_DIR)/gcc-3.2.3.tar.gz
_DOWNLOAD_GCC=ftp://ftp.fu-berlin.de/unix/gnu/gcc/gcc-3.2.3.tar.gz
_BUILD_GCC_SRC=$(_SOURCE)/gcc-3.2.3
_BUILD_GCC1=$(_BUILD_GCC_SRC)-initial
gcc-initial: $(_BUILD_GCC1)/.all-done
gcc-fetch: $(_PACKAGE_GCC)
gcc-initial-fetch: $(_PACKAGE_GCC)
$(_PACKAGE_GCC):
$(WGET) -P $(_DOWNLOAD_DIR) $(_DOWNLOAD_GCC)
$(_BUILD_GCC_SRC)/.unpacked: $(_PACKAGE_GCC)
tar -C $(_SOURCE) -xzf $(_PACKAGE_GCC)
touch $(_BUILD_GCC_SRC)/.unpacked
$(_BUILD_GCC_SRC)/.patched: $(_BUILD_GCC_SRC)/.unpacked
(cd $(_BUILD_GCC_SRC); cat $(_PATCHES)/???_gcc-*.patch | patch -p1 );
touch $(_BUILD_GCC_SRC)/.patched
$(_BUILD_GCC1)/.configured: $(_BUILD_GCC_SRC)/.patched
mkdir -p $(_BUILD_GCC1)
(cd $(_BUILD_GCC1); $(_BUILD_GCC_SRC)/configure \
--build=i386-pc-linux-gnu \
--host=i386-pc-linux-gnu \
--target=mipsel-linux-uclibc \
--prefix=$(_TOOLCHAIN) \
--enable-languages=c \
--disable-shared \
--disable-threads \
--disable-nls \
--with-gnu-ld \
--with-gnu-as \
--with-bcm4710a0 );
touch $(_BUILD_GCC1)/.configured
$(_BUILD_GCC1)/.all-done: $(_BUILD_GCC1)/.configured
make -C $(_BUILD_GCC1) all-gcc
touch $(_BUILD_GCC1)/.all-done
gcc-initial-install: $(_BUILD_GCC1)/.all-done
make -C $(_BUILD_GCC1) install-gcc
gcc-initial-clean:
rm -f $(_BUILD_GCC1)/.configured $(_BUILD_GCC1)/.compiled $(_BUILD_GCC1)/.all-done
gcc-initial-distclean:
rm -rf $(_BUILD_GCC1)
# #####################################################################
_PACKAGE_UCLIBC=$(_DOWNLOAD_DIR)/uClibc-0.9.27.tar.bz2
_DOWNLOAD_UCLIBC=http://www.uclibc.org/downloads/uClibc-0.9.27.tar.bz2
_BUILD_UCLIBC=$(_SOURCE)/uClibc-0.9.27
uclibc: $(_BUILD_UCLIBC)/.all-done
uclibc-fetch: $(_PACKAGE_UCLIBC)
$(_PACKAGE_UCLIBC):
$(WGET) -P $(_DOWNLOAD_DIR) $(_DOWNLOAD_UCLIBC)
$(_BUILD_UCLIBC)/.unpacked: $(_PACKAGE_UCLIBC)
tar -C $(_SOURCE) -xjf $(_PACKAGE_UCLIBC)
touch $(_BUILD_UCLIBC)/.unpacked
$(_BUILD_UCLIBC)/.configured: $(_BUILD_UCLIBC)/.unpacked
cp $(_CONFIGS)/uclibc.conf $(_BUILD_UCLIBC)/.config
sed -i -e 's:KERNEL_SOURCE=.*:KERNEL_SOURCE=\"$(_BUILD_KERNEL)\":g' $(_BUILD_UCLIBC)/.config
sed -i -e 's:RUNTIME_PREFIX=.*:RUNTIME_PREFIX=\"$(_TOOLCHAIN)\":g' $(_BUILD_UCLIBC)/.config
sed -i -e 's:DEVEL_PREFIX=.*:DEVEL_PREFIX=\"$(_TOOLCHAIN)\":g' $(_BUILD_UCLIBC)/.config
make -C $(_BUILD_UCLIBC) oldconfig
touch $(_BUILD_UCLIBC)/.configured
$(_BUILD_UCLIBC)/.all-done: $(_BUILD_UCLIBC)/.configured
make -C $(_BUILD_UCLIBC) CROSS=mipsel-linux-uclibc- DEVEL_PREFIX=$(_TOOLCHAIN) all
make -C $(_BUILD_UCLIBC)/utils RUNTIME_PREFIX=$(_TOOLCHAIN) hostutils
touch $(_BUILD_UCLIBC)/.all-done
uclibc-install: $(_BUILD_UCLIBC)/.all-done
make -C $(_BUILD_UCLIBC) install
cp $(_BUILD_UCLIBC)/utils/ldd.host $(_TOOLCHAIN)/bin/mipsel-linux-uclibc-ldd
uclibc-clean:
rm -f $(_BUILD_UCLIBC)/.configured $$(_BUILD_UCLIBC)/.compiled $(_BUILD_UCLIBC)/.all-done
uclibc-distclean:
rm -rf $(_BUILD_UCLIBC)
# #####################################################################
_BUILD_GCC2=$(_BUILD_GCC_SRC)-final
gcc-final: $(_BUILD_GCC2)/.all-done
$(_BUILD_GCC2)/.configured: $(_BUILD_GCC_SRC)/.patched
mkdir -p $(_BUILD_GCC2)
(cd $(_TOOLCHAIN)/mipsel-linux-uclibc; ln -s ../include sys-include);
(cd $(_BUILD_GCC2); $(_BUILD_GCC_SRC)/configure \
--build=i386-pc-linux-gnu \
--host=i386-pc-linux-gnu \
--target=mipsel-linux-uclibc \
--prefix=$(_TOOLCHAIN) \
--enable-languages=c,c++ \
--enable-shared \
--disable-nls \
--with-gnu-ld \
--with-gnu-as \
--with-bcm4710a0 );
touch $(_BUILD_GCC2)/.configured
$(_BUILD_GCC2)/.all-done: $(_BUILD_GCC2)/.configured
make -C $(_BUILD_GCC2) all
touch $(_BUILD_GCC2)/.all-done
gcc-final-install: $(_BUILD_GCC2)/.all-done
make -C $(_BUILD_GCC2) install
set -e; (cd $(_TOOLCHAIN); \
ln -sf mipsel-linux-uclibc mipsel-linux; \
cd bin; \
for app in mipsel-linux-uclibc-* ; do \
ln -sf $${app} mipsel-linux$${app##mipsel-linux-uclibc}; \
done; \
);
gcc-final-clean:
rm -f $(_BUILD_GCC2)/.configured $(_BUILD_GCC2)/.compiled $(_BUILD_GCC2)/.all-done
gcc-final-distclean:
rm -rf $(_BUILD_GCC2)
# #####################################################################
# BUILD HOST UTILS
# #####################################################################
_PACKAGE_CRAMFS=$(_DOWNLOAD_DIR)/cramfs-1.1.tar.gz
_DOWNLOAD_CRAMFS=http://mesh.dl.sourceforge.net/sourceforge/cramfs/cramfs-1.1.tar.gz
_BUILD_CRAMFS=$(_SOURCE)/cramfs-1.1
cramfs: cramfs-clean $(_BUILD_CRAMFS)/.all_done
cramfs-fetch: $(_PACKAGE_CRAMFS)
$(_PACKAGE_CRAMFS):
$(WGET) -P $(_DOWNLOAD_DIR) $(_DOWNLOAD_CRAMFS)
$(_BUILD_CRAMFS)/.unpacked: $(_PACKAGE_CRAMFS)
tar -C $(_SOURCE) -xzf $(_PACKAGE_CRAMFS)
touch $(_BUILD_CRAMFS)/.unpacked
$(_BUILD_CRAMFS)/.all_done: $(_BUILD_CRAMFS)/.unpacked
make -C $(_BUILD_CRAMFS) all
touch $(_BUILD_CRAMFS)/.all_done
cramfs-install: $(_BUILD_CRAMFS)/.all_done
cramfs-clean:
rm -f $(_BUILD_CRAMFS)/.all_done
cramfs-distclean:
rm -rf $(_BUILD_CRAMFS)
# #####################################################################
_BUILD_TOOLS=$(_TOOLS)
tools: tools-clean $(_BUILD_TOOLS)/.all-done
tools-fetch:
$(_BUILD_TOOLS)/.all-done:
make -C $(_BUILD_TOOLS) all
touch $(_BUILD_TOOLS)/.all-done
tools-install: $(_BUILD_TOOLS)/.all-done
tools-clean:
rm -f $(_BUILD_TOOLS)/.all-done
tools-distclean: tools-clean
make -C $(_BUILD_TOOLS) clean
# #####################################################################
# MAIN TARGETS
# #####################################################################
toolchain: $(_TOOLCHAIN)/.all-done
toolchain-fetch: binutils-fetch gcc-fetch uclibc-fetch kernel-fetch
# binutils (+ extracted patches from broadcom hnd-tools + uclibc buildroot patches)
$(_TOOLCHAIN)/.step1: binutils-install
touch $(_TOOLCHAIN)/.step1
# static gcc (+ extracted patches from broadcom hnd-tools + uclibc buildroot patches)
$(_TOOLCHAIN)/.step2: $(_TOOLCHAIN)/.step1 gcc-initial-install
touch $(_TOOLCHAIN)/.step2
# kernel header
$(_TOOLCHAIN)/.step3: $(_TOOLCHAIN)/.step2 $(_BUILD_KERNEL)/.configured
touch $(_TOOLCHAIN)/.step3
# uclibc
$(_TOOLCHAIN)/.step4: $(_TOOLCHAIN)/.step3 uclibc-install
touch $(_TOOLCHAIN)/.step4
# shared gcc (+ extracted patches from broadcom hnd-tools + uclibc buildroot patches)
$(_TOOLCHAIN)/.step5: $(_TOOLCHAIN)/.step4 gcc-final-install
touch $(_TOOLCHAIN)/.step5
# final
$(_TOOLCHAIN)/.all-done: $(_TOOLCHAIN)/.step5
touch $(_TOOLCHAIN)/.all-done
2007-06-15 15:11:23 +02:00
# #####################################################################
_STAGE1_REAL_TARGETS:=$(patsubst %,%-install,$(_STAGE1_TARGETS))
_STAGE1_FETCH_TARGETS:=$(patsubst %,%-fetch,$(_STAGE1_TARGETS))
_STAGE1_CLEAN_TARGETS:=$(patsubst %,%-clean,$(_STAGE1_TARGETS))
_STAGE1_DISTCLEAN_TARGETS:=$(patsubst %,%-distclean,$(_STAGE1_TARGETS))
$(_STAGE1):
mkdir -p $(_STAGE1)
cp -r $(_STAGE1_SKEL)/* $(_STAGE1)
$(_STAGE1_IMG):
mkdir -p $(_STAGE1_IMG)
stage1: $(_STAGE1) $(_STAGE1_IMG) $(_STAGE1_REAL_TARGETS)
$(_BUILD_CRAMFS)/mkcramfs $(_STAGE1) $(_STAGE1_IMG)/stage1.cramfs
2007-06-15 15:12:02 +02:00
$(_TOOLS)/trx $(_BUILD_KERNEL)/arch/mips/brcm-boards/bcm947xx/compressed/vmlinuz \
$(_STAGE1_IMG)/stage1.cramfs > \
$(_STAGE1_IMG)/firmware.trx
2007-06-15 15:11:23 +02:00
$(_TOOLS)/gen_image $(_STAGE1_IMG)/firmware.trx > $(_STAGE1_IMG)/firmware.img
stage1-fetch: $(_STAGE1_FETCH_TARGETS)
stage1-clean: $(_STAGE1_CLEAN_TARGETS)
rm -rf $(_STAGE1) $(_STAGE1_IMG)
stage1-distclean: $(_STAGE1_DISTCLEAN_TARGETS)
rm -rf $(_STAGE1) $(_STAGE1_IMG)
# #####################################################################
_STAGE2_REAL_TARGETS:=$(patsubst %,%-install,$(_STAGE2_TARGETS))
_STAGE2_FETCH_TARGETS:=$(patsubst %,%-fetch,$(_STAGE2_TARGETS))
_STAGE2_CLEAN_TARGETS:=$(patsubst %,%-clean,$(_STAGE2_TARGETS))
_STAGE2_DISTCLEAN_TARGETS:=$(patsubst %,%-distclean,$(_STAGE2_TARGETS))
$(_STAGE2):
mkdir -p $(_STAGE2)
cp -r $(_STAGE2_SKEL)/* $(_STAGE2)
stage2: $(_STAGE2) $(_STAGE2_REAL_TARGETS)
cp -r $(_STAGE2_SKEL)/* $(_STAGE2)
2007-06-15 15:12:22 +02:00
cp -r $(_TOOLCHAIN)/lib/*.so* $(_STAGE2)/lib/
2007-06-15 15:11:23 +02:00
stage2-fetch: $(_STAGE2_FETCH_TARGETS)
stage2-clean: $(_STAGE2_CLEAN_TARGETS)
stage2-distclean: $(_STAGE2_DISTCLEAN_TARGETS)
rm -rf $(_STAGE2)
# #####################################################################
2007-06-15 15:12:22 +02:00
# SUPPORT
# #####################################################################
2007-06-15 15:11:23 +02:00
sync:
mount /dev/sda1 /mnt/usbdisk
rsync -a -c --delete --progress --stats $(_STAGE2)/ /mnt/usbdisk
umount /mnt/usbdisk