[Zrouter-src] ZRouter.org: push to ZRouter Makefile
zrouter-src at zrouter.org
zrouter-src at zrouter.org
Sat Jan 21 16:36:25 UTC 2012
details: http://zrouter.org/hg/zrouter//rev/cacb440b5a39
changeset: 322:cacb440b5a39
user: ray at terran.dlink.ua
date: Sat Jan 21 18:38:16 2012 +0200
description:
Merge with Eric's TPLink/TL-WR1043ND-v1 changes.
diffstat:
Makefile | 15 +-
boards/TPLink/TL-WR1043ND-v1/README | 45 +++++
boards/TPLink/TL-WR1043ND-v1/board.hints | 148 +++++++++++++++++
boards/TPLink/TL-WR1043ND-v1/board.mk | 102 +++++++++++
boards/TPLink/TL-WR1043ND-v1/files/etc/rc.d/ADAPTATION | 42 ++++
5 files changed, 348 insertions(+), 4 deletions(-)
diffs (396 lines):
diff -r 4445eeeff278 -r cacb440b5a39 Makefile
--- a/Makefile Sat Jan 21 18:36:25 2012 +0200
+++ b/Makefile Sat Jan 21 18:38:16 2012 +0200
@@ -563,7 +563,6 @@
UBNT_KERNEL_ENTRY_POINT?= ${KERNCONF_KERNENTRYPOINT}
UBNT_KERNEL_FLASH_BASE?= 0xbf030000
-TPLINK_ROOTFS_START?= XXX_TODO
TPLINK_KERN_LOADADDR?= ${KERNCONF_KERNLOADADDR}
TPLINK_KERN_STARTADDR?= ${KERNCONF_KERNENTRYPOINT}
TPLINK_IMG_NAME?= ZRouter.org
@@ -612,20 +611,28 @@
# and need "mktplinkfw" for building the firmware
tplink_image: ${KERNEL_PACKED_NAME} ${ROOTFS_PACKED_NAME} ${ZTOOLS_PATH}/mktplinkfw
@echo "++++++++++++++ Making $@ ++++++++++++++"
- if [ "x${TPLINK_BOARDTYPE}" = "x" ] ; then \
+ @if [ "x${TPLINK_BOARDTYPE}" = "x" ] ; then \
echo "TPLINK_BOARDTYPE must be defined"; \
exit 1; \
fi
+ @if [ "x${KERNEL_MAP_START}" = "x" ] ; then \
+ echo "KERNEL_MAP_START must be defined, this is the hint.map.?.start ";\
+ echo "address from board.hints where hint.map.?.name='kernel'"; \
+ exit 1; \
+ fi
+ KERNEL_PACKED_SIZE=`stat -f %z "${KERNEL_PACKED_NAME}"`; \
+ TPLINK_ROOTFS_START=`printf "%#x" $$(( ${KERNEL_MAP_START} + $${KERNEL_PACKED_SIZE} ))`; \
PATH=${IMAGE_BUILD_PATHS} mktplinkfw \
-B ${TPLINK_BOARDTYPE} \
- -R ${TPLINK_ROOTFS_START} \
+ -R $${TPLINK_ROOTFS_START} \
-L ${TPLINK_KERN_LOADADDR} \
-E ${TPLINK_KERN_STARTADDR} \
-k "${KERNEL_PACKED_NAME}" \
-N ${TPLINK_IMG_NAME} \
-V ${TPLINK_IMG_VERSION} \
-r "${ROOTFS_PACKED_NAME}" \
- -o "${NEW_IMAGE}"
+ -o "${NEW_IMAGE}" && \
+ PATH=${IMAGE_BUILD_PATHS} mktplinkfw -i "${NEW_IMAGE}"
split_kernel_rootfs: ${KERNEL_PACKED_NAME} ${ROOTFS_PACKED_NAME}
diff -r 4445eeeff278 -r cacb440b5a39 boards/TPLink/TL-WR1043ND-v1/README
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/boards/TPLink/TL-WR1043ND-v1/README Sat Jan 21 18:38:16 2012 +0200
@@ -0,0 +1,45 @@
+Further work is in progress, for now the kernel boots and the rootfs mounts.
+
+This was tested with TL-WR1043ND Ver:1.8, but I expect all 1.x should work.
+
+Many thanks to Adrian Chadd and Alexandr Rybalko for the kind help with this
+board definition, which is mostly based on Adrian's work on:
+http://code.google.com/p/freebsd-wifi-build/wiki/TpLinkTLWR1043ND
+
+
+
+How to build
+--------------------------------------------------------------------------------
+
+as root:
+make FREEBSD_SRC_TREE=/your/path/to/ZRouter's/modified/FreeBSD/head TARGET_PAIR=TPLink/TL-WR1043ND-v1
+
+Find the TPLink_TL-WR1043ND-v1.bin in /usr/obj/... and copy it to
+your TFTP server.
+
+
+
+How to flash
+--------------------------------------------------------------------------------
+
+erase 0xbf020000 +7c0000
+tftpboot 0x81000000 TPLink_TL-WR1043ND-v1.bin
+cp.b 0x81000000 0xbf020000 0x7c0000
+bootm 0xbf020000
+
+(hint: you can concatenate the commands by ";")
+
+
+
+TODO
+--------------------------------------------------------------------------------
+
+* scripts which are writing to flash don't work
+ ("dd: /dev/map/config: Invalid argument")
+
+* invert LEDs, now `echo 1 > /dev/led/status` switches off
+
+
+
+Eric Kraußer
+
diff -r 4445eeeff278 -r cacb440b5a39 boards/TPLink/TL-WR1043ND-v1/board.hints
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/boards/TPLink/TL-WR1043ND-v1/board.hints Sat Jan 21 18:38:16 2012 +0200
@@ -0,0 +1,148 @@
+# from head/sys/mips/conf/TP-WN1043ND.hints by Adrian Chadd
+
+
+# arge
+hint.arge.0.at="nexus0"
+hint.arge.0.maddr=0x19000000
+hint.arge.0.msize=0x1000
+hint.arge.0.irq=2
+
+hint.arge.1.at="nexus0"
+hint.arge.1.maddr=0x1a000000
+hint.arge.1.msize=0x1000
+hint.arge.1.irq=3
+
+# XXX The ath device hangs off of the AHB, rather than the Nexus.
+hint.ath.0.at="nexus0"
+hint.ath.0.maddr=0x180c0000
+hint.ath.0.msize=0x30000
+hint.ath.0.irq=0
+
+
+# Hard-code the PHY for now, until there's switch phy support.
+hint.arge.0.phymask=0x000c
+hint.arge.0.media=1000
+hint.arge.0.fduplex=1
+
+# Where is the MAC address stored in flash for this particular unit.
+hint.arge.0.eeprommac=0x1f01fc00
+
+# This isn't used, but configure it anyway.
+# This should eventually just not be configured, but the if then
+# needs to be properly disabled or spurious interrupts occur.
+hint.arge.1.phymask=0x0
+
+# Where the ART is
+hint.ath.0.eepromaddr=0x1fff1000
+
+#
+# Define a slightly custom flash layout.
+# The default flash layout:
+#
+# 128k: uboot
+# 1024k: kernel
+# 4096k: rootfs
+# 2816: unknown
+# 64k: board config?
+# 64k: ART
+#
+# from printenv:
+# bootargs=console=ttyS0,115200 root=31:02 rootfstype=jffs2 init=/sbin/init
+# mtdparts=ar9100-nor0:128k(u-boot),1024k(kernel),4096k(rootfs),64k(art)
+# This isn't a lot of space!
+# So:
+# 128k: uboot
+# ????: kernel
+# ????: rootfs
+# 64k: config
+# 64k: ART
+
+hint.map.0.at="flash/spi0"
+hint.map.0.start=0x00000000
+hint.map.0.end=0x000020000
+hint.map.0.name="bootloader"
+hint.map.0.readonly=1
+
+hint.map.1.at="flash/spi0"
+hint.map.1.start=0x00020000
+hint.map.1.end="search:0x00100000:0x10000:.!/bin/sh"
+hint.map.1.name="kernel"
+hint.map.1.readonly=1
+
+hint.map.2.at="flash/spi0"
+hint.map.2.start="search:0x00100000:0x10000:.!/bin/sh"
+hint.map.2.end=0x007e0000
+hint.map.2.name="rootfs"
+hint.map.2.readonly=1
+
+hint.map.3.at="flash/spi0"
+hint.map.3.start=0x00020000
+hint.map.3.end=0x007e0000
+hint.map.3.name="upgrade"
+hint.map.3.readonly=0
+
+hint.map.4.at="flash/spi0"
+hint.map.4.start=0x007e0000
+hint.map.4.end=0x007f0000
+hint.map.4.name="config"
+hint.map.4.readonly=0
+
+# This is radio calibration section. It is (or should be!) unique
+# for each board, to take into account thermal and electrical differences
+# as well as the regulatory compliance data.
+hint.map.5.at="flash/spi0"
+hint.map.5.start=0x007f0000
+hint.map.5.end=0x00800000
+hint.map.5.name="art"
+hint.map.5.readonly=1
+
+# GPIO specific configuration block
+# Don't flip on anything that isn't already enabled.
+# This includes leaving the SPI CS1/CS2 pins as GPIO pins as they're
+# not used here.
+hint.gpio.0.function_set=0x00000000
+hint.gpio.0.function_clear=0x00000000
+
+# These are the GPIO LEDs and buttons which can be software controlled.
+hint.gpio.0.pinmask=0x001c02ae
+# pin 1 - USB (LED)
+# pin 2 - System (LED)
+# Pin 3 - Reset (input)
+# Pin 5 - QSS (LED)
+# Pin 7 - QSS Button (input)
+# Pin 8 - wired into the chip reset line
+# Pin 9 - WLAN
+# Pin 10 - UART TX (not GPIO)
+# Pin 13 - UART RX (not GPIO)
+# Pin 18 - RTL8366RB switch data line
+# Pin 19 - RTL8366RB switch clock line
+# Pin 20 - "GPIO20"
+# LEDs are configured separately and driven by the LED device
+
+# the output needs to be inverted (flags=0x????)
+# on some LEDs or "echo 1 > /dev/led/status" will switch off the LED
+# see sys/sys/gpio.h in FreeBSD sources
+
+# USB
+hint.gpioled.0.at="gpiobus0"
+hint.gpioled.0.name="usb"
+hint.gpioled.0.pins=0x0002
+#hint.gpioled.0.flags=0x????
+
+# SYS
+hint.gpioled.1.at="gpiobus0"
+hint.gpioled.1.name="status"
+hint.gpioled.1.pins=0x0004
+#hint.gpioled.1.flags=0x????
+
+# QSS
+hint.gpioled.2.at="gpiobus0"
+hint.gpioled.2.name="qss"
+hint.gpioled.2.pins=0x0020
+
+# WLAN
+hint.gpioled.3.at="gpiobus0"
+hint.gpioled.3.name="wlan"
+hint.gpioled.3.pins=0x0200
+#hint.gpioled.3.flags=0x????
+
diff -r 4445eeeff278 -r cacb440b5a39 boards/TPLink/TL-WR1043ND-v1/board.mk
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/boards/TPLink/TL-WR1043ND-v1/board.mk Sat Jan 21 18:38:16 2012 +0200
@@ -0,0 +1,102 @@
+
+###################################################
+#
+# Board used hardware/chips
+#
+###################################################
+
+SOC_VENDOR=Atheros
+SOC_CHIP=AR9132
+BOARD_FLASH_SIZE=8M
+
+
+###################################################
+#
+# Vars for kernel config
+#
+###################################################
+
+# ident
+KERNCONF_IDENT=${TARGET_VENDOR}_${TARGET_DEVICE}
+
+# Enable the uboot environment stuff rather then the redboot stuff.
+KERNCONF_OPTIONS+= AR71XX_ENV_UBOOT
+
+# Force the board memory - 32MB
+KERNCONF_OPTIONS+= AR71XX_REALMEM=32*1024*1024
+
+
+# Include usb and SoC usb controller drivers
+WITH_USB=yes
+
+# Builded modules
+KERNCONF_MODULES_OVERRIDE+=usb/uplcom usb/u3g usb/umodem usb/umass usb/ucom cam zlib
+
+KERNCONF_DEVICES+= switch
+
+# Additional utilities
+WORLD_SUBDIRS_ZROUTER+=target/sbin/upgrade
+
+.if !defined(WITHOUT_WIRELESS)
+KERNCONF_OPTIONS+= IEEE80211_DEBUG
+KERNCONF_OPTIONS+= IEEE80211_SUPPORT_MESH
+KERNCONF_OPTIONS+= IEEE80211_SUPPORT_TDMA
+KERNCONF_DEVICES+= wlan
+# ? not for ath?
+#KERNCONF_DEVICES+= wlan_amrr
+KERNCONF_DEVICES+= wlan_wep
+KERNCONF_DEVICES+= wlan_ccmp
+KERNCONF_DEVICES+= wlan_tkip
+KERNCONF_DEVICES+= wlan_xauth
+
+KERNCONF_OPTIONS+= AH_DEBUG
+KERNCONF_OPTIONS+= ATH_DEBUG
+KERNCONF_OPTIONS+= ATH_DIAGAPI
+KERNCONF_OPTIONS+= AH_SUPPORT_AR5416
+# Makes other chipsets not function!
+KERNCONF_OPTIONS+= AH_SUPPORT_AR9130
+KERNCONF_OPTIONS+= AH_RXCFG_SDMAMW_4BYTES
+KERNCONF_OPTIONS+= ATH_ENABLE_11N
+
+KERNCONF_DEVICES+= ath
+KERNCONF_DEVICES+= ath_rate_sample
+KERNCONF_DEVICES+= ath_ahb
+# not needed anymore?
+#KERNCONF_DEVICES+= ath_hal
+KERNCONF_DEVICES+= ath_ar5212
+KERNCONF_DEVICES+= ath_ar5416
+KERNCONF_DEVICES+= ath_ar9130
+.endif
+
+
+###################################################
+#
+# Limits
+#
+###################################################
+
+# Image must not be bigger than 'upgrade' geom_map partition
+FIRMWARE_IMAGE_SIZE_MAX=0x007c0000
+
+# the hint.map.?.start address from board.hints where hint.map.?.name="kernel"
+KERNEL_MAP_START=0x00020000
+
+
+###################################################
+#
+# Firmware Image Options
+#
+###################################################
+
+TARGET_PROFILES+=SMALL_ mpd ssh shttpd dlink.ua.web hostap dhcp nfs_client
+
+MKULZMA_BLOCKSIZE=65536
+
+PACKING_KERNEL_IMAGE=kernel.strip.kbin.gz.sync
+PACKING_ROOTFS_IMAGE=rootfs_clean.iso.ulzma
+
+TPLINK_BOARDTYPE="TL-WR1043NDv1"
+
+IMAGE_SUFFIX=bin
+NEW_IMAGE_TYPE=tplink_image
+
diff -r 4445eeeff278 -r cacb440b5a39 boards/TPLink/TL-WR1043ND-v1/files/etc/rc.d/ADAPTATION
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/boards/TPLink/TL-WR1043ND-v1/files/etc/rc.d/ADAPTATION Sat Jan 21 18:38:16 2012 +0200
@@ -0,0 +1,42 @@
+#!/bin/sh
+
+# PROVIDE: ADAPTATION
+
+. /etc/rc.subr
+. /etc/network.subr
+
+name="ADAPTATION"
+start_cmd="adapt_start"
+start_precmd="adapt_prestart"
+start_postcmd="adapt_poststart"
+stop_cmd="adapt_stop"
+
+adapt_prestart()
+{
+ #ifconfig rt0 name lan0
+ #ifconfig vlan2 create vlan 2 vlandev lan0
+ #ifconfig vlan2 name wan0
+ # name wlan0 will be used when hostap or client are created
+ #ifconfig rt28600 name wifi0
+ #hostname `kenv HostName`
+ #wan_mac_addr=`kenv WAN_MAC_ADDR`
+ # lan mac wan+1
+ # wlan mac wan+2
+
+}
+
+adapt_start()
+{
+}
+
+adapt_poststart()
+{
+}
+
+adapt_stop()
+{
+}
+
+load_rc_config $name
+
+run_rc_command $*
More information about the Zrouter-src
mailing list