# The Valgrind debugger (x86 only)
#TARGETS+=valgrind
+# Some stuff for access points and firewalls
+#TARGETS+=iptables hostap wtools
+
# Run customize.mk at the very end to add your own special config.
# This is useful for making your own distro within the buildroot
# process.
# what you are doing.
#
#############################################################
-BASE_DIR:=${shell pwd}
HOSTCC:=gcc
+BASE_DIR:=${shell pwd}
SOURCE_DIR:=$(BASE_DIR)/sources
DL_DIR:=$(SOURCE_DIR)/dl
PATCH_DIR=$(SOURCE_DIR)/patches
IMAGE:=$(BASE_DIR)/root_fs
MAKE:=make
GNU_TARGET_NAME:=$(OPTIMIZE_FOR_CPU)-linux
-ifneq ($(strip $(ARCH)),i386)
-CROSS:=$(ARCH)-linux-
-endif
+#KERNEL_CROSS:=$(STAGING_DIR)/bin/$(ARCH)-uclibc-
+KERNEL_CROSS:=
all: world
--- /dev/null
+#############################################################
+#
+# hostap
+#
+#############################################################
+HOSTAP_SOURCE_URL=http://hostap.epitest.fi/cgi-bin/viewcvs.cgi/hostap/hostap.tar.gz?tarball=1
+HOSTAP_SOURCE=hostap.tar.gz
+HOSTAP_BUILD_DIR=$(BUILD_DIR)/hostap-snapshot
+HOSTAP_TARGET_MODULE_DIR=$(TARGET_DIR)/lib/modules/$(LINUX_VERSION)/hostapd
+
+$(DL_DIR)/$(HOSTAP_SOURCE):
+ $(WGET) -P $(DL_DIR) $(HOSTAP_SOURCE_URL) -O $(DL_DIR)/$(HOSTAP_SOURCE)
+
+hostap-source: $(DL_DIR)/$(HOSTAP_SOURCE)
+
+$(HOSTAP_BUILD_DIR)/.unpacked: $(DL_DIR)/$(HOSTAP_SOURCE)
+ zcat $(DL_DIR)/$(HOSTAP_SOURCE) | tar -C $(BUILD_DIR) -xvf -
+ mv -f $(BUILD_DIR)/hostap $(HOSTAP_BUILD_DIR)
+ touch $(HOSTAP_BUILD_DIR)/.unpacked
+
+$(HOSTAP_BUILD_DIR)/.configured: $(HOSTAP_BUILD_DIR)/.unpacked
+ touch $(HOSTAP_BUILD_DIR)/.configured
+
+$(HOSTAP_BUILD_DIR)/driver/modules/hostap.o: $(HOSTAP_BUILD_DIR)/.configured
+ $(MAKE) -C $(HOSTAP_BUILD_DIR) pccard KERNEL_PATH=$(BUILD_DIR)/linux CC=$(TARGET_CC)
+ $(MAKE) -C $(HOSTAP_BUILD_DIR)/utils CC=$(TARGET_CC)
+ $(MAKE) -C $(HOSTAP_BUILD_DIR)/hostapd CC=$(TARGET_CC)
+
+$(HOSTAP_TARGET_MODULE_DIR)/hostap.o: $(HOSTAP_BUILD_DIR)/driver/modules/hostap.o
+ # Make the dir
+ rm -Rf $(HOSTAP_TARGET_MODULE_DIR)
+ mkdir -p $(HOSTAP_TARGET_MODULE_DIR)
+ # Copy The Module Files
+ cp -af $(HOSTAP_BUILD_DIR)/driver/modules/*.o $(HOSTAP_TARGET_MODULE_DIR)/
+ cp -af $(HOSTAP_BUILD_DIR)/driver/etc/hostap_cs.conf $(TARGET_DIR)/etc/pcmcia/
+ # Copy The Utils
+ cp -af $(HOSTAP_BUILD_DIR)/utils/hostap_crypt_conf $(TARGET_DIR)/usr/bin/
+ cp -af $(HOSTAP_BUILD_DIR)/utils/hostap_diag $(TARGET_DIR)/usr/bin/
+ cp -af $(HOSTAP_BUILD_DIR)/utils/prism2_param $(TARGET_DIR)/usr/bin/
+ cp -af $(HOSTAP_BUILD_DIR)/utils/prism2_srec $(TARGET_DIR)/usr/bin/
+ # Copy hostapd
+ cp -af $(HOSTAP_BUILD_DIR)/hostapd/hostapd $(TARGET_DIR)/usr/sbin/
+
+hostap: $(HOSTAP_TARGET_MODULE_DIR)/hostap.o
+
+hostap-clean:
+ $(MAKE) DESTDIR=$(TARGET_DIR) CC=$(TARGET_CC) -C $(HOSTAP_BUILD_DIR) uninstall
+ -$(MAKE) -C $(HOSTAP_BUILD_DIR) clean
+
+hostap-dirclean:
+ rm -rf $(HOSTAP_BUILD_DIR)
+
--- /dev/null
+#############################################################
+#
+# iptables
+#
+#############################################################
+IPTABLES_SOURCE_URL=ftp://ftp.netfilter.org/pub/iptables
+IPTABLES_SOURCE=iptables-1.2.7a.tar.bz2
+IPTABLES_BUILD_DIR=$(BUILD_DIR)/iptables-1.2.7a
+
+$(DL_DIR)/$(IPTABLES_SOURCE):
+ $(WGET) -P $(DL_DIR) $(IPTABLES_SOURCE_URL)/$(IPTABLES_SOURCE)
+
+$(IPTABLES_BUILD_DIR)/.unpacked: $(DL_DIR)/$(IPTABLES_SOURCE)
+ bzcat $(DL_DIR)/$(IPTABLES_SOURCE) | tar -C $(BUILD_DIR) -xvf -
+ touch $(IPTABLES_BUILD_DIR)/.unpacked
+
+$(IPTABLES_BUILD_DIR)/.configured: $(IPTABLES_BUILD_DIR)/.unpacked
+ perl -pi -e "s@shell.*YES.*@shell grep -q '__UCLIBC_HAS_IPV6__.*1' \
+ $(BUILD_DIR)/uClibc/include/bits/uClibc_config.h && \
+ echo YES\), YES\)@;" $(IPTABLES_BUILD_DIR)/Makefile
+ touch $(IPTABLES_BUILD_DIR)/.configured
+
+$(IPTABLES_BUILD_DIR)/iptables: $(IPTABLES_BUILD_DIR)/.configured
+ $(MAKE) -C $(IPTABLES_BUILD_DIR) KERNEL_DIR=$(BUILD_DIR)/linux CC=$(TARGET_CC)
+
+$(TARGET_DIR)/sbin/iptables: $(IPTABLES_BUILD_DIR)/iptables
+ # Copy iptables
+ cp -af $(IPTABLES_BUILD_DIR)/iptables $(TARGET_DIR)/sbin/
+ cp -af $(IPTABLES_BUILD_DIR)/iptables-save $(TARGET_DIR)/sbin/
+ cp -af $(IPTABLES_BUILD_DIR)/iptables-restore $(TARGET_DIR)/sbin/
+
+iptables: $(TARGET_DIR)/sbin/iptables
+
+iptables-clean:
+ $(MAKE) DESTDIR=$(TARGET_DIR) CC=$(TARGET_CC) -C $(IPTABLES_BUILD_DIR) uninstall
+ -$(MAKE) -C $(IPTABLES_BUILD_DIR) clean
+
+iptables-dirclean:
+ rm -rf $(IPTABLES_BUILD_DIR)
+
#############################################################
ifneq ($(filter $(TARGETS),linux),)
+# Version of Linux to download and then apply patches to
+DOWNLOAD_LINUX_VERSION=2.4.20
+# Version of Linux AFTER patches
LINUX_VERSION=2.4.20
-LINUX_DIR=$(BUILD_DIR)/linux-$(LINUX_VERSION)
+
LINUX_FORMAT=bzImage
LINUX_BINLOC=arch/$(ARCH)/boot/$(LINUX_FORMAT)
#LINUX_FORMAT=zImage
#LINUX_BINLOC=arch/ppc/boot/images/zImage.prep
-LINUX_SOURCE=linux-$(LINUX_VERSION).tar.bz2
-LINUX_SITE=http://ftp.kernel.org/pub/linux/kernel/v2.4
+
+LINUX_DIR=$(BUILD_DIR)/linux-$(LINUX_VERSION)
+LINUX_SOURCE=linux-$(DOWNLOAD_LINUX_VERSION).tar.bz2
+LINUX_SITE=ftp://ftp.kernel.org/pub/linux/kernel/v2.4
LINUX_KCONFIG=$(SOURCE_DIR)/linux.config
LINUX_KERNEL=$(BUILD_DIR)/buildroot-kernel
$(LINUX_DIR)/.unpacked: $(DL_DIR)/$(LINUX_SOURCE)
rm -rf $(LINUX_DIR)
bzcat $(DL_DIR)/$(LINUX_SOURCE) | tar -C $(BUILD_DIR) -xvf -
+ # Rename the dir from the downloaded version to the AFTER patch version
+ mv -f $(BUILD_DIR)/linux-$(DOWNLOAD_LINUX_VERSION) $(BUILD_DIR)/linux-$(LINUX_VERSION)
mkdir -p $(SOURCE_DIR)/kernel-patches
$(SOURCE_DIR)/patch-kernel.sh $(LINUX_DIR) $(SOURCE_DIR)/kernel-patches
-(cd $(BUILD_DIR); ln -sf $(LINUX_DIR) linux)
fi;
$(LINUX_DIR)/.configured $(BUILD_DIR)/linux/.configured: $(LINUX_DIR)/.unpacked $(LINUX_KCONFIG)
- #perl -i -p -e "s,^CROSS_COMPILE.*,\
- # CROSS_COMPILE=$(STAGING_DIR)/bin/$(ARCH)-uclibc-,g;" \
- # $(LINUX_DIR)/Makefile
+ perl -i -p -e "s,^CROSS_COMPILE.*,CROSS_COMPILE=$(KERNEL_CROSS),g;" $(LINUX_DIR)/Makefile
-cp $(LINUX_KCONFIG) $(LINUX_DIR)/.config
$(MAKE) -C $(LINUX_DIR) oldconfig include/linux/version.h
touch $(LINUX_DIR)/.configured
--- /dev/null
+#############################################################
+#
+# wtools - Wireless Tools
+#
+#############################################################
+#
+WTOOLS_SOURCE_URL=http://www.hpl.hp.com/personal/Jean_Tourrilhes/Linux
+WTOOLS_SOURCE=wireless_tools.26.pre7.tar.gz
+WTOOLS_BUILD_DIR=$(BUILD_DIR)/wireless_tools.26
+
+$(DL_DIR)/$(WTOOLS_SOURCE):
+ $(WGET) -P $(DL_DIR) $(WTOOLS_SOURCE_URL)/$(WTOOLS_SOURCE)
+
+$(WTOOLS_BUILD_DIR)/.unpacked: $(DL_DIR)/$(WTOOLS_SOURCE)
+ zcat $(DL_DIR)/$(WTOOLS_SOURCE) | tar -C $(BUILD_DIR) -xvf -
+ touch $(WTOOLS_BUILD_DIR)/.unpacked
+
+$(WTOOLS_BUILD_DIR)/.configured: $(WTOOLS_BUILD_DIR)/.unpacked
+ touch $(WTOOLS_BUILD_DIR)/.configured
+
+$(WTOOLS_BUILD_DIR)/iwconfig: $(WTOOLS_BUILD_DIR)/.configured
+ $(MAKE) -C $(WTOOLS_BUILD_DIR) KERNEL_SRC=$(BUILD_DIR)/linux CC=$(TARGET_CC)
+
+$(TARGET_DIR)/sbin/iwconfig: $(WTOOLS_BUILD_DIR)/iwconfig
+ # Copy The Wireless Tools
+ cp -af $(WTOOLS_BUILD_DIR)/iwconfig $(TARGET_DIR)/sbin/
+ cp -af $(WTOOLS_BUILD_DIR)/iwevent $(TARGET_DIR)/sbin/
+ cp -af $(WTOOLS_BUILD_DIR)/iwgetid $(TARGET_DIR)/sbin/
+ cp -af $(WTOOLS_BUILD_DIR)/iwlist $(TARGET_DIR)/sbin/
+ cp -af $(WTOOLS_BUILD_DIR)/iwpriv $(TARGET_DIR)/sbin/
+ cp -af $(WTOOLS_BUILD_DIR)/iwspy $(TARGET_DIR)/sbin/
+
+wtools: $(TARGET_DIR)/sbin/iwconfig
+
+wtools-clean:
+ $(MAKE) DESTDIR=$(TARGET_DIR) CC=$(TARGET_CC) -C $(WTOOLS_BUILD_DIR) uninstall
+ -$(MAKE) -C $(WTOOLS_BUILD_DIR) clean
+
+wtools-dirclean:
+ rm -rf $(WTOOLS_BUILD_DIR)
+