| 1 |
# $FreeWRT$ |
| 2 |
#- |
| 3 |
# This file is part of the FreeWRT project. FreeWRT is copyrighted |
| 4 |
# material, please see the LICENCE file in the top-level directory |
| 5 |
# or at http://www.freewrt.org/licence for details. |
| 6 |
|
| 7 |
define target_template |
| 8 |
ifeq ($(FWRT_LINUX_$(4)),y) |
| 9 |
KERNEL:=$(1) |
| 10 |
BOARD:=$(2) |
| 11 |
DEVICE:=$(3) |
| 12 |
endif |
| 13 |
|
| 14 |
ifeq ($(FWRT_BUILD_TARGET),y) |
| 15 |
$(1)/$(2)/$(3)-clean: |
| 16 |
@$(TRACE) target/linux/$(2)-$(1)-clean |
| 17 |
$(MAKE) -C $(2)-$(1) BOARD="$(2)" DEVICE="$(3)" clean |
| 18 |
|
| 19 |
$(1)/$(2)/$(3)-prepare: |
| 20 |
@$(TRACE) target/linux/$(2)-$(1)-prepare |
| 21 |
$(MAKE) -C $(2)-$(1) BOARD="$(2)" DEVICE="$(3)" prepare |
| 22 |
|
| 23 |
$(1)/$(2)/$(3)-compile: |
| 24 |
@$(TRACE) target/linux/$(2)-$(1)-compile |
| 25 |
$(MAKE) -C $(2)-$(1) BOARD="$(2)" DEVICE="$(3)" compile |
| 26 |
|
| 27 |
$(1)/$(2)/$(3)-install: |
| 28 |
@$(TRACE) target/linux/$(2)-$(1)-install |
| 29 |
$(MAKE) -C $(2)-$(1) BOARD="$(2)" DEVICE="$(3)" install |
| 30 |
|
| 31 |
$(1)/$(2)/$(3)-noinstall: |
| 32 |
@$(TRACE) target/linux/$(2)-$(1)-noinstall |
| 33 |
$(MAKE) -C $(2)-$(1) BOARD="$(2)" DEVICE="$(3)" noinstall |
| 34 |
|
| 35 |
ifeq ($(FWRT_LINUX_$(4)),y) |
| 36 |
clean: $(1)/$(2)/$(3)-clean |
| 37 |
prepare: $(1)/$(2)/$(3)-prepare |
| 38 |
compile: $(1)/$(2)/$(3)-compile |
| 39 |
install: $(1)/$(2)/$(3)-install |
| 40 |
noinstall: $(1)/$(2)/$(3)-noinstall |
| 41 |
endif |
| 42 |
|
| 43 |
.PHONY: $(1)/$(2)/$(3)-clean $(1)/$(2)/$(3)-prepare \ |
| 44 |
$(1)/$(2)/$(3)-compile $(1)/$(2)/$(3)-install |
| 45 |
|
| 46 |
endif |
| 47 |
endef |
| 48 |
|
| 49 |
# asus models |
| 50 |
$(eval $(call target_template,2.4,brcm,asus-wl-hdd,2_4_BRCM_ASUS_WLHDD)) |
| 51 |
$(eval $(call target_template,2.4,brcm,asus-wl500g,2_4_BRCM_ASUS_WL500G)) |
| 52 |
$(eval $(call target_template,2.4,brcm,asus-wl500g-deluxe,2_4_BRCM_ASUS_WL500G_DELUXE)) |
| 53 |
$(eval $(call target_template,2.4,brcm,asus-wl500g-premium,2_4_BRCM_ASUS_WL500G_PREMIUM)) |
| 54 |
$(eval $(call target_template,2.6,brcm,asus-wl500g-premium,2_6_BRCM_ASUS_WL500G_PREMIUM)) |
| 55 |
# linksys models |
| 56 |
$(eval $(call target_template,2.4,brcm,linksys-wrt54g-old,2_4_BRCM_LINKSYS_WRT54G_OLD)) |
| 57 |
$(eval $(call target_template,2.4,brcm,linksys-wrt54g,2_4_BRCM_LINKSYS_WRT54G)) |
| 58 |
$(eval $(call target_template,2.4,brcm,linksys-wrt54gs,2_4_BRCM_LINKSYS_WRT54GS)) |
| 59 |
$(eval $(call target_template,2.4,brcm,linksys-wrt54gs4,2_4_BRCM_LINKSYS_WRT54GS_4)) |
| 60 |
$(eval $(call target_template,2.4,brcm,linksys-wrt54g3g,2_4_BRCM_LINKSYS_WRT54G3G)) |
| 61 |
# netgear models |
| 62 |
$(eval $(call target_template,2.4,brcm,netgear-wgt634u,2_4_BRCM_NETGEAR_WGT634U)) |
| 63 |
$(eval $(call target_template,2.6,brcm,netgear-wgt634u,2_6_BRCM_NETGEAR_WGT634U)) |
| 64 |
# routerboard models made by mikrotik |
| 65 |
$(eval $(call target_template,2.4,rb,rb532,2_4_RB_RB532)) |
| 66 |
$(eval $(call target_template,2.6,rb,rb532,2_6_RB_RB532)) |
| 67 |
# PC engine WRAP |
| 68 |
$(eval $(call target_template,2.6,x86,wrap,2_6_X86_WRAP)) |
| 69 |
$(eval $(call target_template,2.6,x86,cryptotoken,2_6_X86_CRYPTOTOKEN)) |
| 70 |
# nokernel targets |
| 71 |
$(eval $(call target_template,2.4,pkgmips,mips,NOKERNEL_MIPS_24)) |
| 72 |
$(eval $(call target_template,2.4,pkgarmeb,armeb,NOKERNEL_ARMEB_24)) |
| 73 |
$(eval $(call target_template,2.4,pkgarm,arm,NOKERNEL_ARM_24)) |
| 74 |
$(eval $(call target_template,2.4,pkgcris,cris,NOKERNEL_CRIS_24)) |
| 75 |
$(eval $(call target_template,2.4,pkgavr32,avr32,NOKERNEL_AVR32_24)) |
| 76 |
$(eval $(call target_template,2.4,pkgpowerpc,powerpc,NOKERNEL_POWERPC_24)) |
| 77 |
$(eval $(call target_template,2.4,pkgi386,i386,NOKERNEL_I386_24)) |
| 78 |
$(eval $(call target_template,2.6,pkgmips,mips,NOKERNEL_MIPS_26)) |
| 79 |
$(eval $(call target_template,2.6,pkgarmeb,armeb,NOKERNEL_ARMEB_26)) |
| 80 |
$(eval $(call target_template,2.6,pkgarm,arm,NOKERNEL_ARM_26)) |
| 81 |
$(eval $(call target_template,2.6,pkgcris,cris,NOKERNEL_CRIS_26)) |
| 82 |
$(eval $(call target_template,2.6,pkgavr32,avr32,NOKERNEL_AVR32_26)) |
| 83 |
$(eval $(call target_template,2.6,pkgpowerpc,powerpc,NOKERNEL_POWERPC_26)) |
| 84 |
$(eval $(call target_template,2.6,pkgi386,i386,NOKERNEL_I386_26)) |
| 85 |
|
| 86 |
|
| 87 |
define rootfs_template |
| 88 |
ifeq ($(FWRT_TARGET_ROOTFS_$(2)),y) |
| 89 |
FS:=$(1) |
| 90 |
FS_CMDLINE:=$(3) |
| 91 |
endif |
| 92 |
endef |
| 93 |
|
| 94 |
$(eval $(call rootfs_template,jffs2,JFFS2,rootfstype=jffs2 root=/dev/mtdblock2)) |
| 95 |
$(eval $(call rootfs_template,squashfs,SQUASHFS,rootfstype=squashfs root=/dev/mtdblock2)) |
| 96 |
$(eval $(call rootfs_template,ramovl,RAMOVL,rootfstype=squashfs root=/dev/mtdblock2)) |
| 97 |
$(eval $(call rootfs_template,nfs,NFS,root=/dev/nfs ip=dhcp)) |
| 98 |
$(eval $(call rootfs_template,ext2-cf,EXT2_CF,root=/dev/cfa2)) |
| 99 |
$(eval $(call rootfs_template,yaffs2,YAFFS2,root=/dev/mtdblock1)) |
| 100 |
$(eval $(call rootfs_template,initramfs,INITRAMFS)) |
| 101 |
$(eval $(call rootfs_template,none,NONE)) |
| 102 |
|
| 103 |
|
| 104 |
# set kernel version |
| 105 |
KERNEL_VERSION=${UNAME_R} |
| 106 |
ifeq ($(KERNEL),2.4) |
| 107 |
KERNEL_RELEASE=1 |
| 108 |
KERNEL_MOD_SUFFIX=o |
| 109 |
endif |
| 110 |
ifeq ($(KERNEL),2.6) |
| 111 |
KERNEL_RELEASE=1 |
| 112 |
KERNEL_MOD_SUFFIX=ko |
| 113 |
endif |
| 114 |
|
| 115 |
|
| 116 |
# set architecture |
| 117 |
ifeq ($(BOARD),brcm) |
| 118 |
CPU_ARCH=mipsel |
| 119 |
KERNEL_ARCH=mips |
| 120 |
endif |
| 121 |
|
| 122 |
ifeq ($(BOARD),rb) |
| 123 |
CPU_ARCH=mipsel |
| 124 |
KERNEL_ARCH=mips |
| 125 |
endif |
| 126 |
|
| 127 |
ifeq ($(BOARD),x86) |
| 128 |
CPU_ARCH=i386 |
| 129 |
KERNEL_ARCH=i386 |
| 130 |
endif |
| 131 |
|
| 132 |
ifeq (${BOARD},pkgarmeb) |
| 133 |
CPU_ARCH= armeb |
| 134 |
KERNEL_ARCH= arm |
| 135 |
endif |
| 136 |
|
| 137 |
ifeq (${BOARD},pkgmips) |
| 138 |
CPU_ARCH= mipsel |
| 139 |
KERNEL_ARCH= mips |
| 140 |
endif |
| 141 |
|
| 142 |
ifeq (${BOARD},pkgi386) |
| 143 |
CPU_ARCH= i386 |
| 144 |
KERNEL_ARCH= i386 |
| 145 |
endif |
| 146 |
|
| 147 |
|
| 148 |
FWRT_VERSION=devel |
| 149 |
|
| 150 |
export FWRT_VERSION |
| 151 |
export BOARD |
| 152 |
export CPU_ARCH |
| 153 |
export KERNEL_ARCH |
| 154 |
export KERNEL |
| 155 |
export KERNEL_VERSION |
| 156 |
export DEVICE |
| 157 |
export FS |