1
0
mirror of git://projects.qi-hardware.com/openwrt-xburst.git synced 2024-11-23 22:52:28 +02:00

Merge branch 'master' of openwrt-backfire into xburst

Conflicts:

	target/linux/x86/image/Config.in
This commit is contained in:
Mirko Vogt 2010-06-08 11:24:58 +02:00
commit 4ecc663fa9
95 changed files with 11851 additions and 2711 deletions

View File

@ -102,7 +102,7 @@ menu "Target Images"
source "target/linux/*/image/Config.in"
config TARGET_ROOTFS_FSPART
config TARGET_ROOTFS_PARTSIZE
int "Root filesystem partition size (in MB)"
depends X86_GRUB_IMAGES || TARGET_ROOTFS_EXT2FS || TARGET_rb532
default 48

View File

@ -110,7 +110,7 @@ ifneq ($(CONFIG_TARGET_ROOTFS_TARGZ),)
endif
ifneq ($(CONFIG_TARGET_ROOTFS_EXT2FS),)
E2SIZE=$(shell echo $$(($(CONFIG_TARGET_ROOTFS_FSPART)*1024)))
E2SIZE=$(shell echo $$(($(CONFIG_TARGET_ROOTFS_PARTSIZE)*1024)))
define Image/mkfs/ext2
$(STAGING_DIR_HOST)/bin/genext2fs -U -b $(E2SIZE) -N $(CONFIG_TARGET_ROOTFS_MAXINODE) -d $(TARGET_DIR)/ $(KDIR)/root.ext2

View File

@ -1,5 +1,5 @@
#
# Copyright (C) 2006-2008 OpenWrt.org
# Copyright (C) 2006-2010 OpenWrt.org
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
@ -10,7 +10,7 @@ include $(INCLUDE_DIR)/kernel.mk
PKG_NAME:=acx
PKG_VERSION:=20080210
PKG_RELEASE:=1
PKG_RELEASE:=2
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
PKG_SOURCE_URL:=@SF/acx100

View File

@ -10,7 +10,7 @@ include $(TOPDIR)/rules.mk
include $(INCLUDE_DIR)/kernel.mk
PKG_NAME:=base-files
PKG_RELEASE:=43
PKG_RELEASE:=43.1
PKG_FILE_DEPENDS:=$(PLATFORM_DIR)/ $(GENERIC_PLATFORM_DIR)/base-files/

View File

@ -68,7 +68,36 @@ case "$ACTION" in
ifup)
include /lib/network
scan_interfaces
# Setup aliases
config_set "$INTERFACE" aliases ""
config_set "$INTERFACE" alias_count 0
config_foreach setup_interface_alias alias "$INTERFACE" "$DEVICE"
# Save alias references in state vars
local aliases
config_get aliases "$INTERFACE" aliases
[ -z "$aliases" ] || uci_set_state network "$INTERFACE" aliases "$aliases"
# Make ip6addr of parent iface the main address again
local ip6addr
config_get ip6addr "$INTERFACE" ip6addr
[ -z "$ip6addr" ] || {
ifconfig "$DEVICE" del "$ip6addr"
ifconfig "$DEVICE" add "$ip6addr"
}
# Setup routes
config_foreach "add_route" route
config_foreach "add_route6" route6
;;
ifdown)
# Bring down named aliases
local device=$(uci_get_state network "$INTERFACE" device)
local ifn
for ifn in $(ifconfig | sed -ne "s/^\(\($DEVICE${device:+\|$device}\|br-$INTERFACE\):[^[:space:]]\+\).*/\1/p"); do
ifconfig "$ifn" down
done
;;
esac

View File

@ -11,7 +11,7 @@ addif() {
# PPP devices are configured by pppd, no need to run setup_interface here
case "$INTERFACE" in
ppp*) return 0;;
ppp*|3g-*) return 0;;
ath*) return 0;;
wlan*) return 0;;
esac
@ -46,7 +46,7 @@ delif() {
for ifc in $interfaces; do
config_get iftype "$ifc" type
config_get ifs "$ifc" device
confdevs="$(uci get network.$ifc.ifname)"
confdevs="$(uci_get network.$ifc.ifname)"
for dev in $ifs; do
[ "${dev%%\.*}" = "$INTERFACE" ] && {
list_contains confdevs "$dev" || list_remove ifs "$dev"

View File

@ -8,7 +8,6 @@ DEVICENAME ~~ (null|full|ptmx|tty|zero|gpio|hvc) {
DEVICENAME ~~ (tun|tap[0-9]) {
nothrottle
makedev /dev/net/%DEVICENAME% 0644
next
}
DEVICENAME ~~ (ppp) {

View File

@ -15,6 +15,20 @@ boot() {
rm -f /etc/config/wireless
/sbin/wifi detect > /etc/config/wireless
}
scan_interfaces
local ifc
for ifc in $interfaces; do
local proto
config_get proto "$ifc" proto
local auto
config_get_bool auto "$ifc" auto 1
type "coldplug_interface_$proto" >/dev/null && [ "$auto" = 1 ] && \
coldplug_interface_$proto "$ifc"
done
}
start() {

View File

@ -32,6 +32,7 @@ find_mtd_part() {
jffs2_ready () {
mtdpart="$(find_mtd_part rootfs_data)"
[ -z "$mtdpart" ] && return 1
magic=$(hexdump $mtdpart -n 4 -e '4/1 "%02x"')
[ "$magic" != "deadc0de" ]
}

View File

@ -66,6 +66,52 @@ add_vlan() {
return 1
}
# add dns entries if they are not in resolv.conf yet
add_dns() {
local cfg="$1"; shift
remove_dns "$cfg"
# We may be called by pppd's ip-up which has a nonstandard umask set.
# Create an empty file here and force its permission to 0644, otherwise
# dnsmasq will not be able to re-read the resolv.conf.auto .
[ ! -f /tmp/resolv.conf.auto ] && {
touch /tmp/resolv.conf.auto
chmod 0644 /tmp/resolv.conf.auto
}
local dns
local add
for dns in "$@"; do
grep -qsF "nameserver $dns" /tmp/resolv.conf.auto || {
add="${add:+$add }$dns"
echo "nameserver $dns" >> /tmp/resolv.conf.auto
}
done
[ -n "$cfg" ] && {
uci_set_state network "$cfg" dns "$add"
uci_set_state network "$cfg" resolv_dns "$add"
}
}
# remove dns entries of the given iface
remove_dns() {
local cfg="$1"
[ -n "$cfg" ] && {
[ -f /tmp/resolv.conf.auto ] && {
local dns=$(uci_get_state network "$cfg" resolv_dns)
for dns in $dns; do
sed -i -e "/^nameserver $dns$/d" /tmp/resolv.conf.auto
done
}
uci_revert_state network "$cfg" dns
uci_revert_state network "$cfg" resolv_dns
}
}
# sort the device list, drop duplicates
sort_list() {
local arg="$*"
@ -115,7 +161,18 @@ prepare_interface() {
config_get iftype "$config" type
case "$iftype" in
bridge)
local macaddr
config_get macaddr "$config" macaddr
[ -x /usr/sbin/brctl ] && {
# Remove IPv6 link local addr before adding the iface to the bridge
local llv6="$(ifconfig "$iface")"
case "$llv6" in
*fe80:*/64*)
llv6="${llv6#* fe80:}"
ifconfig "$iface" del "fe80:${llv6%% *}"
;;
esac
ifconfig "br-$config" 2>/dev/null >/dev/null && {
local newdevs devices
config_get devices "$config" device
@ -139,7 +196,7 @@ prepare_interface() {
# result in another setup_interface() call, so we simply stop processing
# the current event at this point.
}
ifconfig "$iface" up 2>/dev/null >/dev/null
ifconfig "$iface" ${macaddr:+hw ether "${macaddr}"} up 2>/dev/null >/dev/null
return 1
}
;;
@ -181,13 +238,7 @@ setup_interface_static() {
[ -z "$ip6addr" ] || $DEBUG ifconfig "$iface" add "$ip6addr"
[ -z "$gateway" ] || $DEBUG route add default gw "$gateway" dev "$iface"
[ -z "$ip6gw" ] || $DEBUG route -A inet6 add default gw "$ip6gw" dev "$iface"
[ -z "$dns" ] || {
for ns in $dns; do
grep "$ns" /tmp/resolv.conf.auto 2>/dev/null >/dev/null || {
echo "nameserver $ns" >> /tmp/resolv.conf.auto
}
done
}
[ -z "$dns" ] || add_dns "$config" $dns
config_get type "$config" TYPE
[ "$type" = "alias" ] && return 0
@ -204,6 +255,25 @@ setup_interface_alias() {
config_get cfg "$config" interface
[ "$parent" == "$cfg" ] || return 0
# parent device and ifname
local p_device p_type
config_get p_device "$cfg" device
config_get p_type "$cfg" type
# select alias ifname
local layer use_iface
config_get layer "$config" layer 2
case "$layer:$p_type" in
# layer 3: e.g. pppoe-wan or pptp-vpn
3:*) use_iface="$iface" ;;
# layer 2 and parent is bridge: e.g. br-wan
2:bridge) use_iface="br-$cfg" ;;
# layer 1: e.g. eth0 or ath0
*) use_iface="$p_device" ;;
esac
# alias counter
local ctr
config_get ctr "$parent" alias_count 0
@ -216,14 +286,14 @@ setup_interface_alias() {
append list "$config"
config_set "$parent" aliases "$list"
iface="$iface:$ctr"
set_interface_ifname "$config" "$iface"
use_iface="$use_iface:$ctr"
set_interface_ifname "$config" "$use_iface"
local proto
config_get proto "$config" proto "static"
case "${proto}" in
static)
setup_interface_static "$iface" "$config"
setup_interface_static "$use_iface" "$config"
;;
*)
echo "Unsupported type '$proto' for alias config '$config'"
@ -233,102 +303,110 @@ setup_interface_alias() {
}
setup_interface() {
local iface_main="$1"
local iface="$1"
local config="$2"
local proto="$3"
local vifmac="$4"
local ip6addr_main=
[ -n "$config" ] || {
config=$(find_config "$iface_main")
config=$(find_config "$iface")
[ "$?" = 0 ] || return 1
}
prepare_interface "$iface_main" "$config" "$vifmac" || return 0
prepare_interface "$iface" "$config" "$vifmac" || return 0
[ "$iface_main" = "br-$config" ] && {
[ "$iface" = "br-$config" ] && {
# need to bring up the bridge and wait a second for
# it to switch to the 'forwarding' state, otherwise
# it will lose its routes...
ifconfig "$iface_main" up
ifconfig "$iface" up
sleep 1
}
# Interface settings
grep "$iface_main:" /proc/net/dev > /dev/null && {
grep "$iface:" /proc/net/dev > /dev/null && {
local mtu macaddr
config_get mtu "$config" mtu
config_get macaddr "$config" macaddr
[ -n "$macaddr" ] && $DEBUG ifconfig "$iface_main" down
$DEBUG ifconfig "$iface_main" ${macaddr:+hw ether "$macaddr"} ${mtu:+mtu $mtu} up
[ -n "$macaddr" ] && $DEBUG ifconfig "$iface" down
$DEBUG ifconfig "$iface" ${macaddr:+hw ether "$macaddr"} ${mtu:+mtu $mtu} up
}
set_interface_ifname "$config" "$iface_main"
set_interface_ifname "$config" "$iface"
pidfile="/var/run/$iface_main.pid"
[ -n "$proto" ] || config_get proto "$config" proto
case "$proto" in
static)
config_get ip6addr_main "$config" ip6addr
setup_interface_static "$iface_main" "$config"
setup_interface_static "$iface" "$config"
;;
dhcp)
local lockfile="/var/lock/dhcp-$iface"
lock "$lockfile"
# prevent udhcpc from starting more than once
lock "/var/lock/dhcp-$iface_main"
local pidfile="/var/run/dhcp-${iface}.pid"
local pid="$(cat "$pidfile" 2>/dev/null)"
if [ -d "/proc/$pid" ] && grep udhcpc "/proc/${pid}/cmdline" >/dev/null 2>/dev/null; then
lock -u "/var/lock/dhcp-$iface_main"
if [ -d "/proc/$pid" ] && grep -qs udhcpc "/proc/${pid}/cmdline"; then
lock -u "$lockfile"
else
local ipaddr netmask hostname proto1 clientid
local ipaddr netmask hostname proto1 clientid broadcast
config_get ipaddr "$config" ipaddr
config_get netmask "$config" netmask
config_get hostname "$config" hostname
config_get proto1 "$config" proto
config_get clientid "$config" clientid
config_get_bool broadcast "$config" broadcast 0
[ -z "$ipaddr" ] || \
$DEBUG ifconfig "$iface_main" "$ipaddr" ${netmask:+netmask "$netmask"}
$DEBUG ifconfig "$iface" "$ipaddr" ${netmask:+netmask "$netmask"}
# don't stay running in background if dhcp is not the main proto on the interface (e.g. when using pptp)
local dhcpopts
[ ."$proto1" != ."$proto" ] && dhcpopts="-n -q"
$DEBUG eval udhcpc -t 0 -i "$iface_main" ${ipaddr:+-r $ipaddr} ${hostname:+-H $hostname} ${clientid:+-c $clientid} -b -p "$pidfile" ${dhcpopts:- -O rootpath -R &}
lock -u "/var/lock/dhcp-$iface_main"
[ "$broadcast" = 1 ] && broadcast="-O broadcast" || broadcast=
$DEBUG eval udhcpc -t 0 -i "$iface" \
${ipaddr:+-r $ipaddr} \
${hostname:+-H $hostname} \
${clientid:+-c $clientid} \
-b -p "$pidfile" $broadcast \
${dhcpopts:- -O rootpath -R &}
lock -u "$lockfile"
fi
;;
none)
setup_interface_none "$iface_main" "$config"
setup_interface_none "$iface" "$config"
;;
*)
if ( eval "type setup_interface_$proto" ) >/dev/null 2>/dev/null; then
eval "setup_interface_$proto '$iface_main' '$config' '$proto'"
eval "setup_interface_$proto '$iface' '$config' '$proto'"
else
echo "Interface type $proto not supported."
return 1
fi
;;
esac
[ "$proto" = none ] || {
for ifn in `ifconfig | grep "^$iface_main:" | awk '{print $1}'`; do
ifconfig "$ifn" down
done
}
local aliases
config_set "$config" aliases ""
config_set "$config" alias_count 0
config_foreach setup_interface_alias alias "$config" "$iface_main"
config_get aliases "$config" aliases
[ -z "$aliases" ] || uci_set_state network "$config" aliases "$aliases"
# put the ip6addr back to the beginning to become the main ip again
[ -z "$ip6addr_main" ] || {
$DEBUG ifconfig "$iface_main" del "$ip6addr_main"
$DEBUG ifconfig "$iface_main" add "$ip6addr_main"
}
}
stop_interface_dhcp() {
local config="$1"
local ifname
config_get ifname "$config" ifname
local lock="/var/lock/dhcp-${ifname}"
[ -f "$lock" ] && lock -u "$lock"
remove_dns "$config"
local pidfile="/var/run/dhcp-${ifname}.pid"
local pid="$(cat "$pidfile" 2>/dev/null)"
[ -d "/proc/$pid" ] && {
grep -qs udhcpc "/proc/$pid/cmdline" && kill -TERM $pid && \
while grep -qs udhcpc "/proc/$pid/cmdline"; do sleep 1; done
rm -f "$pidfile"
}
uci -P /var/state revert "network.$config"
}

View File

@ -29,28 +29,6 @@ config_get iface "$cfg" device
# call interface stop handler
( type "stop_interface_$proto" ) >/dev/null 2>/dev/null && eval "stop_interface_$proto '$cfg'"
# make sure all locks are removed
for lock in "/var/lock/dhcp-$iface" "/var/lock/ppp-$iface"; do
[ -f "$lock" ] && {
lock -u "$lock"
sleep 1
}
done
# kill active ppp daemon and other processes
config_get ifname "$cfg" ifname
pids="$(head -n1 -q /var/run/${ifname}.pid /var/run/ppp-${cfg}.pid 2>/dev/null)"
for pid in $pids; do
[ -d "/proc/$pid" ] && {
kill $pid
[ -d "/proc/$pid" ] && {
sleep 1
kill -9 $pid 2>/dev/null >/dev/null
}
}
done
rm -f /var/run/${ifname}.pid /var/run/ppp-${cfg}.pid
config_get ifname "$cfg" ifname
config_get device "$cfg" device
@ -62,6 +40,9 @@ done
config_get iftype "$cfg" type
[ "bridge" = "$iftype" ] && brctl delbr "$ifname" >/dev/null 2>/dev/null
# remove the interface's dns entries
remove_dns "$cfg"
# remove the interface's network state
uci_revert_state network "$1"

View File

@ -11,11 +11,6 @@ change_state () {
uci_set_state "$1" "$2" "$3" "$4"
}
uci_get() {
[ -n "$ifc" ] || return
uci -P /dev/null get "$1" 2>/dev/null
}
setup_interface () {
local old_ip
local old_broadcast
@ -144,21 +139,21 @@ setup_interface () {
}
# DNS
config_get old_dns "$ifc" dns
old_dns=$(uci_get_state network "$ifc" dns)
old_domain=$(uci_get_state network "$ifc" dnsdomain)
user_dns=$(uci_get "network.$ifc.dns")
[ -n "$user_dns" ] && dns="$user_dns"
[ -n "$dns" ] && [ ! -s "${RESOLV_CONF}" -o "$dns" != "$old_dns" ] && {
[ -n "$dns" ] && [ "$dns" != "$old_dns" -o -n "$user_dns" ] && {
echo "udhcpc: setting dns servers: $dns"
echo -n > "${RESOLV_CONF}.tmp"
for i in $dns ; do
echo "nameserver $i" >> "${RESOLV_CONF}.tmp"
done
${domain:+echo search $domain} >> "${RESOLV_CONF}.tmp"
mv "${RESOLV_CONF}.tmp" "$RESOLV_CONF"
add_dns "$ifc" $dns
change_state network "$ifc" dnsdomain "$domain"
change_state network "$ifc" dns "$dns"
[ -n "$domain" ] && [ "$domain" != "$old_domain" ] && {
echo "udhcpc: setting dns domain: $domain"
sed -i -e "${old_domain:+/^search $old_domain$/d; }/^search $domain$/d" "${RESOLV_CONF}"
echo "search $domain" >> "${RESOLV_CONF}"
change_state network "$ifc" dnsdomain "$domain"
}
}
[ -n "$ifc" ] || return

View File

@ -1,5 +1,5 @@
#
# Copyright (C) 2009 OpenWrt.org
# Copyright (C) 2009-2010 OpenWrt.org
# Copyright (C) 2010 Vertical Communications
#
# This is free software, licensed under the GNU General Public License v2.
@ -10,7 +10,7 @@ include $(TOPDIR)/rules.mk
PKG_NAME:=block-extroot
PKG_VERSION:=0.0.1
PKG_RELEASE:=1
PKG_RELEASE:=2
PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME)

View File

@ -1,5 +1,5 @@
#
# Copyright (C) 2006-2009 OpenWrt.org
# Copyright (C) 2006-2010 OpenWrt.org
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
include $(INCLUDE_DIR)/kernel.mk
PKG_NAME:=broadcom-diag
PKG_RELEASE:=6
PKG_RELEASE:=7
include $(INCLUDE_DIR)/package.mk

View File

@ -1,5 +1,5 @@
#
# Copyright (C) 2006-2009 OpenWrt.org
# Copyright (C) 2006-2010 OpenWrt.org
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
@ -10,7 +10,7 @@ include $(INCLUDE_DIR)/kernel.mk
PKG_NAME:=broadcom-wl
PKG_VERSION:=4.150.10.5.3
PKG_RELEASE:=6
PKG_RELEASE:=7
WLC_VERSION:=0.2
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2

View File

@ -3,7 +3,7 @@
START=50
start () {
loglevel=$(/sbin/uci get "system.@system[0].cronloglevel" 2>/dev/null)
loglevel=$(uci_get "system.@system[0].cronloglevel")
[ -z "$(ls /etc/crontabs/)" ] && exit 1
mkdir -p /var/spool/cron
ln -s /etc/crontabs /var/spool/cron/ 2>/dev/null

View File

@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
PKG_NAME:=comgt
PKG_VERSION:=0.32
PKG_RELEASE:=1
PKG_RELEASE:=3
PKG_SOURCE:=$(PKG_NAME).$(PKG_VERSION).tgz
PKG_SOURCE_URL:=@SF/comgt

View File

@ -6,15 +6,9 @@ config_get proto "$INTERFACE" proto
config_get iface "$INTERFACE" ifname
case "$ACTION" in
ifup)
iptables -I LAN_ACCEPT 1 -i "$iface" -j RETURN
iptables -A FORWARD -o "$iface" -j ACCEPT
iptables -t nat -A POSTROUTING -o "$iface" -j MASQUERADE
set_3g_led 1 1 0
;;
ifdown)
iptables -D LAN_ACCEPT -i "$iface" -j RETURN
iptables -D FORWARD -o "$iface" -j ACCEPT
iptables -t nat -D POSTROUTING -o "$iface" -j MASQUERADE
set_3g_led 0 0 0
;;
esac

View File

@ -9,8 +9,6 @@ set_3g_led() {
scan_3g() {
local device
scan_ppp "$@"
config_get device "$1" device
# try to figure out the device if it's invalid
@ -24,6 +22,7 @@ scan_3g() {
}
# enable 3G with the 3G button by default
local button
config_get button "$1" button
[ -z "$button" ] && {
config_set "$1" button 1
@ -31,6 +30,7 @@ scan_3g() {
}
stop_interface_3g() {
stop_interface_ppp "$1"
set_3g_led 0 0 0
killall gcom >/dev/null 2>/dev/null
}
@ -39,8 +39,11 @@ setup_interface_3g() {
local iface="$1"
local config="$2"
local chat="/etc/chatscripts/3g.chat"
local device
config_get device "$config" device
local maxwait
config_get maxwait "$config" maxwait
maxwait=${maxwait:-20}
while [ ! -e "$device" -a $maxwait -gt 0 ];do # wait for driver loading to catch up
@ -52,9 +55,16 @@ setup_interface_3g() {
/sbin/insmod $module 2>&- >&-
done
local apn
config_get apn "$config" apn
local service
config_get service "$config" service
local pincode
config_get pincode "$config" pincode
local mtu
config_get mtu "$config" mtu
set_3g_led 1 0 1
@ -80,7 +90,7 @@ setup_interface_3g() {
mode="AT_OPSYS=${CODE}"
fi
# Don't assume Option to be default as it breaks with Huawei Cards/Sticks
PINCODE="$pincode" gcom -d "$device" -s /etc/gcom/setpin.gcom || {
echo "$config(3g): Failed to set the PIN code."
set_3g_led 0 0 0

View File

@ -11,7 +11,7 @@ include $(INCLUDE_DIR)/kernel.mk
PKG_NAME:=compcache
PKG_VERSION:=0.6.2
PKG_RELEASE:=$(PKG_VERSION)-1
PKG_RELEASE:=1
PKG_SOURCE_URL:=http://compcache.googlecode.com/files/
PKG_MD5SUM:=27aec78dc50e34fb800c74e879057743

View File

@ -1,10 +1,9 @@
#
# Copyright (C) 2008 OpenWrt.org
# Copyright (C) 2008-2010 OpenWrt.org
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#
# $Id: $
include $(TOPDIR)/rules.mk
include $(INCLUDE_DIR)/kernel.mk

View File

@ -12,6 +12,7 @@ include $(INCLUDE_DIR)/kernel.mk
PKG_NAME:=ifxmips-dsl-api
PKG_BASE_NAME:=drv_dsl_cpe_api_danube
PKG_VERSION:=3.24.4.4
PKG_RELEASE:=1
PKG_SOURCE:=$(PKG_BASE_NAME)-$(PKG_VERSION).tar.gz
PKG_BUILD_DIR:=$(KERNEL_BUILD_DIR)/drv_dsl_cpe_api-$(PKG_VERSION)
PKG_SOURCE_URL:=http://mirror2.openwrt.org/sources/

View File

@ -11,6 +11,7 @@ include $(INCLUDE_DIR)/kernel.mk
PKG_BASE_NAME:=dsl_cpe_control_danube
PKG_VERSION:=3.24.4.4
PKG_RELEASE:=1
PKG_SOURCE:=$(PKG_BASE_NAME)-$(PKG_VERSION).tar.gz
PKG_BUILD_DIR:=$(BUILD_DIR)/dsl_cpe_control-$(PKG_VERSION)
PKG_SOURCE_URL:=http://mirror2.openwrt.org/sources/

View File

@ -1,10 +1,9 @@
#
# Copyright (C) 2009 OpenWrt.org
# Copyright (C) 2009-2010 OpenWrt.org
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#
# $Id: $
include $(TOPDIR)/rules.mk
include $(INCLUDE_DIR)/kernel.mk

View File

@ -236,7 +236,7 @@ $(call KernelPackage/ipt/Depends,)
FILES:= \
$(LINUX_DIR)/drivers/net/imq.$(LINUX_KMOD_SUFFIX) \
$(foreach mod,$(IPT_IMQ-m),$(LINUX_DIR)/net/$(mod).$(LINUX_KMOD_SUFFIX))
AUTOLOAD:=$(call AutoLoad,45,$(notdir \
AUTOLOAD:=$(call AutoLoad,46,$(notdir \
imq \
$(IPT_IMQ-m) \
))

View File

@ -10,12 +10,12 @@ include $(INCLUDE_DIR)/kernel.mk
PKG_NAME:=mac80211
PKG_VERSION:=2010-04-28
PKG_VERSION:=2010-05-24
PKG_RELEASE:=1
PKG_SOURCE_URL:=http://mirror2.openwrt.org/sources
# http://www.orbit-lab.org/kernel/compat-wireless-2.6/2010/11 \
# http://wireless.kernel.org/download/compat-wireless-2.6
PKG_MD5SUM:=4b8c23ac7f33af7556034635af744c67
PKG_MD5SUM:=3d465dc6e0213964d0349f61c485817f
PKG_SOURCE:=compat-wireless-$(PKG_VERSION).tar.bz2
PKG_BUILD_DIR:=$(KERNEL_BUILD_DIR)/compat-wireless-$(PKG_VERSION)
@ -550,7 +550,7 @@ endef
ifneq ($(CONFIG_B43_EXPERIMENTAL),)
PKG_B43_FWV4_NAME:=broadcom-wl
PKG_B43_FWV4_VERSION:=4.178.10.4
PKG_B43_FWV4_OBJECT:=$(PKG_B43_FWV4_NAME)-$(PKG_B43_FWV4_VERSION)/linux/wl.o
PKG_B43_FWV4_OBJECT:=$(PKG_B43_FWV4_NAME)-$(PKG_B43_FWV4_VERSION)/linux/wl_apsta.o
PKG_B43_FWV4_SOURCE:=$(PKG_B43_FWV4_NAME)-$(PKG_B43_FWV4_VERSION).tar.bz2
PKG_B43_FWV4_SOURCE_URL:=http://mirror2.openwrt.org/sources/
PKG_B43_FWV4_MD5SUM:=14477e8cbbb91b11896affac9b219fdb
@ -578,7 +578,7 @@ PKG_B43_FWV3_SOURCE:=$(PKG_B43_FWV3_NAME)-$(PKG_B43_FWV3_VERSION).o
PKG_B43_FWV3_SOURCE_URL:=http://downloads.openwrt.org/sources/
PKG_B43_FWV3_MD5SUM:=e08665c5c5b66beb9c3b2dd54aa80cb3
ifneq ($(CONFIG_B43_OPENFIRMWARE),)
ifeq ($(CONFIG_B43_OPENFIRMWARE),y)
PKG_B43_FWCUTTER_NAME:=b43-fwcutter
PKG_B43_FWCUTTER_VERSION:=3e69531aa65b8f664a0ab00dfc3e2eefeb0cb417
PKG_B43_FWCUTTER_SOURCE:=$(PKG_B43_FWCUTTER_NAME)-$(PKG_B43_FWCUTTER_VERSION).tar.bz2
@ -588,11 +588,11 @@ ifneq ($(CONFIG_B43_OPENFIRMWARE),)
PKG_B43_FWCUTTER_OBJECT:=$(PKG_B43_FWCUTTER_NAME)-$(PKG_B43_FWCUTTER_VERSION)/fwcutter/
else
PKG_B43_FWCUTTER_NAME:=b43-fwcutter
PKG_B43_FWCUTTER_VERSION:=012
PKG_B43_FWCUTTER_VERSION:=013
PKG_B43_FWCUTTER_SOURCE:=$(PKG_B43_FWCUTTER_NAME)-$(PKG_B43_FWCUTTER_VERSION).tar.bz2
PKG_B43_FWCUTTER_PROTO:=default
PKG_B43_FWCUTTER_SOURCE_URL:=http://bu3sch.de/b43/fwcutter/
PKG_B43_FWCUTTER_MD5SUM:=69eadf67b459f313a8d6b37aaabef96c
PKG_B43_FWCUTTER_MD5SUM:=3547ec6c474ac1bc2c4a5bb765b791a4
PKG_B43_FWCUTTER_SUBDIR:=b43-fwcutter-$(PKG_B43_FWCUTTER_VERSION)
PKG_B43_FWCUTTER_OBJECT:=$(PKG_B43_FWCUTTER_NAME)-$(PKG_B43_FWCUTTER_VERSION)/
endif
@ -644,7 +644,7 @@ define KernelPackage/b43/config
choice
prompt "b43 firmware version"
default B43_EXPERIMENTAL
default B43_STABLE
help
This option allows you to select the version of the b43 firmware.
@ -773,14 +773,13 @@ endef
BUILDFLAGS:= \
-I$(PKG_BUILD_DIR)/include \
$(foreach opt,$(CONFOPTS),-DCONFIG_$(opt)) \
$(if $(CONFIG_PCI),-DCONFIG_B43_PCI_AUTOSELECT -DCONFIG_B43_PCICORE_AUTOSELECT -DCONFIG_SSB_DRIVER_PCICORE_POSSIBLE -DCONFIG_SSB_DRIVER_PCICORE) \
$(if $(CONFIG_PCI),-DCONFIG_SSB_PCIHOST_POSSIBLE -DCONFIG_SSB_PCIHOST) \
$(if $(CONFIG_PCI),-DCONFIG_SSB_SPROM) \
$(if $(CONFIG_PCI),-DCONFIG_B43_PCI_AUTOSELECT -DCONFIG_B43_PCICORE_AUTOSELECT) \
$(if $(CONFIG_LEDS_TRIGGERS), -DCONFIG_MAC80211_LEDS -DCONFIG_LEDS_TRIGGERS -DCONFIG_B43_LEDS -DCONFIG_B43LEGACY_LEDS -DCONFIG_AR9170_LEDS) \
-DCONFIG_B43_HWRNG -DCONFIG_B43LEGACY_HWRNG \
$(if $(CONFIG_PACKAGE_MAC80211_DEBUGFS),-DCONFIG_MAC80211_DEBUGFS -DCONFIG_ATH9K_DEBUGFS) \
$(if $(CONFIG_PACKAGE_ATH_DEBUG),-DCONFIG_ATH_DEBUG) \
-D__CONFIG_MAC80211_RC_DEFAULT=minstrel \
-DCONFIG_MAC80211_RC_MINSTREL_HT \
$(if $(CONFIG_ATH_USER_REGD),-DATH_USER_REGD=1) \
$(if $(CONFIG_PACKAGE_ATH9K_USE_MINSTREL),-DATH9K_USE_MINSTREL) \
$(if $(CONFIG_PACKAGE_RT2X00_LIB_DEBUGFS),-DCONFIG_RT2X00_LIB_DEBUGFS) \
@ -808,10 +807,6 @@ MAKE_OPTS:= \
CONFIG_B43_PCMCIA=n CONFIG_B43_PIO=n \
CONFIG_B43_PCI_AUTOSELECT=$(if $(CONFIG_PCI),y) \
CONFIG_B43_PCICORE_AUTOSELECT=$(if $(CONFIG_PCI),y) \
CONFIG_SSB_DRIVER_PCICORE_POSSIBLE=$(if $(CONFIG_PCI),y) \
CONFIG_SSB_DRIVER_PCICORE=$(if $(CONFIG_PCI),y) \
CONFIG_SSB_PCIHOST_POSSIBLE=$(if $(CONFIG_PCI),y) \
CONFIG_SSB_PCIHOST=$(if $(CONFIG_PCI),y) \
CONFIG_B43LEGACY_LEDS=$(CONFIG_LEDS_TRIGGERS) \
CONFIG_B43_LEDS=$(CONFIG_LEDS_TRIGGERS) \
CONFIG_B43_HWRNG=$(if $(CONFIG_HW_RANDOM),y) \
@ -883,6 +878,7 @@ MAKE_OPTS:= \
CONFIG_AR9170_LEDS=$(CONFIG_LEDS_TRIGGERS) \
CONFIG_IWM= \
CONFIG_ATH9K_HTC= \
CONFIG_MAC80211_RC_MINSTREL_HT=y \
MADWIFI= \
OLD_IWL= \
KLIB_BUILD="$(LINUX_DIR)" \
@ -993,7 +989,7 @@ define Build/b43-common
$(MAKE) -C "$(PKG_BUILD_DIR)/$(PKG_B43_FWCUTTER_OBJECT)" \
CFLAGS="-I$(STAGING_DIR_HOST)/include -include endian.h"
$(INSTALL_BIN) $(PKG_BUILD_DIR)/$(PKG_B43_FWCUTTER_OBJECT)/b43-fwcutter $(STAGING_DIR_HOST)/bin/
ifneq ($(CONFIG_B43_OPENFIRMWARE),)
ifeq ($(CONFIG_B43_OPENFIRMWARE),y)
$(INSTALL_DIR) $(STAGING_DIR_HOST)/bin/
$(MAKE) -C "$(PKG_BUILD_DIR)/$(PKG_B43_FWCUTTER_SUBDIR)/assembler/"
$(INSTALL_BIN) $(PKG_BUILD_DIR)/$(PKG_B43_FWCUTTER_SUBDIR)/assembler/b43-asm $(STAGING_DIR_HOST)/bin/
@ -1005,20 +1001,20 @@ endef
define KernelPackage/b43/install
rm -rf $(1)/lib/firmware/
$(call Build/b43-common)
ifneq ($(CONFIG_B43_OPENFIRMWARE),)
ifeq ($(CONFIG_B43_OPENFIRMWARE),y)
tar xzf "$(DL_DIR)/$(PKG_B43_FWV4_SOURCE)" -C "$(PKG_BUILD_DIR)"
else
tar xjf "$(DL_DIR)/$(PKG_B43_FWV4_SOURCE)" -C "$(PKG_BUILD_DIR)"
endif
$(INSTALL_DIR) $(1)/lib/firmware/
ifneq ($(CONFIG_B43_OPENFIRMWARE),)
ifeq ($(CONFIG_B43_OPENFIRMWARE),y)
$(MAKE) -C "$(PKG_BUILD_DIR)/$(PKG_B43_FWV4_OBJECT)/"
$(INSTALL_DIR) $(1)/lib/firmware/b43-open/
$(INSTALL_DATA) $(PKG_BUILD_DIR)/$(PKG_B43_FWV4_OBJECT)/ucode5.fw $(1)/lib/firmware/b43-open/ucode5.fw
$(INSTALL_DATA) $(PKG_BUILD_DIR)/$(PKG_B43_FWV4_OBJECT)/b0g0bsinitvals5.fw $(1)/lib/firmware/b43-open/b0g0bsinitvals5.fw
$(INSTALL_DATA) $(PKG_BUILD_DIR)/$(PKG_B43_FWV4_OBJECT)/b0g0initvals5.fw $(1)/lib/firmware/b43-open/b0g0initvals5.fw
else
b43-fwcutter --unsupported -w $(1)/lib/firmware/ $(PKG_BUILD_DIR)/$(PKG_B43_FWV4_OBJECT)
b43-fwcutter -w $(1)/lib/firmware/ $(PKG_BUILD_DIR)/$(PKG_B43_FWV4_OBJECT)
endif
ifneq ($(CONFIG_B43_FW_SQUASH),)
b43-fwsquash.py "$(CONFIG_B43_FW_SQUASH_PHYTYPES)" "$(CONFIG_B43_FW_SQUASH_COREREVS)" "$(1)/lib/firmware/b43"

View File

@ -9,7 +9,7 @@
ifeq ($(CONFIG_MAC80211),y)
$(error "ERROR: you have MAC80211 compiled into the kernel, CONFIG_MAC80211=y, as such you cannot replace its mac80211 driver. You need this set to CONFIG_MAC80211=m. If you are using Fedora upgrade your kernel as later version should this set as modular. For further information on Fedora see https://bugzilla.redhat.com/show_bug.cgi?id=470143. If you are using your own kernel recompile it and make mac80211 modular")
@@ -481,8 +481,8 @@ endif
@@ -483,8 +483,8 @@ endif
# We need the backported rfkill module on kernel < 2.6.31.
# In more recent kernel versions use the in kernel rfkill module.
ifdef CONFIG_COMPAT_KERNEL_31

View File

@ -1,6 +1,6 @@
--- a/Makefile
+++ b/Makefile
@@ -28,7 +28,7 @@ obj-$(CONFIG_COMPAT_WIRELESS_MODULES) +=
@@ -30,7 +30,7 @@ obj-$(CONFIG_COMPAT_WIRELESS_MODULES) +=
obj-$(CONFIG_COMPAT_NET_USB_MODULES) += drivers/net/usb/
obj-$(CONFIG_COMPAT_NETWORK_MODULES) += drivers/net/
@ -9,3 +9,43 @@
endif
obj-$(CONFIG_COMPAT_BLUETOOTH) += net/bluetooth/
--- a/config.mk
+++ b/config.mk
@@ -9,7 +9,6 @@ ifeq ($(wildcard $(KLIB_BUILD)/.config),
CONFIG_PCI=y
CONFIG_USB=y
CONFIG_PCMCIA=y
- CONFIG_SSB=m
else
include $(KLIB_BUILD)/.config
endif
@@ -239,21 +238,6 @@ CONFIG_IPW2200_QOS=y
#
# % echo 1 > /sys/bus/pci/drivers/ipw2200/*/rtap_iface
-ifneq ($(CONFIG_SSB),)
-# Sonics Silicon Backplane
-CONFIG_SSB_SPROM=y
-# CONFIG_SSB_DEBUG=y
-
-CONFIG_SSB_BLOCKIO=y
-CONFIG_SSB_PCIHOST=y
-CONFIG_SSB_B43_PCI_BRIDGE=y
-ifneq ($(CONFIG_PCMCIA),)
-CONFIG_SSB_PCMCIAHOST=y
-endif
-# CONFIG_SSB_DEBUG=y
-CONFIG_SSB_DRIVER_PCICORE=y
-endif
-
CONFIG_P54_PCI=m
# CONFIG_B44=m
@@ -413,7 +397,6 @@ endif # end of SPI driver list
ifneq ($(CONFIG_MMC),)
-CONFIG_SSB_SDIOHOST=y
CONFIG_B43_SDIO=y
CONFIG_WL1251_SDIO=m

View File

@ -1,6 +1,6 @@
--- a/config.mk
+++ b/config.mk
@@ -286,10 +286,10 @@ endif
@@ -270,10 +270,10 @@ endif
CONFIG_MWL8K=m
# Ethernet drivers go here
@ -15,7 +15,7 @@
CONFIG_HERMES=m
CONFIG_HERMES_CACHE_FW_ON_INIT=y
@@ -342,10 +342,10 @@ CONFIG_USB_NET_COMPAT_RNDIS_HOST=n
@@ -326,10 +326,10 @@ CONFIG_USB_NET_COMPAT_RNDIS_HOST=n
CONFIG_USB_NET_COMPAT_RNDIS_WLAN=n
CONFIG_USB_NET_COMPAT_CDCETHER=n
else

View File

@ -1,6 +1,6 @@
--- a/config.mk
+++ b/config.mk
@@ -43,21 +43,6 @@ $(error "ERROR: Your 2.6.27 kernel has C
@@ -42,21 +42,6 @@ $(error "ERROR: Your 2.6.27 kernel has C
endif
endif

View File

@ -6,10 +6,10 @@
CONFIG_USB=y
- CONFIG_PCMCIA=y
+# CONFIG_PCMCIA=y
CONFIG_SSB=m
else
include $(KLIB_BUILD)/.config
@@ -181,7 +181,7 @@ CONFIG_B43=m
endif
@@ -180,7 +180,7 @@ CONFIG_B43=m
CONFIG_B43_HWRNG=y
CONFIG_B43_PCI_AUTOSELECT=y
ifneq ($(CONFIG_PCMCIA),)
@ -18,12 +18,3 @@
endif
CONFIG_B43_LEDS=y
CONFIG_B43_PHY_LP=y
@@ -233,7 +233,7 @@ CONFIG_SSB_BLOCKIO=y
CONFIG_SSB_PCIHOST=y
CONFIG_SSB_B43_PCI_BRIDGE=y
ifneq ($(CONFIG_PCMCIA),)
-CONFIG_SSB_PCMCIAHOST=y
+# CONFIG_SSB_PCMCIAHOST=y
endif
# CONFIG_SSB_DEBUG=y
CONFIG_SSB_DRIVER_PCICORE=y

View File

@ -1,12 +1,10 @@
--- a/config.mk
+++ b/config.mk
@@ -396,8 +396,8 @@ endif # end of SPI driver list
@@ -382,7 +382,7 @@ endif # end of SPI driver list
ifneq ($(CONFIG_MMC),)
-CONFIG_SSB_SDIOHOST=y
-CONFIG_B43_SDIO=y
+# CONFIG_SSB_SDIOHOST=y
+# CONFIG_B43_SDIO=y
CONFIG_WL1251_SDIO=m

View File

@ -1,6 +1,6 @@
--- a/config.mk
+++ b/config.mk
@@ -185,7 +185,7 @@ ifneq ($(CONFIG_PCMCIA),)
@@ -184,7 +184,7 @@ ifneq ($(CONFIG_PCMCIA),)
endif
CONFIG_B43_LEDS=y
CONFIG_B43_PHY_LP=y

View File

@ -1,6 +1,6 @@
--- a/config.mk
+++ b/config.mk
@@ -248,12 +248,12 @@ CONFIG_RTL8180=m
@@ -232,12 +232,12 @@ CONFIG_RTL8180=m
CONFIG_ADM8211=m
@ -15,7 +15,7 @@
# CONFIG_RT2800PCI_RT30XX=y
# CONFIG_RT2800PCI_RT35XX=y
# CONFIG_RT2800PCI_SOC=y
@@ -355,7 +355,7 @@ CONFIG_RT2800USB=m
@@ -339,7 +339,7 @@ CONFIG_RT2800USB=m
# CONFIG_RT2800USB_RT35XX=y
# CONFIG_RT2800USB_UNKNOWN=y
endif

View File

@ -53,7 +53,7 @@
#include <pcmcia/cs_types.h>
#include <pcmcia/cistpl.h>
#include <pcmcia/ds.h>
@@ -70,9 +70,9 @@ static inline struct sk_buff *netdev_all
@@ -67,9 +67,9 @@ static inline struct sk_buff *netdev_all
return skb;
}

View File

@ -11,8 +11,8 @@
{
--- a/compat/compat-2.6.29.c
+++ b/compat/compat-2.6.29.c
@@ -16,7 +16,7 @@
#include <linux/etherdevice.h>
@@ -50,7 +50,7 @@ void netdev_attach_ops(struct net_device
EXPORT_SYMBOL(netdev_attach_ops);
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,23))
-#if defined(CONFIG_USB) || defined(CONFIG_USB_MODULE)

View File

@ -1,11 +0,0 @@
--- a/include/linux/compat-2.6.34.h
+++ b/include/linux/compat-2.6.34.h
@@ -197,6 +197,8 @@ do { \
*/
#define sysfs_bin_attr_init(bin_attr) sysfs_attr_init(&(bin_attr)->attr)
+#define rcu_dereference_check(p, c) rcu_dereference(p)
+
#endif /* (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,34)) */
#endif /* LINUX_26_34_COMPAT_H */

View File

@ -1,11 +0,0 @@
--- a/include/linux/tracepoint.h
+++ b/include/linux/tracepoint.h
@@ -3,6 +3,8 @@
#include <linux/version.h>
+#include <linux/version.h>
+
#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,27))
#include_next <linux/tracepoint.h>
#endif /* (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,27)) */

View File

@ -1,6 +1,6 @@
--- a/drivers/net/wireless/ath/ath5k/reset.c
+++ b/drivers/net/wireless/ath/ath5k/reset.c
@@ -1377,10 +1377,18 @@ int ath5k_hw_reset(struct ath5k_hw *ah,
@@ -1374,10 +1374,18 @@ int ath5k_hw_reset(struct ath5k_hw *ah,
* guess we can tweak it and see how it goes ;-)
*/
if (ah->ah_version != AR5K_AR5210) {

View File

@ -10,7 +10,7 @@
#include "regd_common.h"
/*
@@ -588,3 +591,5 @@ u32 ath_regd_get_band_ctl(struct ath_reg
@@ -587,3 +590,5 @@ u32 ath_regd_get_band_ctl(struct ath_reg
}
}
EXPORT_SYMBOL(ath_regd_get_band_ctl);

View File

@ -8,7 +8,7 @@
#include "ath9k.h"
static DEFINE_PCI_DEVICE_TABLE(ath_pci_id_table) = {
@@ -53,21 +54,36 @@ static void ath_pci_read_cachesize(struc
@@ -52,21 +53,36 @@ static void ath_pci_read_cachesize(struc
static bool ath_pci_eeprom_read(struct ath_common *common, u32 off, u16 *data)
{

View File

@ -1,6 +1,6 @@
--- a/drivers/net/wireless/ath/ath9k/hw.c
+++ b/drivers/net/wireless/ath/ath9k/hw.c
@@ -1380,7 +1380,7 @@ int ath9k_hw_reset(struct ath_hw *ah, st
@@ -1400,7 +1400,7 @@ int ath9k_hw_reset(struct ath_hw *ah, st
if (ah->config.rx_intr_mitigation) {
REG_RMW_FIELD(ah, AR_RIMT, AR_RIMT_LAST, 500);

View File

@ -1,130 +0,0 @@
--- a/drivers/net/wireless/ath/ath9k/debug.c
+++ b/drivers/net/wireless/ath/ath9k/debug.c
@@ -78,6 +78,90 @@ static const struct file_operations fops
#define DMA_BUF_LEN 1024
+static ssize_t read_file_tx_chainmask(struct file *file, char __user *user_buf,
+ size_t count, loff_t *ppos)
+{
+ struct ath_softc *sc = file->private_data;
+ struct ath_common *common = ath9k_hw_common(sc->sc_ah);
+ char buf[32];
+ unsigned int len;
+
+ len = snprintf(buf, sizeof(buf), "0x%08x\n", common->tx_chainmask);
+ return simple_read_from_buffer(user_buf, count, ppos, buf, len);
+}
+
+static ssize_t write_file_tx_chainmask(struct file *file, const char __user *user_buf,
+ size_t count, loff_t *ppos)
+{
+ struct ath_softc *sc = file->private_data;
+ struct ath_common *common = ath9k_hw_common(sc->sc_ah);
+ unsigned long mask;
+ char buf[32];
+ ssize_t len;
+
+ len = min(count, sizeof(buf) - 1);
+ if (copy_from_user(buf, user_buf, len))
+ return -EINVAL;
+
+ buf[len] = '\0';
+ if (strict_strtoul(buf, 0, &mask))
+ return -EINVAL;
+
+ common->tx_chainmask = mask;
+ sc->sc_ah->caps.tx_chainmask = mask;
+ return count;
+}
+
+static const struct file_operations fops_tx_chainmask = {
+ .read = read_file_tx_chainmask,
+ .write = write_file_tx_chainmask,
+ .open = ath9k_debugfs_open,
+ .owner = THIS_MODULE
+};
+
+
+static ssize_t read_file_rx_chainmask(struct file *file, char __user *user_buf,
+ size_t count, loff_t *ppos)
+{
+ struct ath_softc *sc = file->private_data;
+ struct ath_common *common = ath9k_hw_common(sc->sc_ah);
+ char buf[32];
+ unsigned int len;
+
+ len = snprintf(buf, sizeof(buf), "0x%08x\n", common->rx_chainmask);
+ return simple_read_from_buffer(user_buf, count, ppos, buf, len);
+}
+
+static ssize_t write_file_rx_chainmask(struct file *file, const char __user *user_buf,
+ size_t count, loff_t *ppos)
+{
+ struct ath_softc *sc = file->private_data;
+ struct ath_common *common = ath9k_hw_common(sc->sc_ah);
+ unsigned long mask;
+ char buf[32];
+ ssize_t len;
+
+ len = min(count, sizeof(buf) - 1);
+ if (copy_from_user(buf, user_buf, len))
+ return -EINVAL;
+
+ buf[len] = '\0';
+ if (strict_strtoul(buf, 0, &mask))
+ return -EINVAL;
+
+ common->rx_chainmask = mask;
+ sc->sc_ah->caps.rx_chainmask = mask;
+ return count;
+}
+
+static const struct file_operations fops_rx_chainmask = {
+ .read = read_file_rx_chainmask,
+ .write = write_file_rx_chainmask,
+ .open = ath9k_debugfs_open,
+ .owner = THIS_MODULE
+};
+
+
static ssize_t read_file_dma(struct file *file, char __user *user_buf,
size_t count, loff_t *ppos)
{
@@ -731,6 +815,16 @@ int ath9k_init_debug(struct ath_hw *ah)
goto err;
#endif
+ sc->debug.debugfs_rx_chainmask = debugfs_create_file("rx_chainmask",
+ S_IRUSR | S_IWUSR, sc->debug.debugfs_phy, sc, &fops_rx_chainmask);
+ if (!sc->debug.debugfs_rx_chainmask)
+ goto err;
+
+ sc->debug.debugfs_tx_chainmask = debugfs_create_file("tx_chainmask",
+ S_IRUSR | S_IWUSR, sc->debug.debugfs_phy, sc, &fops_tx_chainmask);
+ if (!sc->debug.debugfs_tx_chainmask)
+ goto err;
+
sc->debug.debugfs_dma = debugfs_create_file("dma", S_IRUSR,
sc->debug.debugfs_phy, sc, &fops_dma);
if (!sc->debug.debugfs_dma)
@@ -781,6 +875,8 @@ void ath9k_exit_debug(struct ath_hw *ah)
struct ath_common *common = ath9k_hw_common(ah);
struct ath_softc *sc = (struct ath_softc *) common->priv;
+ debugfs_remove(sc->debug.debugfs_tx_chainmask);
+ debugfs_remove(sc->debug.debugfs_rx_chainmask);
debugfs_remove(sc->debug.debugfs_recv);
debugfs_remove(sc->debug.debugfs_xmit);
debugfs_remove(sc->debug.debugfs_wiphy);
--- a/drivers/net/wireless/ath/ath9k/debug.h
+++ b/drivers/net/wireless/ath/ath9k/debug.h
@@ -152,6 +152,8 @@ struct ath_stats {
};
struct ath9k_debug {
+ struct dentry *debugfs_rx_chainmask;
+ struct dentry *debugfs_tx_chainmask;
struct dentry *debugfs_phy;
struct dentry *debugfs_debug;
struct dentry *debugfs_dma;

File diff suppressed because it is too large Load Diff

View File

@ -1,128 +0,0 @@
--- a/drivers/net/wireless/ath/ath9k/debug.c
+++ b/drivers/net/wireless/ath/ath9k/debug.c
@@ -795,6 +795,86 @@ static const struct file_operations fops
.owner = THIS_MODULE
};
+static ssize_t read_file_regidx(struct file *file, char __user *user_buf,
+ size_t count, loff_t *ppos)
+{
+ struct ath_softc *sc = file->private_data;
+ char buf[32];
+ unsigned int len;
+
+ len = snprintf(buf, sizeof(buf), "0x%08x\n", sc->debug.regidx);
+ return simple_read_from_buffer(user_buf, count, ppos, buf, len);
+}
+
+static ssize_t write_file_regidx(struct file *file, const char __user *user_buf,
+ size_t count, loff_t *ppos)
+{
+ struct ath_softc *sc = file->private_data;
+ unsigned long regidx;
+ char buf[32];
+ ssize_t len;
+
+ len = min(count, sizeof(buf) - 1);
+ if (copy_from_user(buf, user_buf, len))
+ return -EINVAL;
+
+ buf[len] = '\0';
+ if (strict_strtoul(buf, 0, &regidx))
+ return -EINVAL;
+
+ sc->debug.regidx = regidx;
+ return count;
+}
+
+static const struct file_operations fops_regidx = {
+ .read = read_file_regidx,
+ .write = write_file_regidx,
+ .open = ath9k_debugfs_open,
+ .owner = THIS_MODULE
+};
+
+static ssize_t read_file_regval(struct file *file, char __user *user_buf,
+ size_t count, loff_t *ppos)
+{
+ struct ath_softc *sc = file->private_data;
+ struct ath_hw *ah = sc->sc_ah;
+ char buf[32];
+ unsigned int len;
+ u32 regval;
+
+ regval = REG_READ_D(ah, sc->debug.regidx);
+ len = snprintf(buf, sizeof(buf), "0x%08x\n", regval);
+ return simple_read_from_buffer(user_buf, count, ppos, buf, len);
+}
+
+static ssize_t write_file_regval(struct file *file, const char __user *user_buf,
+ size_t count, loff_t *ppos)
+{
+ struct ath_softc *sc = file->private_data;
+ struct ath_hw *ah = sc->sc_ah;
+ unsigned long regval;
+ char buf[32];
+ ssize_t len;
+
+ len = min(count, sizeof(buf) - 1);
+ if (copy_from_user(buf, user_buf, len))
+ return -EINVAL;
+
+ buf[len] = '\0';
+ if (strict_strtoul(buf, 0, &regval))
+ return -EINVAL;
+
+ REG_WRITE_D(ah, sc->debug.regidx, regval);
+ return count;
+}
+
+static const struct file_operations fops_regval = {
+ .read = read_file_regval,
+ .write = write_file_regval,
+ .open = ath9k_debugfs_open,
+ .owner = THIS_MODULE
+};
+
int ath9k_init_debug(struct ath_hw *ah)
{
struct ath_common *common = ath9k_hw_common(ah);
@@ -864,6 +944,17 @@ int ath9k_init_debug(struct ath_hw *ah)
if (!sc->debug.debugfs_recv)
goto err;
+ sc->debug.regidx = 0;
+ sc->debug.debugfs_regidx = debugfs_create_file("regidx",
+ S_IRUSR|S_IWUSR, sc->debug.debugfs_phy, sc, &fops_regidx);
+ if (!sc->debug.debugfs_regidx)
+ goto err;
+
+ sc->debug.debugfs_regval = debugfs_create_file("regval",
+ S_IRUSR|S_IWUSR, sc->debug.debugfs_phy, sc, &fops_regval);
+ if (!sc->debug.debugfs_regval)
+ goto err;
+
return 0;
err:
ath9k_exit_debug(ah);
@@ -877,6 +968,8 @@ void ath9k_exit_debug(struct ath_hw *ah)
debugfs_remove(sc->debug.debugfs_tx_chainmask);
debugfs_remove(sc->debug.debugfs_rx_chainmask);
+ debugfs_remove(sc->debug.debugfs_regval);
+ debugfs_remove(sc->debug.debugfs_regidx);
debugfs_remove(sc->debug.debugfs_recv);
debugfs_remove(sc->debug.debugfs_xmit);
debugfs_remove(sc->debug.debugfs_wiphy);
--- a/drivers/net/wireless/ath/ath9k/debug.h
+++ b/drivers/net/wireless/ath/ath9k/debug.h
@@ -162,6 +162,9 @@ struct ath9k_debug {
struct dentry *debugfs_wiphy;
struct dentry *debugfs_xmit;
struct dentry *debugfs_recv;
+ struct dentry *debugfs_regidx;
+ struct dentry *debugfs_regval;
+ u32 regidx;
struct ath_stats stats;
};

View File

@ -1,6 +1,6 @@
--- a/drivers/net/wireless/ath/ath9k/init.c
+++ b/drivers/net/wireless/ath/ath9k/init.c
@@ -686,7 +686,11 @@ void ath9k_set_hw_capab(struct ath_softc
@@ -689,7 +689,11 @@ void ath9k_set_hw_capab(struct ath_softc
hw->sta_data_size = sizeof(struct ath_node);
hw->vif_data_size = sizeof(struct ath_vif);

View File

@ -0,0 +1,36 @@
--- a/drivers/net/wireless/ath/ath9k/hw.c
+++ b/drivers/net/wireless/ath/ath9k/hw.c
@@ -1497,6 +1497,7 @@ EXPORT_SYMBOL(ath9k_hw_keyreset);
bool ath9k_hw_keysetmac(struct ath_hw *ah, u16 entry, const u8 *mac)
{
u32 macHi, macLo;
+ u32 unicast_flag = AR_KEYTABLE_VALID;
if (entry >= ah->caps.keycache_size) {
ath_print(ath9k_hw_common(ah), ATH_DBG_FATAL,
@@ -1505,6 +1506,16 @@ bool ath9k_hw_keysetmac(struct ath_hw *a
}
if (mac != NULL) {
+ /*
+ * AR_KEYTABLE_VALID indicates that the address is a unicast
+ * address, which must match the transmitter address for
+ * decrypting frames.
+ * Not setting this bit allows the hardware to use the key
+ * for multicast frame decryption.
+ */
+ if (mac[0] & 0x01)
+ unicast_flag = 0;
+
macHi = (mac[5] << 8) | mac[4];
macLo = (mac[3] << 24) |
(mac[2] << 16) |
@@ -1517,7 +1528,7 @@ bool ath9k_hw_keysetmac(struct ath_hw *a
macLo = macHi = 0;
}
REG_WRITE(ah, AR_KEYTABLE_MAC0(entry), macLo);
- REG_WRITE(ah, AR_KEYTABLE_MAC1(entry), macHi | AR_KEYTABLE_VALID);
+ REG_WRITE(ah, AR_KEYTABLE_MAC1(entry), macHi | unicast_flag);
return true;
}

View File

@ -1,34 +0,0 @@
--- a/net/wireless/core.h
+++ b/net/wireless/core.h
@@ -76,6 +76,7 @@ struct cfg80211_registered_device {
/* current channel */
struct ieee80211_channel *channel;
+ enum nl80211_channel_type channel_type;
/* must be last because of the way we do wiphy_priv(),
* and it should at least be aligned to NETDEV_ALIGN */
--- a/net/wireless/chan.c
+++ b/net/wireless/chan.c
@@ -97,6 +97,7 @@ int rdev_set_freq(struct cfg80211_regist
return result;
rdev->channel = chan;
+ rdev->channel_type = channel_type;
return 0;
}
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -887,6 +887,11 @@ static int nl80211_send_iface(struct sk_
NLA_PUT_U32(msg, NL80211_ATTR_WIPHY, rdev->wiphy_idx);
NLA_PUT_STRING(msg, NL80211_ATTR_IFNAME, dev->name);
NLA_PUT_U32(msg, NL80211_ATTR_IFTYPE, dev->ieee80211_ptr->iftype);
+ if (rdev->channel) {
+ NLA_PUT_U32(msg, NL80211_ATTR_WIPHY_FREQ, rdev->channel->center_freq);
+ NLA_PUT_U32(msg, NL80211_ATTR_WIPHY_CHANNEL_TYPE, rdev->channel_type);
+ }
+
NLA_PUT_U32(msg, NL80211_ATTR_GENERATION,
rdev->devlist_generation ^

View File

@ -0,0 +1,72 @@
--- a/drivers/net/wireless/ath/ath9k/common.c
+++ b/drivers/net/wireless/ath/ath9k/common.c
@@ -211,10 +211,14 @@ static int ath_reserve_key_cache_slot_tk
return -1;
}
-static int ath_reserve_key_cache_slot(struct ath_common *common)
+static int ath_reserve_key_cache_slot(struct ath_common *common,
+ enum ieee80211_key_alg alg)
{
int i;
+ if (alg == ALG_TKIP)
+ return ath_reserve_key_cache_slot_tkip(common);
+
/* First, try to find slots that would not be available for TKIP. */
if (common->splitmic) {
for (i = IEEE80211_WEP_NKID; i < common->keymax / 4; i++) {
@@ -283,6 +287,7 @@ int ath9k_cmn_key_config(struct ath_comm
struct ath_hw *ah = common->ah;
struct ath9k_keyval hk;
const u8 *mac = NULL;
+ u8 gmac[ETH_ALEN];
int ret = 0;
int idx;
@@ -306,9 +311,23 @@ int ath9k_cmn_key_config(struct ath_comm
memcpy(hk.kv_val, key->key, key->keylen);
if (!(key->flags & IEEE80211_KEY_FLAG_PAIRWISE)) {
- /* For now, use the default keys for broadcast keys. This may
- * need to change with virtual interfaces. */
- idx = key->keyidx;
+ switch (vif->type) {
+ case NL80211_IFTYPE_AP:
+ memcpy(gmac, vif->addr, ETH_ALEN);
+ gmac[0] |= 0x01;
+ mac = gmac;
+ idx = ath_reserve_key_cache_slot(common, key->alg);
+ break;
+ case NL80211_IFTYPE_ADHOC:
+ memcpy(gmac, sta->addr, ETH_ALEN);
+ gmac[0] |= 0x01;
+ mac = gmac;
+ idx = ath_reserve_key_cache_slot(common, key->alg);
+ break;
+ default:
+ idx = key->keyidx;
+ break;
+ }
} else if (key->keyidx) {
if (WARN_ON(!sta))
return -EOPNOTSUPP;
@@ -325,14 +344,12 @@ int ath9k_cmn_key_config(struct ath_comm
return -EOPNOTSUPP;
mac = sta->addr;
- if (key->alg == ALG_TKIP)
- idx = ath_reserve_key_cache_slot_tkip(common);
- else
- idx = ath_reserve_key_cache_slot(common);
- if (idx < 0)
- return -ENOSPC; /* no free key cache entries */
+ idx = ath_reserve_key_cache_slot(common, key->alg);
}
+ if (idx < 0)
+ return -ENOSPC; /* no free key cache entries */
+
if (key->alg == ALG_TKIP)
ret = ath_setkey_tkip(common, idx, key->key, &hk, mac,
vif->type == NL80211_IFTYPE_AP);

View File

@ -0,0 +1,255 @@
--- a/drivers/net/wireless/ath/ath9k/main.c
+++ b/drivers/net/wireless/ath/ath9k/main.c
@@ -622,234 +622,6 @@ static u32 ath_get_extchanmode(struct at
return chanmode;
}
-static int ath_setkey_tkip(struct ath_common *common, u16 keyix, const u8 *key,
- struct ath9k_keyval *hk, const u8 *addr,
- bool authenticator)
-{
- struct ath_hw *ah = common->ah;
- const u8 *key_rxmic;
- const u8 *key_txmic;
-
- key_txmic = key + NL80211_TKIP_DATA_OFFSET_TX_MIC_KEY;
- key_rxmic = key + NL80211_TKIP_DATA_OFFSET_RX_MIC_KEY;
-
- if (addr == NULL) {
- /*
- * Group key installation - only two key cache entries are used
- * regardless of splitmic capability since group key is only
- * used either for TX or RX.
- */
- if (authenticator) {
- memcpy(hk->kv_mic, key_txmic, sizeof(hk->kv_mic));
- memcpy(hk->kv_txmic, key_txmic, sizeof(hk->kv_mic));
- } else {
- memcpy(hk->kv_mic, key_rxmic, sizeof(hk->kv_mic));
- memcpy(hk->kv_txmic, key_rxmic, sizeof(hk->kv_mic));
- }
- return ath9k_hw_set_keycache_entry(ah, keyix, hk, addr);
- }
- if (!common->splitmic) {
- /* TX and RX keys share the same key cache entry. */
- memcpy(hk->kv_mic, key_rxmic, sizeof(hk->kv_mic));
- memcpy(hk->kv_txmic, key_txmic, sizeof(hk->kv_txmic));
- return ath9k_hw_set_keycache_entry(ah, keyix, hk, addr);
- }
-
- /* Separate key cache entries for TX and RX */
-
- /* TX key goes at first index, RX key at +32. */
- memcpy(hk->kv_mic, key_txmic, sizeof(hk->kv_mic));
- if (!ath9k_hw_set_keycache_entry(ah, keyix, hk, NULL)) {
- /* TX MIC entry failed. No need to proceed further */
- ath_print(common, ATH_DBG_FATAL,
- "Setting TX MIC Key Failed\n");
- return 0;
- }
-
- memcpy(hk->kv_mic, key_rxmic, sizeof(hk->kv_mic));
- /* XXX delete tx key on failure? */
- return ath9k_hw_set_keycache_entry(ah, keyix + 32, hk, addr);
-}
-
-static int ath_reserve_key_cache_slot_tkip(struct ath_common *common)
-{
- int i;
-
- for (i = IEEE80211_WEP_NKID; i < common->keymax / 2; i++) {
- if (test_bit(i, common->keymap) ||
- test_bit(i + 64, common->keymap))
- continue; /* At least one part of TKIP key allocated */
- if (common->splitmic &&
- (test_bit(i + 32, common->keymap) ||
- test_bit(i + 64 + 32, common->keymap)))
- continue; /* At least one part of TKIP key allocated */
-
- /* Found a free slot for a TKIP key */
- return i;
- }
- return -1;
-}
-
-static int ath_reserve_key_cache_slot(struct ath_common *common)
-{
- int i;
-
- /* First, try to find slots that would not be available for TKIP. */
- if (common->splitmic) {
- for (i = IEEE80211_WEP_NKID; i < common->keymax / 4; i++) {
- if (!test_bit(i, common->keymap) &&
- (test_bit(i + 32, common->keymap) ||
- test_bit(i + 64, common->keymap) ||
- test_bit(i + 64 + 32, common->keymap)))
- return i;
- if (!test_bit(i + 32, common->keymap) &&
- (test_bit(i, common->keymap) ||
- test_bit(i + 64, common->keymap) ||
- test_bit(i + 64 + 32, common->keymap)))
- return i + 32;
- if (!test_bit(i + 64, common->keymap) &&
- (test_bit(i , common->keymap) ||
- test_bit(i + 32, common->keymap) ||
- test_bit(i + 64 + 32, common->keymap)))
- return i + 64;
- if (!test_bit(i + 64 + 32, common->keymap) &&
- (test_bit(i, common->keymap) ||
- test_bit(i + 32, common->keymap) ||
- test_bit(i + 64, common->keymap)))
- return i + 64 + 32;
- }
- } else {
- for (i = IEEE80211_WEP_NKID; i < common->keymax / 2; i++) {
- if (!test_bit(i, common->keymap) &&
- test_bit(i + 64, common->keymap))
- return i;
- if (test_bit(i, common->keymap) &&
- !test_bit(i + 64, common->keymap))
- return i + 64;
- }
- }
-
- /* No partially used TKIP slots, pick any available slot */
- for (i = IEEE80211_WEP_NKID; i < common->keymax; i++) {
- /* Do not allow slots that could be needed for TKIP group keys
- * to be used. This limitation could be removed if we know that
- * TKIP will not be used. */
- if (i >= 64 && i < 64 + IEEE80211_WEP_NKID)
- continue;
- if (common->splitmic) {
- if (i >= 32 && i < 32 + IEEE80211_WEP_NKID)
- continue;
- if (i >= 64 + 32 && i < 64 + 32 + IEEE80211_WEP_NKID)
- continue;
- }
-
- if (!test_bit(i, common->keymap))
- return i; /* Found a free slot for a key */
- }
-
- /* No free slot found */
- return -1;
-}
-
-static int ath_key_config(struct ath_common *common,
- struct ieee80211_vif *vif,
- struct ieee80211_sta *sta,
- struct ieee80211_key_conf *key)
-{
- struct ath_hw *ah = common->ah;
- struct ath9k_keyval hk;
- const u8 *mac = NULL;
- int ret = 0;
- int idx;
-
- memset(&hk, 0, sizeof(hk));
-
- switch (key->alg) {
- case ALG_WEP:
- hk.kv_type = ATH9K_CIPHER_WEP;
- break;
- case ALG_TKIP:
- hk.kv_type = ATH9K_CIPHER_TKIP;
- break;
- case ALG_CCMP:
- hk.kv_type = ATH9K_CIPHER_AES_CCM;
- break;
- default:
- return -EOPNOTSUPP;
- }
-
- hk.kv_len = key->keylen;
- memcpy(hk.kv_val, key->key, key->keylen);
-
- if (!(key->flags & IEEE80211_KEY_FLAG_PAIRWISE)) {
- /* For now, use the default keys for broadcast keys. This may
- * need to change with virtual interfaces. */
- idx = key->keyidx;
- } else if (key->keyidx) {
- if (WARN_ON(!sta))
- return -EOPNOTSUPP;
- mac = sta->addr;
-
- if (vif->type != NL80211_IFTYPE_AP) {
- /* Only keyidx 0 should be used with unicast key, but
- * allow this for client mode for now. */
- idx = key->keyidx;
- } else
- return -EIO;
- } else {
- if (WARN_ON(!sta))
- return -EOPNOTSUPP;
- mac = sta->addr;
-
- if (key->alg == ALG_TKIP)
- idx = ath_reserve_key_cache_slot_tkip(common);
- else
- idx = ath_reserve_key_cache_slot(common);
- if (idx < 0)
- return -ENOSPC; /* no free key cache entries */
- }
-
- if (key->alg == ALG_TKIP)
- ret = ath_setkey_tkip(common, idx, key->key, &hk, mac,
- vif->type == NL80211_IFTYPE_AP);
- else
- ret = ath9k_hw_set_keycache_entry(ah, idx, &hk, mac);
-
- if (!ret)
- return -EIO;
-
- set_bit(idx, common->keymap);
- if (key->alg == ALG_TKIP) {
- set_bit(idx + 64, common->keymap);
- if (common->splitmic) {
- set_bit(idx + 32, common->keymap);
- set_bit(idx + 64 + 32, common->keymap);
- }
- }
-
- return idx;
-}
-
-static void ath_key_delete(struct ath_common *common, struct ieee80211_key_conf *key)
-{
- struct ath_hw *ah = common->ah;
-
- ath9k_hw_keyreset(ah, key->hw_key_idx);
- if (key->hw_key_idx < IEEE80211_WEP_NKID)
- return;
-
- clear_bit(key->hw_key_idx, common->keymap);
- if (key->alg != ALG_TKIP)
- return;
-
- clear_bit(key->hw_key_idx + 64, common->keymap);
- if (common->splitmic) {
- ath9k_hw_keyreset(ah, key->hw_key_idx + 32);
- clear_bit(key->hw_key_idx + 32, common->keymap);
- clear_bit(key->hw_key_idx + 64 + 32, common->keymap);
- }
-}
-
static void ath9k_bss_assoc_info(struct ath_softc *sc,
struct ieee80211_vif *vif,
struct ieee80211_bss_conf *bss_conf)
@@ -1814,7 +1586,7 @@ static int ath9k_set_key(struct ieee8021
switch (cmd) {
case SET_KEY:
- ret = ath_key_config(common, vif, sta, key);
+ ret = ath9k_cmn_key_config(common, vif, sta, key);
if (ret >= 0) {
key->hw_key_idx = ret;
/* push IV and Michael MIC generation to stack */
@@ -1827,7 +1599,7 @@ static int ath9k_set_key(struct ieee8021
}
break;
case DISABLE_KEY:
- ath_key_delete(common, key);
+ ath9k_cmn_key_delete(common, key);
break;
default:
ret = -EINVAL;

File diff suppressed because it is too large Load Diff

View File

@ -1,24 +0,0 @@
--- a/drivers/net/wireless/ath/ath9k/common.c
+++ b/drivers/net/wireless/ath/ath9k/common.c
@@ -57,13 +57,19 @@ static bool ath9k_rx_accept(struct ath_c
* rs_more indicates chained descriptors which can be used
* to link buffers together for a sort of scatter-gather
* operation.
- *
+ * reject the frame, we don't support scatter-gather yet and
+ * the frame is probably corrupt anyway
+ */
+ if (rx_stats->rs_more)
+ return false;
+
+ /*
* The rx_stats->rs_status will not be set until the end of the
* chained descriptors so it can be ignored if rs_more is set. The
* rs_more will be false at the last element of the chained
* descriptors.
*/
- if (!rx_stats->rs_more && rx_stats->rs_status != 0) {
+ if (rx_stats->rs_status != 0) {
if (rx_stats->rs_status & ATH9K_RXERR_CRC)
rxs->flag |= RX_FLAG_FAILED_FCS_CRC;
if (rx_stats->rs_status & ATH9K_RXERR_PHY)

View File

@ -1,6 +1,6 @@
--- a/drivers/net/wireless/rt2x00/rt2x00pci.c
+++ b/drivers/net/wireless/rt2x00/rt2x00pci.c
@@ -225,6 +225,7 @@ void rt2x00pci_uninitialize(struct rt2x0
@@ -216,6 +216,7 @@ void rt2x00pci_uninitialize(struct rt2x0
}
EXPORT_SYMBOL_GPL(rt2x00pci_uninitialize);
@ -8,7 +8,7 @@
/*
* PCI driver handlers.
*/
@@ -399,6 +400,7 @@ int rt2x00pci_resume(struct pci_dev *pci
@@ -390,6 +391,7 @@ int rt2x00pci_resume(struct pci_dev *pci
}
EXPORT_SYMBOL_GPL(rt2x00pci_resume);
#endif /* CONFIG_PM */

View File

@ -1,11 +0,0 @@
--- a/drivers/net/wireless/rt2x00/rt2x00pci.c
+++ b/drivers/net/wireless/rt2x00/rt2x00pci.c
@@ -215,7 +215,7 @@ void rt2x00pci_uninitialize(struct rt2x0
/*
* Free irq line.
*/
- free_irq(to_pci_dev(rt2x00dev->dev)->irq, rt2x00dev);
+ free_irq(rt2x00dev->irq, rt2x00dev);
/*
* Free DMA

View File

@ -1,6 +1,6 @@
--- a/drivers/net/wireless/mwl8k.c
+++ b/drivers/net/wireless/mwl8k.c
@@ -3850,6 +3850,7 @@ MODULE_FIRMWARE("mwl8k/helper_8366.fw");
@@ -3882,6 +3882,7 @@ MODULE_FIRMWARE("mwl8k/helper_8366.fw");
MODULE_FIRMWARE("mwl8k/fmimage_8366.fw");
static DEFINE_PCI_DEVICE_TABLE(mwl8k_pci_id_table) = {

View File

@ -1,11 +1,11 @@
# Copyright (C) 2009 OpenWrt.org
# Copyright (C) 2009-2010 OpenWrt.org
# All rights reserved.
include $(TOPDIR)/rules.mk
PKG_NAME:=mountd
PKG_VERSION:=0.1
PKG_RELEASE:=1
PKG_RELEASE:=2
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
PKG_SOURCE_URL:=http://mirror2.openwrt.org/sources

View File

@ -1,5 +1,5 @@
#
# Copyright (C) 2009 Jo-Philipp Wich <xm@subsignal.org>
# Copyright (C) 2009-2010 Jo-Philipp Wich <xm@subsignal.org>
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
@ -8,7 +8,7 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=nvram
PKG_RELEASE:=6
PKG_RELEASE:=7
PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME)

View File

@ -52,7 +52,13 @@ fixup_linksys() {
}
;;
"1071") #0x042f
nvram_set sdram_init "$(printf 0x%04x $(( $(/usr/sbin/nvram get sdram_init) | 0x0009 )))"
# do sanity check first! max 0x0011 = 128mb
SDRAM_INIT=$(printf %d $(/usr/sbin/nvram get sdram_init))
[ "$SDRAM_INIT" -lt "9" -o "$SDRAM_INIT" -gt "17" ] && {
# set this to default: 0x09 only if value is invaild like 16MB on Asus WL-500GP
echo "sdram_init is invaild: $(printf 0x%04x $SDRAM_INIT), force to default!"
nvram_set sdram_init 0x0009
}
[ "$COMMIT" = 1 ] && {
nvram_set sdram_ncdl 0x0
}

View File

@ -10,7 +10,7 @@ include $(INCLUDE_DIR)/kernel.mk
PKG_NAME:=ppp
PKG_VERSION:=2.4.4
PKG_RELEASE:=5
PKG_RELEASE:=7
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=ftp://ftp.samba.org/pub/ppp/
@ -140,7 +140,7 @@ define Package/ppp/install
$(INSTALL_BIN) ./files/etc/ppp/ipv6-up $(1)/etc/ppp/
$(INSTALL_BIN) ./files/etc/ppp/ipv6-down $(1)/etc/ppp/
$(INSTALL_DATA) ./files/etc/ppp/options $(1)/etc/ppp/
ln -sf /tmp/resolv.conf.auto $(1)/etc/ppp/resolv.conf
ln -sf /tmp/resolv.conf.ppp $(1)/etc/ppp/resolv.conf
endef
define Package/ppp-mod-pppoa/install
@ -149,6 +149,8 @@ define Package/ppp-mod-pppoa/install
$(1)/usr/lib/pppd/$(PKG_VERSION)/
$(INSTALL_DIR) $(1)/lib/network
$(INSTALL_BIN) ./files/pppoa.sh $(1)/lib/network/
$(INSTALL_DIR) $(1)/etc/hotplug.d/atm
$(INSTALL_DATA) ./files/etc/hotplug.d/atm/20-atm-modem $(1)/etc/hotplug.d/atm/
endef
define Package/ppp-mod-pppoe/install

View File

@ -0,0 +1,25 @@
#!/bin/sh
if [ "$ACTION" = "add" ]; then
include /lib/network
scan_interfaces
local found=0
local ifc
for ifc in $interfaces; do
local up
config_get_bool up "$ifc" up 0
local proto
config_get proto "$ifc" proto
if [ "$proto" = "pppoa" ] && [ "$up" != 1 ]; then
found=1
( sleep 1; ifup "$ifc" ) &
fi
done
if [ "$found" != 1 ]; then
logger "Found no matching interface for DSL device $DEVICENAME"
fi
fi

View File

@ -1,22 +1,25 @@
#!/bin/sh
. /etc/functions.sh
. /lib/network/config.sh
PPP_IFACE="$1"
PPP_TTY="$2"
PPP_SPEED="$3"
PPP_LOCAL="$4"
PPP_REMOTE="$5"
PPP_IPPARAM="$(echo $6 | sed 's/\./_/g')"
PPP_UNIT="${PPP_IFACE##ppp}"
export PPP_IFACE PPP_TTY PPP_SPEED PPP_LOCAL PPP_REMOTE PPP_IPPARAM
[ -z "$PPP_IPPARAM" -o -z "$PPP_LOCAL" ] || {
uci_set_state network "$PPP_IPPARAM" unit "$PPP_UNIT"
uci_set_state network "$PPP_IPPARAM" ifname "$PPP_IFACE"
uci_set_state network "$PPP_IPPARAM" ipaddr "$PPP_LOCAL"
uci_set_state network "$PPP_IPPARAM" gateway "$PPP_REMOTE"
local dns="$DNS1${DNS2:+ $DNS2}"
[ -n "$dns" ] && uci_set_state network "$PPP_IPPARAM" dns "$dns"
[ -n "$dns" ] && add_dns "$PPP_IPPARAM" $dns
}
[ -z "$PPP_IPPARAM" ] || env -i ACTION="ifup" INTERFACE="$PPP_IPPARAM" DEVICE="$PPP_IFACE" PROTO=ppp /sbin/hotplug-call "iface"
[ -d /etc/ppp/ip-up.d ] && {

View File

@ -1,63 +1,40 @@
scan_ppp() {
config_get ifname "$1" ifname
pppdev="${pppdev:-0}"
config_get devunit "$1" unit
{
unit=
pppif=
if [ ! -d /tmp/.ppp-counter ]; then
mkdir -p /tmp/.ppp-counter
fi
local maxunit
maxunit="$(cat /tmp/.ppp-counter/max-unit 2>/dev/null)"
if [ -z "$maxunit" ]; then
maxunit=-1
fi
local i
i=0
while [ $i -le $maxunit ]; do
local unitdev
unitdev="$(cat /tmp/.ppp-counter/ppp${i} 2>/dev/null)"
if [ "$unitdev" = "$1" ]; then
unit="$i"
pppif="ppp${i}"
break
fi
i="$(($i + 1))"
done
if [ -z "$unit" ] || [ -z "$pppif" ]; then
maxunit="$(($maxunit + 1))"
if [ -n "$devunit" ]; then
unit="$devunit"
elif [ "${ifname%%[0-9]*}" = ppp ]; then
unit="${ifname##ppp}"
else
unit="$maxunit"
fi
[ "$maxunit" -lt "$unit" ] && maxunit="$unit"
pppif="ppp${unit}"
echo "$1" >/tmp/.ppp-counter/$pppif 2>/dev/null
echo "$maxunit" >/tmp/.ppp-counter/max-unit 2>/dev/null
fi
config_set "$1" ifname "ppp$unit"
config_set "$1" unit "$unit"
stop_interface_ppp() {
local cfg="$1"
local proto
config_get proto "$cfg" proto
local link="$proto-$cfg"
[ -f "/var/run/ppp-${link}.pid" ] && {
local pid="$(head -n1 /var/run/ppp-${link}.pid 2>/dev/null)"
local try=0
grep -qs pppd "/proc/$pid/cmdline" && kill -TERM $pid && \
while grep -qs pppd "/proc/$pid/cmdline" && [ $((try++)) -lt 5 ]; do sleep 1; done
grep -qs pppd "/proc/$pid/cmdline" && kill -KILL $pid && \
while grep -qs pppd "/proc/$pid/cmdline"; do sleep 1; done
rm -f "/var/run/ppp-${link}.pid"
}
remove_dns "$cfg"
local lock="/var/lock/ppp-$link"
[ -f "$lock" ] && lock -u "$lock"
}
start_pppd() {
local cfg="$1"; shift
local ifname
# make sure the network state references the correct ifname
scan_ppp "$cfg"
config_get ifname "$cfg" ifname
set_interface_ifname "$cfg" "$ifname"
local proto
config_get proto "$cfg" proto
# unique link identifier
local link="${proto:-ppp}-$cfg"
# make sure only one pppd process is started
lock "/var/lock/ppp-${cfg}"
local pid="$(head -n1 /var/run/ppp-${cfg}.pid 2>/dev/null)"
lock "/var/lock/ppp-${link}"
local pid="$(head -n1 /var/run/ppp-${link}.pid 2>/dev/null)"
[ -d "/proc/$pid" ] && grep pppd "/proc/$pid/cmdline" 2>/dev/null >/dev/null && {
lock -u "/var/lock/ppp-${cfg}"
lock -u "/var/lock/ppp-${link}"
return 0
}
@ -68,9 +45,6 @@ start_pppd() {
local device
config_get device "$cfg" device
local unit
config_get unit "$cfg" unit
local username
config_get username "$cfg" username
@ -91,7 +65,8 @@ start_pppd() {
local defaultroute
config_get_bool defaultroute "$cfg" defaultroute 1
[ "$defaultroute" -eq 1 ] && defaultroute="defaultroute replacedefaultroute" || defaultroute=""
[ "$defaultroute" -eq 1 ] && \
defaultroute="defaultroute replacedefaultroute" || defaultroute="nodefaultroute"
local interval="${keepalive##*[, ]}"
[ "$interval" != "$keepalive" ] || interval=5
@ -109,15 +84,11 @@ start_pppd() {
local peerdns
config_get_bool peerdns "$cfg" peerdns $peer_default
echo -n "" > /tmp/resolv.conf.auto
[ "$peerdns" -eq 1 ] && {
peerdns="usepeerdns"
} || {
peerdns=""
for dns in $dns; do
echo "nameserver $dns" >> /tmp/resolv.conf.auto
done
add_dns "$cfg" $dns
}
local demand
@ -126,8 +97,7 @@ start_pppd() {
local demandargs
[ "$demand" -eq 1 ] && {
demandargs="precompiled-active-filter /etc/ppp/filter demand idle"
[ "$has_dns" -eq 0 ] && \
echo "nameserver 1.1.1.1" > /tmp/resolv.conf.auto
[ "$has_dns" -eq 0 ] && add_dns "$cfg" 1.1.1.1
} || {
demandargs="persist"
}
@ -136,21 +106,21 @@ start_pppd() {
config_get_bool ipv6 "$cfg" ipv6 0
[ "$ipv6" -eq 1 ] && ipv6="+ipv6" || ipv6=""
/usr/sbin/pppd "$@" \
start-stop-daemon -S -b -x /usr/sbin/pppd -m -p /var/run/ppp-$link.pid -- "$@" \
${keepalive:+lcp-echo-interval $interval lcp-echo-failure ${keepalive%%[, ]*}} \
$demandargs \
$peerdns \
$defaultroute \
${username:+user "$username" password "$password"} \
unit "$unit" \
linkname "$cfg" \
ipparam "$cfg" \
ifname "$link" \
${connect:+connect "$connect"} \
${disconnect:+disconnect "$disconnect"} \
${ipv6} \
${pppd_options}
${pppd_options} \
nodetach
lock -u "/var/lock/ppp-${cfg}"
lock -u "/var/lock/ppp-${link}"
}
setup_interface_ppp() {

View File

@ -1,28 +1,37 @@
scan_pppoa() {
scan_ppp "$@"
stop_interface_pppoa() {
stop_interface_ppp "$1"
}
setup_interface_pppoa() {
local iface="$1"
local config="$2"
local device
config_get device "$config" device
local vpi
config_get vpi "$config" vpi
local vci
config_get vci "$config" vci
for module in slhc ppp_generic pppoatm; do
/sbin/insmod $module 2>&- >&-
done
local encaps
config_get encaps "$config" encaps
case "$encaps" in
1|vc) ENCAPS="vc-encaps" ;;
*) ENCAPS="llc-encaps" ;;
1|vc) encaps="vc-encaps" ;;
*) encaps="llc-encaps" ;;
esac
local mtu
config_get mtu "$config" mtu
mtu=${mtu:-1500}
start_pppd "$config" \
plugin pppoatm.so ${vpi:-8}.${vci:-35} ${ENCAPS} \
plugin pppoatm.so ${vpi:-8}.${vci:-35} ${encaps} \
mtu $mtu mru $mtu
}

View File

@ -1,5 +1,5 @@
scan_pppoe() {
scan_ppp "$@"
stop_interface_pppoe() {
stop_interface_ppp "$1"
}
setup_interface_pppoe() {

View File

@ -0,0 +1,128 @@
--- a/pppd/main.c
+++ b/pppd/main.c
@@ -742,8 +742,11 @@ void
set_ifunit(iskey)
int iskey;
{
- info("Using interface %s%d", PPP_DRV_NAME, ifunit);
- slprintf(ifname, sizeof(ifname), "%s%d", PPP_DRV_NAME, ifunit);
+ if (use_ifname[0] == 0)
+ slprintf(ifname, sizeof(ifname), "%s%d", PPP_DRV_NAME, ifunit);
+ else
+ slprintf(ifname, sizeof(ifname), "%s", use_ifname);
+ info("Using interface %s", ifname);
script_setenv("IFNAME", ifname, iskey);
if (iskey) {
create_pidfile(getpid()); /* write pid to file */
--- a/pppd/options.c
+++ b/pppd/options.c
@@ -111,6 +111,7 @@ int log_to_fd = 1; /* send log messages
bool log_default = 1; /* log_to_fd is default (stdout) */
int maxfail = 10; /* max # of unsuccessful connection attempts */
char linkname[MAXPATHLEN]; /* logical name for link */
+char use_ifname[IFNAMSIZ]; /* physical name for PPP link */
bool tune_kernel; /* may alter kernel settings */
int connect_delay = 1000; /* wait this many ms after connect script */
int req_unit = -1; /* requested interface unit */
@@ -264,6 +265,9 @@ option_t general_options[] = {
{ "linkname", o_string, linkname,
"Set logical name for link",
OPT_PRIO | OPT_PRIV | OPT_STATIC, NULL, MAXPATHLEN },
+ { "ifname", o_string, use_ifname,
+ "Set physical name for PPP interface",
+ OPT_PRIO | OPT_PRIV | OPT_STATIC, NULL, IFNAMSIZ },
{ "maxfail", o_int, &maxfail,
"Maximum number of unsuccessful connection attempts to allow",
--- a/pppd/pppd.h
+++ b/pppd/pppd.h
@@ -71,6 +71,10 @@
#include "eui64.h"
#endif
+#ifndef IFNAMSIZ
+#define IFNAMSIZ 16
+#endif
+
/*
* Limits.
*/
@@ -308,6 +312,7 @@ extern char *record_file; /* File to rec
extern bool sync_serial; /* Device is synchronous serial device */
extern int maxfail; /* Max # of unsuccessful connection attempts */
extern char linkname[MAXPATHLEN]; /* logical name for link */
+extern char use_ifname[IFNAMSIZ]; /* physical name for PPP interface */
extern bool tune_kernel; /* May alter kernel settings as necessary */
extern int connect_delay; /* Time to delay after connect script */
extern int max_data_rate; /* max bytes/sec through charshunt */
--- a/pppd/sys-linux.c
+++ b/pppd/sys-linux.c
@@ -168,6 +168,10 @@ struct in6_ifreq {
/* We can get an EIO error on an ioctl if the modem has hung up */
#define ok_error(num) ((num)==EIO)
+#if !defined(PPP_DRV_NAME)
+#define PPP_DRV_NAME "ppp"
+#endif /* !defined(PPP_DRV_NAME) */
+
static int tty_disc = N_TTY; /* The TTY discipline */
static int ppp_disc = N_PPP; /* The PPP discpline */
static int initfdflags = -1; /* Initial file descriptor flags for fd */
@@ -622,7 +626,8 @@ void generic_disestablish_ppp(int dev_fd
*/
static int make_ppp_unit()
{
- int x, flags;
+ struct ifreq ifr;
+ int x, flags, s;
if (ppp_dev_fd >= 0) {
dbglog("in make_ppp_unit, already had /dev/ppp open?");
@@ -645,6 +650,32 @@ static int make_ppp_unit()
}
if (x < 0)
error("Couldn't create new ppp unit: %m");
+
+ if (use_ifname[0] != 0) {
+ s = socket(PF_INET, SOCK_DGRAM, 0);
+ if (s < 0)
+ s = socket(PF_PACKET, SOCK_DGRAM, 0);
+ if (s < 0)
+ s = socket(PF_INET6, SOCK_DGRAM, 0);
+ if (s < 0)
+ s = socket(PF_UNIX, SOCK_DGRAM, 0);
+ if (s >= 0) {
+ slprintf(ifr.ifr_name, sizeof(ifr.ifr_name), "%s%d", PPP_DRV_NAME, ifunit);
+ slprintf(ifr.ifr_newname, sizeof(ifr.ifr_newname), "%s", use_ifname);
+ x = ioctl(s, SIOCSIFNAME, &ifr);
+ close(s);
+ } else {
+ x = s;
+ }
+ if (x < 0) {
+ error("Couldn't rename %s to %s", ifr.ifr_name, ifr.ifr_newname);
+ close(ppp_dev_fd);
+ ppp_dev_fd = -1;
+ } else {
+ info("Renamed %s to %s", ifr.ifr_name, ifr.ifr_newname);
+ }
+ }
+
return x;
}
--- a/pppstats/pppstats.c
+++ b/pppstats/pppstats.c
@@ -506,10 +506,12 @@ main(argc, argv)
if (argc > 0)
interface = argv[0];
+/*
if (sscanf(interface, PPP_DRV_NAME "%d", &unit) != 1) {
fprintf(stderr, "%s: invalid interface '%s' specified\n",
progname, interface);
}
+*/
#ifndef STREAMS
{

View File

@ -8,12 +8,12 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=pptp
PKG_VERSION:=1.6.0
PKG_RELEASE:=6
PKG_VERSION:=1.7.1
PKG_RELEASE:=3
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=@SF/pptpclient
PKG_MD5SUM:=9a706327fb9827541d7c86d48ceb9631
PKG_MD5SUM:=b47735ba5d6d37dfdbccb85afc044ede
include $(INCLUDE_DIR)/package.mk

View File

@ -1,33 +0,0 @@
#!/bin/sh /etc/rc.common
# Copyright (C) 2006 OpenWrt.org
START=41
STOP=30
updown_pptp_interface () {
config_get proto "$1" proto
if [ "$proto" = "pptp" ]; then
if$2 "$1"
fi
}
boot () {
start
}
start() {
config_load network
config_foreach updown_pptp_interface interface up
}
restart() {
config_load network
config_foreach updown_pptp_interface interface down
config_foreach updown_pptp_interface interface up
}
stop() {
config_load network
config_foreach updown_pptp_interface interface down
}

View File

@ -1,20 +1,36 @@
scan_pptp() {
scan_ppp "$@"
}
find_gw() {
route -n | awk '$1 == "0.0.0.0" { print $2; exit }'
}
scan_pptp() {
config_set "$1" device "pptp-$1"
}
stop_interface_pptp() {
stop_interface_ppp "$1"
}
coldplug_interface_pptp() {
setup_interface_pptp "pptp-$1" "$1"
}
setup_interface_pptp() {
local config="$2"
local ifname
local device
config_get device "$config" device
local ipproto
config_get ipproto "$config" ipproto
local server
config_get server "$config" server
local buffering
config_get_bool buffering "$config" buffering 1
[ "$buffering" == 0 ] && buffering="--nobuffer" || buffering=
for module in slhc ppp_generic ppp_async ip_gre; do
/sbin/insmod $module 2>&- >&-
done
@ -23,7 +39,7 @@ setup_interface_pptp() {
setup_interface "$device" "$config" "${ipproto:-dhcp}"
local gw="$(find_gw)"
[ -n "$gw" ] && {
route delete "$server" 2>/dev/null >/dev/null
[ "$gw" != 0.0.0.0 ] && route delete "$server" 2>/dev/null >/dev/null
route add "$server" gw "$gw"
}
@ -31,15 +47,10 @@ setup_interface_pptp() {
config_get netmask "$config" netmask
[ -z "$netmask" -o -z "$device" ] || ifconfig $device netmask $netmask
# make sure the network state references the correct ifname
scan_ppp "$config"
config_get ifname "$config" ifname
uci_set_state network "$config" ifname "$ifname"
config_get mtu "$config" mtu
mtu=${mtu:-1452}
start_pppd "$config" \
pty "/usr/sbin/pptp $server --loglevel 0 --nolaunchpppd" \
pty "/usr/sbin/pptp $server --loglevel 0 --nolaunchpppd $buffering" \
file /etc/ppp/options.pptp \
mtu $mtu mru $mtu
}

View File

@ -1,5 +1,5 @@
#
# Copyright (C) 2006 OpenWrt.org
# Copyright (C) 2006-2010 OpenWrt.org
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
@ -10,6 +10,7 @@ include $(INCLUDE_DIR)/kernel.mk
PKG_NAME:=siit
PKG_VERSION:=1.1
PKG_RELEASE:=1
include $(INCLUDE_DIR)/package.mk

View File

@ -1,5 +1,5 @@
#
# Copyright (C) 2008-2009 OpenWrt.org
# Copyright (C) 2008-2010 OpenWrt.org
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
@ -8,7 +8,7 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=swconfig
PKG_RELEASE:=5
PKG_RELEASE:=6
include $(INCLUDE_DIR)/package.mk
include $(INCLUDE_DIR)/kernel.mk

View File

@ -1,50 +1,50 @@
/* Settings for Denali DDR SDRAM controller */
/* Optimise for Danube Eval Board DDR 167 Mhz - by Ng Aik Ann 29th April */
#define MC_DC0_VALUE 0x1B1B
#define MC_DC1_VALUE 0x0
#define MC_DC2_VALUE 0x0
#define MC_DC3_VALUE 0x0
#define MC_DC4_VALUE 0x0
#define MC_DC5_VALUE 0x200
#define MC_DC6_VALUE 0x605
#define MC_DC7_VALUE 0x303
#define MC_DC8_VALUE 0x102
#define MC_DC9_VALUE 0x70a
#define MC_DC10_VALUE 0x203
#define MC_DC11_VALUE 0xc02
#define MC_DC12_VALUE 0x1C8
#define MC_DC13_VALUE 0x1
#define MC_DC14_VALUE 0x0
#define MC_DC15_VALUE 0xf3c
#define MC_DC16_VALUE 0xC800
#define MC_DC17_VALUE 0xd
#define MC_DC18_VALUE 0x300
#define MC_DC19_VALUE 0x200
#define MC_DC20_VALUE 0xA03
#define MC_DC21_VALUE 0x1d00
#define MC_DC22_VALUE 0x1d1d
#define MC_DC23_VALUE 0x0
#define MC_DC24_VALUE 0x5e /* was 0x7f */
#define MC_DC25_VALUE 0x0
#define MC_DC26_VALUE 0x0
#define MC_DC27_VALUE 0x0
#define MC_DC28_VALUE 0x510
#define MC_DC29_VALUE 0x2d89
#define MC_DC30_VALUE 0x8300
#define MC_DC31_VALUE 0x0
#define MC_DC32_VALUE 0x0
#define MC_DC33_VALUE 0x0
#define MC_DC34_VALUE 0x0
#define MC_DC35_VALUE 0x0
#define MC_DC36_VALUE 0x0
#define MC_DC37_VALUE 0x0
#define MC_DC38_VALUE 0x0
#define MC_DC39_VALUE 0x0
#define MC_DC40_VALUE 0x0
#define MC_DC41_VALUE 0x0
#define MC_DC42_VALUE 0x0
#define MC_DC43_VALUE 0x0
#define MC_DC44_VALUE 0x0
#define MC_DC45_VALUE 0x500
//#define MC_DC45_VALUE 0x400
#define MC_DC46_VALUE 0x0
/* Settings for Denali DDR SDRAM controller */
/* Optimise for Danube Eval Board DDR 167 Mhz - by Ng Aik Ann 29th April */
#define MC_DC0_VALUE 0x1B1B
#define MC_DC1_VALUE 0x0
#define MC_DC2_VALUE 0x0
#define MC_DC3_VALUE 0x0
#define MC_DC4_VALUE 0x0
#define MC_DC5_VALUE 0x200
#define MC_DC6_VALUE 0x605
#define MC_DC7_VALUE 0x303
#define MC_DC8_VALUE 0x102
#define MC_DC9_VALUE 0x70a
#define MC_DC10_VALUE 0x203
#define MC_DC11_VALUE 0xc02
#define MC_DC12_VALUE 0x1C8
#define MC_DC13_VALUE 0x1
#define MC_DC14_VALUE 0x0
#define MC_DC15_VALUE 0xf3c
#define MC_DC16_VALUE 0xC800
#define MC_DC17_VALUE 0xd
#define MC_DC18_VALUE 0x300
#define MC_DC19_VALUE 0x200
#define MC_DC20_VALUE 0xA03
#define MC_DC21_VALUE 0x1d00
#define MC_DC22_VALUE 0x1d1d
#define MC_DC23_VALUE 0x0
#define MC_DC24_VALUE 0x5e /* was 0x7f */
#define MC_DC25_VALUE 0x0
#define MC_DC26_VALUE 0x0
#define MC_DC27_VALUE 0x0
#define MC_DC28_VALUE 0x510
#define MC_DC29_VALUE 0x2d89
#define MC_DC30_VALUE 0x8300
#define MC_DC31_VALUE 0x0
#define MC_DC32_VALUE 0x0
#define MC_DC33_VALUE 0x0
#define MC_DC34_VALUE 0x0
#define MC_DC35_VALUE 0x0
#define MC_DC36_VALUE 0x0
#define MC_DC37_VALUE 0x0
#define MC_DC38_VALUE 0x0
#define MC_DC39_VALUE 0x0
#define MC_DC40_VALUE 0x0
#define MC_DC41_VALUE 0x0
#define MC_DC42_VALUE 0x0
#define MC_DC43_VALUE 0x0
#define MC_DC44_VALUE 0x0
#define MC_DC45_VALUE 0x500
//#define MC_DC45_VALUE 0x400
#define MC_DC46_VALUE 0x0

View File

@ -1,50 +1,50 @@
/* Settings for Denali DDR SDRAM controller */
/* Optimise for Danube Ref Board DDR 166 Mhz - by Ng Aik Ann 29th April */
#define MC_DC0_VALUE 0x1B1B
#define MC_DC1_VALUE 0x0
#define MC_DC2_VALUE 0x0
#define MC_DC3_VALUE 0x0
#define MC_DC4_VALUE 0x0
#define MC_DC5_VALUE 0x200
#define MC_DC6_VALUE 0x605
#define MC_DC7_VALUE 0x303
#define MC_DC8_VALUE 0x102
#define MC_DC9_VALUE 0x70a
#define MC_DC10_VALUE 0x203
#define MC_DC11_VALUE 0xc02
#define MC_DC12_VALUE 0x1C8
#define MC_DC13_VALUE 0x1
#define MC_DC14_VALUE 0x0
#define MC_DC15_VALUE 0xf3c /* WDQS tuning for clk_wr*/
#define MC_DC16_VALUE 0xC800
#define MC_DC17_VALUE 0xd
#define MC_DC18_VALUE 0x300
#define MC_DC19_VALUE 0x200
#define MC_DC20_VALUE 0xA04 /* A04 for reference board, A03 for Eval board */
#define MC_DC21_VALUE 0x1200
#define MC_DC22_VALUE 0x1212
#define MC_DC23_VALUE 0x0
#define MC_DC24_VALUE 0x5e /* WDQS Tuning for DQS */
#define MC_DC25_VALUE 0x0
#define MC_DC26_VALUE 0x0
#define MC_DC27_VALUE 0x0
#define MC_DC28_VALUE 0x510
#define MC_DC29_VALUE 0x2d89
#define MC_DC30_VALUE 0x8300
#define MC_DC31_VALUE 0x0
#define MC_DC32_VALUE 0x0
#define MC_DC33_VALUE 0x0
#define MC_DC34_VALUE 0x0
#define MC_DC35_VALUE 0x0
#define MC_DC36_VALUE 0x0
#define MC_DC37_VALUE 0x0
#define MC_DC38_VALUE 0x0
#define MC_DC39_VALUE 0x0
#define MC_DC40_VALUE 0x0
#define MC_DC41_VALUE 0x0
#define MC_DC42_VALUE 0x0
#define MC_DC43_VALUE 0x0
#define MC_DC44_VALUE 0x0
#define MC_DC45_VALUE 0x500
//#define MC_DC45_VALUE 0x400
#define MC_DC46_VALUE 0x0
/* Settings for Denali DDR SDRAM controller */
/* Optimise for Danube Ref Board DDR 166 Mhz - by Ng Aik Ann 29th April */
#define MC_DC0_VALUE 0x1B1B
#define MC_DC1_VALUE 0x0
#define MC_DC2_VALUE 0x0
#define MC_DC3_VALUE 0x0
#define MC_DC4_VALUE 0x0
#define MC_DC5_VALUE 0x200
#define MC_DC6_VALUE 0x605
#define MC_DC7_VALUE 0x303
#define MC_DC8_VALUE 0x102
#define MC_DC9_VALUE 0x70a
#define MC_DC10_VALUE 0x203
#define MC_DC11_VALUE 0xc02
#define MC_DC12_VALUE 0x1C8
#define MC_DC13_VALUE 0x1
#define MC_DC14_VALUE 0x0
#define MC_DC15_VALUE 0xf3c /* WDQS tuning for clk_wr*/
#define MC_DC16_VALUE 0xC800
#define MC_DC17_VALUE 0xd
#define MC_DC18_VALUE 0x300
#define MC_DC19_VALUE 0x200
#define MC_DC20_VALUE 0xA04 /* A04 for reference board, A03 for Eval board */
#define MC_DC21_VALUE 0x1200
#define MC_DC22_VALUE 0x1212
#define MC_DC23_VALUE 0x0
#define MC_DC24_VALUE 0x5e /* WDQS Tuning for DQS */
#define MC_DC25_VALUE 0x0
#define MC_DC26_VALUE 0x0
#define MC_DC27_VALUE 0x0
#define MC_DC28_VALUE 0x510
#define MC_DC29_VALUE 0x2d89
#define MC_DC30_VALUE 0x8300
#define MC_DC31_VALUE 0x0
#define MC_DC32_VALUE 0x0
#define MC_DC33_VALUE 0x0
#define MC_DC34_VALUE 0x0
#define MC_DC35_VALUE 0x0
#define MC_DC36_VALUE 0x0
#define MC_DC37_VALUE 0x0
#define MC_DC38_VALUE 0x0
#define MC_DC39_VALUE 0x0
#define MC_DC40_VALUE 0x0
#define MC_DC41_VALUE 0x0
#define MC_DC42_VALUE 0x0
#define MC_DC43_VALUE 0x0
#define MC_DC44_VALUE 0x0
#define MC_DC45_VALUE 0x500
//#define MC_DC45_VALUE 0x400
#define MC_DC46_VALUE 0x0

View File

@ -1,50 +1,50 @@
/* Settings for Denali DDR SDRAM controller */
/* Optimise for Danube Eval Board DDR 167 Mhz - by Ng Aik Ann 29th April */
#define MC_DC0_VALUE 0x1B1B
#define MC_DC1_VALUE 0x0
#define MC_DC2_VALUE 0x0
#define MC_DC3_VALUE 0x0
#define MC_DC4_VALUE 0x0
#define MC_DC5_VALUE 0x200
#define MC_DC6_VALUE 0x605
#define MC_DC7_VALUE 0x303
#define MC_DC8_VALUE 0x102
#define MC_DC9_VALUE 0x70a
#define MC_DC10_VALUE 0x203
#define MC_DC11_VALUE 0xc02
#define MC_DC12_VALUE 0x1C8
#define MC_DC13_VALUE 0x1
#define MC_DC14_VALUE 0x0
#define MC_DC15_VALUE 0xf3c
#define MC_DC16_VALUE 0xC800
#define MC_DC17_VALUE 0xd
#define MC_DC18_VALUE 0x300
#define MC_DC19_VALUE 0x200
#define MC_DC20_VALUE 0xA03
#define MC_DC21_VALUE 0x1d00
#define MC_DC22_VALUE 0x1d1d
#define MC_DC23_VALUE 0x0
#define MC_DC24_VALUE 0x5e /* was 0x7f */
#define MC_DC25_VALUE 0x0
#define MC_DC26_VALUE 0x0
#define MC_DC27_VALUE 0x0
#define MC_DC28_VALUE 0x510
#define MC_DC29_VALUE 0x2d89
#define MC_DC30_VALUE 0x8300
#define MC_DC31_VALUE 0x0
#define MC_DC32_VALUE 0x0
#define MC_DC33_VALUE 0x0
#define MC_DC34_VALUE 0x0
#define MC_DC35_VALUE 0x0
#define MC_DC36_VALUE 0x0
#define MC_DC37_VALUE 0x0
#define MC_DC38_VALUE 0x0
#define MC_DC39_VALUE 0x0
#define MC_DC40_VALUE 0x0
#define MC_DC41_VALUE 0x0
#define MC_DC42_VALUE 0x0
#define MC_DC43_VALUE 0x0
#define MC_DC44_VALUE 0x0
#define MC_DC45_VALUE 0x500
//#define MC_DC45_VALUE 0x400
#define MC_DC46_VALUE 0x0
/* Settings for Denali DDR SDRAM controller */
/* Optimise for Danube Eval Board DDR 167 Mhz - by Ng Aik Ann 29th April */
#define MC_DC0_VALUE 0x1B1B
#define MC_DC1_VALUE 0x0
#define MC_DC2_VALUE 0x0
#define MC_DC3_VALUE 0x0
#define MC_DC4_VALUE 0x0
#define MC_DC5_VALUE 0x200
#define MC_DC6_VALUE 0x605
#define MC_DC7_VALUE 0x303
#define MC_DC8_VALUE 0x102
#define MC_DC9_VALUE 0x70a
#define MC_DC10_VALUE 0x203
#define MC_DC11_VALUE 0xc02
#define MC_DC12_VALUE 0x1C8
#define MC_DC13_VALUE 0x1
#define MC_DC14_VALUE 0x0
#define MC_DC15_VALUE 0xf3c
#define MC_DC16_VALUE 0xC800
#define MC_DC17_VALUE 0xd
#define MC_DC18_VALUE 0x300
#define MC_DC19_VALUE 0x200
#define MC_DC20_VALUE 0xA03
#define MC_DC21_VALUE 0x1d00
#define MC_DC22_VALUE 0x1d1d
#define MC_DC23_VALUE 0x0
#define MC_DC24_VALUE 0x5e /* was 0x7f */
#define MC_DC25_VALUE 0x0
#define MC_DC26_VALUE 0x0
#define MC_DC27_VALUE 0x0
#define MC_DC28_VALUE 0x510
#define MC_DC29_VALUE 0x2d89
#define MC_DC30_VALUE 0x8300
#define MC_DC31_VALUE 0x0
#define MC_DC32_VALUE 0x0
#define MC_DC33_VALUE 0x0
#define MC_DC34_VALUE 0x0
#define MC_DC35_VALUE 0x0
#define MC_DC36_VALUE 0x0
#define MC_DC37_VALUE 0x0
#define MC_DC38_VALUE 0x0
#define MC_DC39_VALUE 0x0
#define MC_DC40_VALUE 0x0
#define MC_DC41_VALUE 0x0
#define MC_DC42_VALUE 0x0
#define MC_DC43_VALUE 0x0
#define MC_DC44_VALUE 0x0
#define MC_DC45_VALUE 0x500
//#define MC_DC45_VALUE 0x400
#define MC_DC46_VALUE 0x0

View File

@ -1,50 +1,50 @@
/* Settings for Denali DDR SDRAM controller */
/* Optimise for Danube Ref Board DDR 166 Mhz - by Ng Aik Ann 29th April */
#define MC_DC0_VALUE 0x1B1B
#define MC_DC1_VALUE 0x0
#define MC_DC2_VALUE 0x0
#define MC_DC3_VALUE 0x0
#define MC_DC4_VALUE 0x0
#define MC_DC5_VALUE 0x200
#define MC_DC6_VALUE 0x605
#define MC_DC7_VALUE 0x303
#define MC_DC8_VALUE 0x102
#define MC_DC9_VALUE 0x70a
#define MC_DC10_VALUE 0x203
#define MC_DC11_VALUE 0xc02
#define MC_DC12_VALUE 0x1C8
#define MC_DC13_VALUE 0x1
#define MC_DC14_VALUE 0x0
#define MC_DC15_VALUE 0xf3c /* WDQS tuning for clk_wr*/
#define MC_DC16_VALUE 0xC800
#define MC_DC17_VALUE 0xd
#define MC_DC18_VALUE 0x300
#define MC_DC19_VALUE 0x200
#define MC_DC20_VALUE 0xA04 /* A04 for reference board, A03 for Eval board */
#define MC_DC21_VALUE 0x1200
#define MC_DC22_VALUE 0x1212
#define MC_DC23_VALUE 0x0
#define MC_DC24_VALUE 0x5e /* WDQS Tuning for DQS */
#define MC_DC25_VALUE 0x0
#define MC_DC26_VALUE 0x0
#define MC_DC27_VALUE 0x0
#define MC_DC28_VALUE 0x510
#define MC_DC29_VALUE 0x2d89
#define MC_DC30_VALUE 0x8300
#define MC_DC31_VALUE 0x0
#define MC_DC32_VALUE 0x0
#define MC_DC33_VALUE 0x0
#define MC_DC34_VALUE 0x0
#define MC_DC35_VALUE 0x0
#define MC_DC36_VALUE 0x0
#define MC_DC37_VALUE 0x0
#define MC_DC38_VALUE 0x0
#define MC_DC39_VALUE 0x0
#define MC_DC40_VALUE 0x0
#define MC_DC41_VALUE 0x0
#define MC_DC42_VALUE 0x0
#define MC_DC43_VALUE 0x0
#define MC_DC44_VALUE 0x0
#define MC_DC45_VALUE 0x500
//#define MC_DC45_VALUE 0x400
#define MC_DC46_VALUE 0x0
/* Settings for Denali DDR SDRAM controller */
/* Optimise for Danube Ref Board DDR 166 Mhz - by Ng Aik Ann 29th April */
#define MC_DC0_VALUE 0x1B1B
#define MC_DC1_VALUE 0x0
#define MC_DC2_VALUE 0x0
#define MC_DC3_VALUE 0x0
#define MC_DC4_VALUE 0x0
#define MC_DC5_VALUE 0x200
#define MC_DC6_VALUE 0x605
#define MC_DC7_VALUE 0x303
#define MC_DC8_VALUE 0x102
#define MC_DC9_VALUE 0x70a
#define MC_DC10_VALUE 0x203
#define MC_DC11_VALUE 0xc02
#define MC_DC12_VALUE 0x1C8
#define MC_DC13_VALUE 0x1
#define MC_DC14_VALUE 0x0
#define MC_DC15_VALUE 0xf3c /* WDQS tuning for clk_wr*/
#define MC_DC16_VALUE 0xC800
#define MC_DC17_VALUE 0xd
#define MC_DC18_VALUE 0x300
#define MC_DC19_VALUE 0x200
#define MC_DC20_VALUE 0xA04 /* A04 for reference board, A03 for Eval board */
#define MC_DC21_VALUE 0x1200
#define MC_DC22_VALUE 0x1212
#define MC_DC23_VALUE 0x0
#define MC_DC24_VALUE 0x5e /* WDQS Tuning for DQS */
#define MC_DC25_VALUE 0x0
#define MC_DC26_VALUE 0x0
#define MC_DC27_VALUE 0x0
#define MC_DC28_VALUE 0x510
#define MC_DC29_VALUE 0x2d89
#define MC_DC30_VALUE 0x8300
#define MC_DC31_VALUE 0x0
#define MC_DC32_VALUE 0x0
#define MC_DC33_VALUE 0x0
#define MC_DC34_VALUE 0x0
#define MC_DC35_VALUE 0x0
#define MC_DC36_VALUE 0x0
#define MC_DC37_VALUE 0x0
#define MC_DC38_VALUE 0x0
#define MC_DC39_VALUE 0x0
#define MC_DC40_VALUE 0x0
#define MC_DC41_VALUE 0x0
#define MC_DC42_VALUE 0x0
#define MC_DC43_VALUE 0x0
#define MC_DC44_VALUE 0x0
#define MC_DC45_VALUE 0x500
//#define MC_DC45_VALUE 0x400
#define MC_DC46_VALUE 0x0

View File

@ -1,51 +1,51 @@
/* Settings for Denali DDR SDRAM controller */
/* Optimise for Samsung DDR K4H561638H Danube Ref Board DDR 166 Mhz - by Ng Aik Ann 27th Nov 2006 */
#define MC_DC0_VALUE 0x1B1B
#define MC_DC1_VALUE 0x0
#define MC_DC2_VALUE 0x0
#define MC_DC3_VALUE 0x0
#define MC_DC4_VALUE 0x0
#define MC_DC5_VALUE 0x200
#define MC_DC6_VALUE 0x306
#define MC_DC7_VALUE 0x303
#define MC_DC8_VALUE 0x102
#define MC_DC9_VALUE 0x80B
#define MC_DC10_VALUE 0x203
#define MC_DC11_VALUE 0xD02
#define MC_DC12_VALUE 0x1C8
#define MC_DC13_VALUE 0x1
#define MC_DC14_VALUE 0x0
#define MC_DC15_VALUE 0x144 /* WDQS tuning for clk_wr*/
#define MC_DC16_VALUE 0xC800
#define MC_DC17_VALUE 0xF
#define MC_DC18_VALUE 0x301
#define MC_DC19_VALUE 0x200
#define MC_DC20_VALUE 0xA04 /* A04 for reference board, A03 for Eval board */
#define MC_DC21_VALUE 0x1200
#define MC_DC22_VALUE 0x1212
#define MC_DC23_VALUE 0x0
#define MC_DC24_VALUE 0x66 /* WDQS Tuning for DQS */
#define MC_DC25_VALUE 0x0
#define MC_DC26_VALUE 0x0
#define MC_DC27_VALUE 0x0
#define MC_DC28_VALUE 0x5FB
#define MC_DC29_VALUE 0x35DF
#define MC_DC30_VALUE 0x99E9
#define MC_DC31_VALUE 0x0
#define MC_DC32_VALUE 0x0
#define MC_DC33_VALUE 0x0
#define MC_DC34_VALUE 0x0
#define MC_DC35_VALUE 0x0
#define MC_DC36_VALUE 0x0
#define MC_DC37_VALUE 0x0
#define MC_DC38_VALUE 0x0
#define MC_DC39_VALUE 0x0
#define MC_DC40_VALUE 0x0
#define MC_DC41_VALUE 0x0
#define MC_DC42_VALUE 0x0
#define MC_DC43_VALUE 0x0
#define MC_DC44_VALUE 0x0
#define MC_DC45_VALUE 0x600
//#define MC_DC45_VALUE 0x400
#define MC_DC46_VALUE 0x0
/* Settings for Denali DDR SDRAM controller */
/* Optimise for Samsung DDR K4H561638H Danube Ref Board DDR 166 Mhz - by Ng Aik Ann 27th Nov 2006 */
#define MC_DC0_VALUE 0x1B1B
#define MC_DC1_VALUE 0x0
#define MC_DC2_VALUE 0x0
#define MC_DC3_VALUE 0x0
#define MC_DC4_VALUE 0x0
#define MC_DC5_VALUE 0x200
#define MC_DC6_VALUE 0x306
#define MC_DC7_VALUE 0x303
#define MC_DC8_VALUE 0x102
#define MC_DC9_VALUE 0x80B
#define MC_DC10_VALUE 0x203
#define MC_DC11_VALUE 0xD02
#define MC_DC12_VALUE 0x1C8
#define MC_DC13_VALUE 0x1
#define MC_DC14_VALUE 0x0
#define MC_DC15_VALUE 0x144 /* WDQS tuning for clk_wr*/
#define MC_DC16_VALUE 0xC800
#define MC_DC17_VALUE 0xF
#define MC_DC18_VALUE 0x301
#define MC_DC19_VALUE 0x200
#define MC_DC20_VALUE 0xA04 /* A04 for reference board, A03 for Eval board */
#define MC_DC21_VALUE 0x1200
#define MC_DC22_VALUE 0x1212
#define MC_DC23_VALUE 0x0
#define MC_DC24_VALUE 0x66 /* WDQS Tuning for DQS */
#define MC_DC25_VALUE 0x0
#define MC_DC26_VALUE 0x0
#define MC_DC27_VALUE 0x0
#define MC_DC28_VALUE 0x5FB
#define MC_DC29_VALUE 0x35DF
#define MC_DC30_VALUE 0x99E9
#define MC_DC31_VALUE 0x0
#define MC_DC32_VALUE 0x0
#define MC_DC33_VALUE 0x0
#define MC_DC34_VALUE 0x0
#define MC_DC35_VALUE 0x0
#define MC_DC36_VALUE 0x0
#define MC_DC37_VALUE 0x0
#define MC_DC38_VALUE 0x0
#define MC_DC39_VALUE 0x0
#define MC_DC40_VALUE 0x0
#define MC_DC41_VALUE 0x0
#define MC_DC42_VALUE 0x0
#define MC_DC43_VALUE 0x0
#define MC_DC44_VALUE 0x0
#define MC_DC45_VALUE 0x600
//#define MC_DC45_VALUE 0x400
#define MC_DC46_VALUE 0x0

View File

@ -12,7 +12,7 @@ UCI_RELEASE=5
PKG_NAME:=uci
PKG_VERSION:=$(UCI_VERSION)$(if $(UCI_RELEASE),.$(UCI_RELEASE))
PKG_RELEASE:=1
PKG_RELEASE:=2
PKG_REV:=aa3ab8012bfbf793d2884c08ea924545a04e9544
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz

View File

@ -1,6 +1,7 @@
#!/bin/sh
# Shell script compatibility wrappers for /sbin/uci
#
# Copyright (C) 2008-2010 OpenWrt.org
# Copyright (C) 2008 Felix Fietkau <nbd@openwrt.org>
#
# This program is free software; you can redistribute it and/or modify
@ -41,9 +42,9 @@ uci_load() {
uci_set_default() {
local PACKAGE="$1"
/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show "$1" > /dev/null && return 0
/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} import "$1"
/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} commit "$1"
/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show "$PACKAGE" > /dev/null && return 0
/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} import "$PACKAGE"
/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} commit "$PACKAGE"
}
uci_revert_state() {
@ -73,6 +74,23 @@ uci_set() {
/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} set "$PACKAGE.$CONFIG.$OPTION=$VALUE"
}
uci_get_state() {
uci_get "$1" "$2" "$3" "$4" "/var/state"
}
uci_get() {
local PACKAGE="$1"
local CONFIG="$2"
local OPTION="$3"
local DEFAULT="$4"
local STATE="$5"
/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} ${STATE:+-P $STATE} -q get "$PACKAGE${CONFIG:+.$CONFIG}${OPTION:+.$OPTION}"
RET="$?"
[ "$RET" -ne 0 ] && [ -n "$DEFAULT" ] && echo "$DEFAULT"
return "$RET"
}
uci_add() {
local PACKAGE="$1"
local TYPE="$2"

View File

@ -48,7 +48,7 @@ start_instance()
UHTTPD_KEY=""
local cfg="$1"
local realm="$(uci get system.@system[0].hostname 2>/dev/null)"
local realm="$(uci_get system.@system[0].hostname)"
local listen http https
append_arg "$cfg" home "-h"

View File

@ -1,5 +1,5 @@
#
# Copyright (C) 2008 OpenWrt.org
# Copyright (C) 2008-2010 OpenWrt.org
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
@ -9,6 +9,7 @@ include $(INCLUDE_DIR)/kernel.mk
PKG_NAME:=wprobe
PKG_VERSION:=1
PKG_RELEASE:=1
PKG_BUILD_DEPENDS:=PACKAGE_wprobe-export:libipfix

View File

@ -35,7 +35,7 @@ define Image/Build/CyberTAN
$(STAGING_DIR_HOST)/bin/addpattern -4 -p $(3) -v v$(4) -i $(BIN_DIR)/$(IMG_PREFIX)-$(1).trx -o $(BIN_DIR)/openwrt-$(2)-$(5).bin $(if $(6),-s $(6))
endef
define Image/Build/CyberTAN2
$(STAGING_DIR_HOST)/bin/addpattern -4 -p $(3) -v v$(4) -i $(BIN_DIR)/$(IMG_PREFIX)-$(1).trx2 -o $(BIN_DIR)/openwrt-$(2)-$(5).bin $(if $(6),-s $(6))
$(STAGING_DIR_HOST)/bin/addpattern -4 -p $(3) -v v$(4) -i $(BIN_DIR)/openwrt-$(2)-$(5)-sysupgrade.bin -o $(BIN_DIR)/openwrt-$(2)-$(5)-factory.bin $(if $(6),-s $(6))
endef
define Image/Build/CyberTANHead
$(STAGING_DIR_HOST)/bin/addpattern -5 -p $(3) -v v$(4) -i /dev/null -o $(KDIR)/openwrt-$(2)-header.bin $(if $(6),-s $(6))
@ -61,7 +61,7 @@ endef
define Image/Build/trxV2
$(call Image/Build/CyberTANHead,$(1),$(2),$(3),$(4),$(5),$(if $(6),$(6)))
$(STAGING_DIR_HOST)/bin/trx -2 -o $(BIN_DIR)/$(IMG_PREFIX)-$(1).trx2 \
$(STAGING_DIR_HOST)/bin/trx -2 -o $(BIN_DIR)/openwrt-$(2)-$(5)-sysupgrade.bin \
-f $(KDIR)/loader.gz -f $(KDIR)/vmlinux.lzma \
$(call trxalign/$(1),$(1),$(KDIR)/openwrt-$(2)-header.bin)
$(call Image/Build/CyberTAN2,$(1),$(2),$(3),$(4),$(5),$(if $(6),$(6)))

View File

@ -50,7 +50,7 @@
--- /dev/null
+++ b/drivers/usb/host/ehci-ssb.c
@@ -0,0 +1,201 @@
@@ -0,0 +1,158 @@
+/*
+ * Sonics Silicon Backplane
+ * Broadcom USB-core EHCI driver (SSB bus glue)
@ -90,7 +90,6 @@
+ return (struct ssb_ehci_device *)(hcd->hcd_priv);
+}
+
+
+static int ssb_ehci_reset(struct usb_hcd *hcd)
+{
+ struct ehci_hcd *ehci = hcd_to_ehci(hcd);
@ -115,55 +114,11 @@
+ if (err)
+ return err;
+
+ ehci_port_power(ehci, 0);
+ ehci_reset(ehci);
+
+ return err;
+}
+
+static int ssb_ehci_start(struct usb_hcd *hcd)
+{
+ struct ehci_hcd *ehci = hcd_to_ehci(hcd);
+ int err;
+
+ err = ehci_run(hcd);
+ if (err < 0) {
+ ehci_err(ehci, "can't start\n");
+ ehci_stop(hcd);
+ }
+
+ return err;
+}
+
+#ifdef CONFIG_PM
+static int ssb_ehci_hcd_suspend(struct usb_hcd *hcd, pm_message_t message)
+{
+ struct ssb_ehci_device *ehcidev = hcd_to_ssb_ehci(hcd);
+ struct ehci_hcd *ehci = &ehcidev->ehci;
+ unsigned long flags;
+
+ spin_lock_irqsave(&ehci->lock, flags);
+
+ ehci_writel(ehci, EHCI_INTR_MIE, &ehci->regs->intrdisable);
+ ehci_readl(ehci, &ehci->regs->intrdisable); /* commit write */
+
+ /* make sure snapshot being resumed re-enumerates everything */
+ if (message.event == PM_EVENT_PRETHAW)
+ ehci_usb_reset(ehci);
+
+ clear_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags);
+
+ spin_unlock_irqrestore(&ehci->lock, flags);
+ return 0;
+}
+
+static int ssb_ehci_hcd_resume(struct usb_hcd *hcd)
+{
+ set_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags);
+ usb_hcd_resume_root_hub(hcd);
+ return 0;
+}
+#endif /* CONFIG_PM */
+
+static const struct hc_driver ssb_ehci_hc_driver = {
+ .description = "ssb-usb-ehci",
+ .product_desc = "SSB EHCI Controller",
@ -173,35 +128,37 @@
+ .flags = HCD_MEMORY | HCD_USB2,
+
+ .reset = ssb_ehci_reset,
+ .start = ssb_ehci_start,
+ .start = ehci_run,
+ .stop = ehci_stop,
+ .shutdown = ehci_shutdown,
+
+#ifdef CONFIG_PM
+ .suspend = ssb_ehci_hcd_suspend,
+ .resume = ssb_ehci_hcd_resume,
+#endif
+
+ .urb_enqueue = ehci_urb_enqueue,
+ .urb_dequeue = ehci_urb_dequeue,
+ .endpoint_disable = ehci_endpoint_disable,
+ .endpoint_reset = ehci_endpoint_reset,
+
+ .get_frame_number = ehci_get_frame,
+
+ .hub_status_data = ehci_hub_status_data,
+ .hub_control = ehci_hub_control,
+#ifdef CONFIG_PM
+ .bus_suspend = ehci_bus_suspend,
+ .bus_resume = ehci_bus_resume,
+#endif
+ .relinquish_port = ehci_relinquish_port,
+ .port_handed_over = ehci_port_handed_over,
+
+ .clear_tt_buffer_complete = ehci_clear_tt_buffer_complete,
+};
+
+static void ssb_ehci_detach(struct ssb_device *dev, struct usb_hcd *hcd)
+{
+ if (hcd->driver->shutdown)
+ hcd->driver->shutdown(hcd);
+
+ usb_remove_hcd(hcd);
+
+ iounmap(hcd->regs);
+ release_mem_region(hcd->rsrc_start, hcd->rsrc_len);
+
+ usb_put_hcd(hcd);
+}
+EXPORT_SYMBOL_GPL(ssb_ehci_detach);

View File

@ -1,13 +1,13 @@
--- linux-2.6.32.10.orig/drivers/net/bcm63xx_enet.c 2010-04-06 19:25:52.612158288 +0100
+++ linux-2.6.32.10/drivers/net/bcm63xx_enet.c 2010-04-07 21:40:26.991801424 +0100
@@ -965,7 +965,9 @@
/* all set, enable mac and interrupts, start dma engine and
* kick rx dma channel */
wmb();
- enet_writel(priv, ENET_CTL_ENABLE_MASK, ENET_CTL_REG);
+ val = enet_readl(priv, ENET_CTL_REG);
+ val |= ENET_CTL_ENABLE_MASK;
+ enet_writel(priv, val, ENET_CTL_REG);
enet_dma_writel(priv, ENETDMA_CFG_EN_MASK, ENETDMA_CFG_REG);
enet_dma_writel(priv, ENETDMA_CHANCFG_EN_MASK,
ENETDMA_CHANCFG_REG(priv->rx_chan));
--- linux-2.6.32.10.orig/drivers/net/bcm63xx_enet.c 2010-04-06 19:25:52.612158288 +0100
+++ linux-2.6.32.10/drivers/net/bcm63xx_enet.c 2010-04-07 21:40:26.991801424 +0100
@@ -965,7 +965,9 @@
/* all set, enable mac and interrupts, start dma engine and
* kick rx dma channel */
wmb();
- enet_writel(priv, ENET_CTL_ENABLE_MASK, ENET_CTL_REG);
+ val = enet_readl(priv, ENET_CTL_REG);
+ val |= ENET_CTL_ENABLE_MASK;
+ enet_writel(priv, val, ENET_CTL_REG);
enet_dma_writel(priv, ENETDMA_CFG_EN_MASK, ENETDMA_CFG_REG);
enet_dma_writel(priv, ENETDMA_CHANCFG_EN_MASK,
ENETDMA_CHANCFG_REG(priv->rx_chan));

View File

@ -2164,7 +2164,6 @@ CONFIG_SQUASHFS_LZMA=y
CONFIG_SQUASHFS_SUPPORT_ZLIB=y
# CONFIG_SQUASHFS_VMALLOC is not set
CONFIG_SQUASHFS=y
# CONFIG_SSB_BLOCKIO is not set
# CONFIG_SSB_DEBUG is not set
# CONFIG_SSB is not set
# CONFIG_SSB_PCMCIAHOST is not set

View File

@ -2283,7 +2283,6 @@ CONFIG_SQUASHFS_LZMA=y
CONFIG_SQUASHFS_SUPPORT_ZLIB=y
# CONFIG_SQUASHFS_VMALLOC is not set
CONFIG_SQUASHFS=y
# CONFIG_SSB_BLOCKIO is not set
# CONFIG_SSB_DEBUG is not set
# CONFIG_SSB is not set
# CONFIG_SSB_PCMCIAHOST is not set

View File

@ -128,7 +128,170 @@
+EXPORT_SYMBOL(ssb_pmu_set_ldo_paref);
--- a/drivers/ssb/main.c
+++ b/drivers/ssb/main.c
@@ -472,6 +472,8 @@ static int ssb_devices_register(struct s
@@ -120,6 +120,19 @@ static void ssb_device_put(struct ssb_de
put_device(dev->dev);
}
+static inline struct ssb_driver *ssb_driver_get(struct ssb_driver *drv)
+{
+ if (drv)
+ get_driver(&drv->drv);
+ return drv;
+}
+
+static inline void ssb_driver_put(struct ssb_driver *drv)
+{
+ if (drv)
+ put_driver(&drv->drv);
+}
+
static int ssb_device_resume(struct device *dev)
{
struct ssb_device *ssb_dev = dev_to_ssb_dev(dev);
@@ -190,90 +203,81 @@ int ssb_bus_suspend(struct ssb_bus *bus)
EXPORT_SYMBOL(ssb_bus_suspend);
#ifdef CONFIG_SSB_SPROM
-int ssb_devices_freeze(struct ssb_bus *bus)
+/** ssb_devices_freeze - Freeze all devices on the bus.
+ *
+ * After freezing no device driver will be handling a device
+ * on this bus anymore. ssb_devices_thaw() must be called after
+ * a successful freeze to reactivate the devices.
+ *
+ * @bus: The bus.
+ * @ctx: Context structure. Pass this to ssb_devices_thaw().
+ */
+int ssb_devices_freeze(struct ssb_bus *bus, struct ssb_freeze_context *ctx)
{
- struct ssb_device *dev;
- struct ssb_driver *drv;
- int err = 0;
- int i;
- pm_message_t state = PMSG_FREEZE;
+ struct ssb_device *sdev;
+ struct ssb_driver *sdrv;
+ unsigned int i;
+
+ memset(ctx, 0, sizeof(*ctx));
+ ctx->bus = bus;
+ SSB_WARN_ON(bus->nr_devices > ARRAY_SIZE(ctx->device_frozen));
- /* First check that we are capable to freeze all devices. */
for (i = 0; i < bus->nr_devices; i++) {
- dev = &(bus->devices[i]);
- if (!dev->dev ||
- !dev->dev->driver ||
- !device_is_registered(dev->dev))
- continue;
- drv = drv_to_ssb_drv(dev->dev->driver);
- if (!drv)
+ sdev = ssb_device_get(&bus->devices[i]);
+
+ if (!sdev->dev || !sdev->dev->driver ||
+ !device_is_registered(sdev->dev)) {
+ ssb_device_put(sdev);
continue;
- if (!drv->suspend) {
- /* Nope, can't suspend this one. */
- return -EOPNOTSUPP;
}
- }
- /* Now suspend all devices */
- for (i = 0; i < bus->nr_devices; i++) {
- dev = &(bus->devices[i]);
- if (!dev->dev ||
- !dev->dev->driver ||
- !device_is_registered(dev->dev))
- continue;
- drv = drv_to_ssb_drv(dev->dev->driver);
- if (!drv)
+ sdrv = ssb_driver_get(drv_to_ssb_drv(sdev->dev->driver));
+ if (!sdrv || SSB_WARN_ON(!sdrv->remove)) {
+ ssb_device_put(sdev);
continue;
- err = drv->suspend(dev, state);
- if (err) {
- ssb_printk(KERN_ERR PFX "Failed to freeze device %s\n",
- dev_name(dev->dev));
- goto err_unwind;
}
+ sdrv->remove(sdev);
+ ctx->device_frozen[i] = 1;
}
return 0;
-err_unwind:
- for (i--; i >= 0; i--) {
- dev = &(bus->devices[i]);
- if (!dev->dev ||
- !dev->dev->driver ||
- !device_is_registered(dev->dev))
- continue;
- drv = drv_to_ssb_drv(dev->dev->driver);
- if (!drv)
- continue;
- if (drv->resume)
- drv->resume(dev);
- }
- return err;
}
-int ssb_devices_thaw(struct ssb_bus *bus)
+/** ssb_devices_thaw - Unfreeze all devices on the bus.
+ *
+ * This will re-attach the device drivers and re-init the devices.
+ *
+ * @ctx: The context structure from ssb_devices_freeze()
+ */
+int ssb_devices_thaw(struct ssb_freeze_context *ctx)
{
- struct ssb_device *dev;
- struct ssb_driver *drv;
- int err;
- int i;
+ struct ssb_bus *bus = ctx->bus;
+ struct ssb_device *sdev;
+ struct ssb_driver *sdrv;
+ unsigned int i;
+ int err, result = 0;
for (i = 0; i < bus->nr_devices; i++) {
- dev = &(bus->devices[i]);
- if (!dev->dev ||
- !dev->dev->driver ||
- !device_is_registered(dev->dev))
+ if (!ctx->device_frozen[i])
continue;
- drv = drv_to_ssb_drv(dev->dev->driver);
- if (!drv)
+ sdev = &bus->devices[i];
+
+ if (SSB_WARN_ON(!sdev->dev || !sdev->dev->driver))
continue;
- if (SSB_WARN_ON(!drv->resume))
+ sdrv = drv_to_ssb_drv(sdev->dev->driver);
+ if (SSB_WARN_ON(!sdrv || !sdrv->probe))
continue;
- err = drv->resume(dev);
+
+ err = sdrv->probe(sdev, &sdev->id);
if (err) {
ssb_printk(KERN_ERR PFX "Failed to thaw device %s\n",
- dev_name(dev->dev));
+ dev_name(sdev->dev));
+ result = err;
}
+ ssb_driver_put(sdrv);
+ ssb_device_put(sdev);
}
- return 0;
+ return result;
}
#endif /* CONFIG_SSB_SPROM */
@@ -472,6 +476,8 @@ static int ssb_devices_register(struct s
case SSB_BUSTYPE_SSB:
dev->dma_mask = &dev->coherent_dma_mask;
break;
@ -137,7 +300,7 @@
}
sdev->dev = dev;
@@ -1358,8 +1360,10 @@ static int __init ssb_modinit(void)
@@ -1358,8 +1364,10 @@ static int __init ssb_modinit(void)
ssb_buses_lock();
err = ssb_attach_queued_buses();
ssb_buses_unlock();
@ -149,7 +312,7 @@
err = b43_pci_ssb_bridge_init();
if (err) {
@@ -1375,7 +1379,7 @@ static int __init ssb_modinit(void)
@@ -1375,7 +1383,7 @@ static int __init ssb_modinit(void)
/* don't fail SSB init because of this */
err = 0;
}

View File

@ -1,6 +1,14 @@
--- a/drivers/ssb/Kconfig
+++ b/drivers/ssb/Kconfig
@@ -49,7 +49,7 @@ config SSB_PCIHOST
@@ -29,6 +29,7 @@ config SSB_SPROM
config SSB_BLOCKIO
bool
depends on SSB
+ default y
config SSB_PCIHOST_POSSIBLE
bool
@@ -49,7 +50,7 @@ config SSB_PCIHOST
config SSB_B43_PCI_BRIDGE
bool
depends on SSB_PCIHOST

View File

@ -1,6 +1,14 @@
--- a/drivers/ssb/Kconfig
+++ b/drivers/ssb/Kconfig
@@ -49,7 +49,7 @@ config SSB_PCIHOST
@@ -29,6 +29,7 @@ config SSB_SPROM
config SSB_BLOCKIO
bool
depends on SSB
+ default y
config SSB_PCIHOST_POSSIBLE
bool
@@ -49,7 +50,7 @@ config SSB_PCIHOST
config SSB_B43_PCI_BRIDGE
bool
depends on SSB_PCIHOST

View File

@ -28,6 +28,23 @@ set system.wifi_led.mode='link tx rx'
set system.wifi_led.default='0'
commit system
__EOF
# add mac address from U-Boot partition to lan and wan devices
MTD=`grep -e 'u-boot' /proc/mtd`
MTD=`echo ${MTD} | sed 's/[a-z]*\([0-9]*\):.*/\1/'`
[ -n "${MTD}" ] && {
MACADDR=`dd if=/dev/mtdblock${MTD} bs=1 skip=262048 count=6 2>/dev/null | hexdump -e '1/1 "%02x"'`
MACADDR2=$(( 0x${MACADDR} + 1))
MACADDR2=`printf "%012x" ${MACADDR2}`
MACADDR=`echo ${MACADDR} | sed 's/\(..\)/\1:/g' | sed 's/:$//'`
MACADDR2=`echo ${MACADDR2} | sed 's/\(..\)/\1:/g' | sed 's/:$//'`
uci set network.eth0.macaddr=${MACADDR}
uci set network.lan.macaddr=${MACADDR}
uci set network.wan.macaddr=${MACADDR2}
uci commit network
}
}
case "${hardware}" in

View File

@ -55,7 +55,7 @@ endef
define Image/Build
$(CP) $(KDIR)/vmlinux.elf $(BIN_DIR)/$(IMG_PREFIX)-$(1).kernel
$(STAGING_DIR_HOST)/bin/patch-cmdline $(BIN_DIR)/$(IMG_PREFIX)-$(1).kernel '$(strip $(call Image/cmdline/$(1))) '
./gen_image.sh $(BIN_DIR)/$(IMG_PREFIX)-$(1).bin 4 $(BIN_DIR)/$(IMG_PREFIX)-$(1).kernel $(CONFIG_TARGET_ROOTFS_FSPART) $(KDIR)/root.$(1)
./gen_image.sh $(BIN_DIR)/$(IMG_PREFIX)-combined-$(1).bin 4 $(BIN_DIR)/$(IMG_PREFIX)-$(1).kernel $(CONFIG_TARGET_ROOTFS_PARTSIZE) $(KDIR)/root.$(1)
endef
ifneq ($(CONFIG_TARGET_ROOTFS_INITRAMFS),y)

View File

@ -1,243 +1,243 @@
/*
* ar525w RDC321x platform devices
*
* Copyright (C) 2007-2009 OpenWrt.org
* Copyright (C) 2007 Florian Fainelli <florian@openwrt.org>
* Copyright (C) 2008-2009 Daniel Gimpelevich <daniel@gimpelevich.san-francisco.ca.us>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*
*/
#include <linux/init.h>
#include <linux/mtd/physmap.h>
#include <linux/input.h>
#include <linux/vmalloc.h>
#include <linux/mtd/mtd.h>
#include <asm/rdc_boards.h>
struct image_header {
char magic[4]; /* ASICII: GMTK */
u32 checksum; /* CRC32 */
u32 version; /* x.x.x.x */
u32 kernelsz; /* The size of the kernel image */
u32 imagesz; /* The length of this image file ( kernel + romfs + this header) */
u32 pid; /* Product ID */
u32 fastcksum; /* Partial CRC32 on (First(256), medium(256), last(512)) */
u32 reserved;
};
static struct gpio_led ar525w_leds[] = {
{ .name = "rdc321x:dmz", .gpio = 1, .active_low = 1},
};
static struct gpio_button ar525w_btns[] = {
{
.gpio = 6,
.code = BTN_0,
.desc = "Reset",
.active_low = 1,
}
};
static u32 __initdata crctab[257] = {
0x00000000, 0x77073096, 0xee0e612c, 0x990951ba,
0x076dc419, 0x706af48f, 0xe963a535, 0x9e6495a3,
0x0edb8832, 0x79dcb8a4, 0xe0d5e91e, 0x97d2d988,
0x09b64c2b, 0x7eb17cbd, 0xe7b82d07, 0x90bf1d91,
0x1db71064, 0x6ab020f2, 0xf3b97148, 0x84be41de,
0x1adad47d, 0x6ddde4eb, 0xf4d4b551, 0x83d385c7,
0x136c9856, 0x646ba8c0, 0xfd62f97a, 0x8a65c9ec,
0x14015c4f, 0x63066cd9, 0xfa0f3d63, 0x8d080df5,
0x3b6e20c8, 0x4c69105e, 0xd56041e4, 0xa2677172,
0x3c03e4d1, 0x4b04d447, 0xd20d85fd, 0xa50ab56b,
0x35b5a8fa, 0x42b2986c, 0xdbbbc9d6, 0xacbcf940,
0x32d86ce3, 0x45df5c75, 0xdcd60dcf, 0xabd13d59,
0x26d930ac, 0x51de003a, 0xc8d75180, 0xbfd06116,
0x21b4f4b5, 0x56b3c423, 0xcfba9599, 0xb8bda50f,
0x2802b89e, 0x5f058808, 0xc60cd9b2, 0xb10be924,
0x2f6f7c87, 0x58684c11, 0xc1611dab, 0xb6662d3d,
0x76dc4190, 0x01db7106, 0x98d220bc, 0xefd5102a,
0x71b18589, 0x06b6b51f, 0x9fbfe4a5, 0xe8b8d433,
0x7807c9a2, 0x0f00f934, 0x9609a88e, 0xe10e9818,
0x7f6a0dbb, 0x086d3d2d, 0x91646c97, 0xe6635c01,
0x6b6b51f4, 0x1c6c6162, 0x856530d8, 0xf262004e,
0x6c0695ed, 0x1b01a57b, 0x8208f4c1, 0xf50fc457,
0x65b0d9c6, 0x12b7e950, 0x8bbeb8ea, 0xfcb9887c,
0x62dd1ddf, 0x15da2d49, 0x8cd37cf3, 0xfbd44c65,
0x4db26158, 0x3ab551ce, 0xa3bc0074, 0xd4bb30e2,
0x4adfa541, 0x3dd895d7, 0xa4d1c46d, 0xd3d6f4fb,
0x4369e96a, 0x346ed9fc, 0xad678846, 0xda60b8d0,
0x44042d73, 0x33031de5, 0xaa0a4c5f, 0xdd0d7cc9,
0x5005713c, 0x270241aa, 0xbe0b1010, 0xc90c2086,
0x5768b525, 0x206f85b3, 0xb966d409, 0xce61e49f,
0x5edef90e, 0x29d9c998, 0xb0d09822, 0xc7d7a8b4,
0x59b33d17, 0x2eb40d81, 0xb7bd5c3b, 0xc0ba6cad,
0xedb88320, 0x9abfb3b6, 0x03b6e20c, 0x74b1d29a,
0xead54739, 0x9dd277af, 0x04db2615, 0x73dc1683,
0xe3630b12, 0x94643b84, 0x0d6d6a3e, 0x7a6a5aa8,
0xe40ecf0b, 0x9309ff9d, 0x0a00ae27, 0x7d079eb1,
0xf00f9344, 0x8708a3d2, 0x1e01f268, 0x6906c2fe,
0xf762575d, 0x806567cb, 0x196c3671, 0x6e6b06e7,
0xfed41b76, 0x89d32be0, 0x10da7a5a, 0x67dd4acc,
0xf9b9df6f, 0x8ebeeff9, 0x17b7be43, 0x60b08ed5,
0xd6d6a3e8, 0xa1d1937e, 0x38d8c2c4, 0x4fdff252,
0xd1bb67f1, 0xa6bc5767, 0x3fb506dd, 0x48b2364b,
0xd80d2bda, 0xaf0a1b4c, 0x36034af6, 0x41047a60,
0xdf60efc3, 0xa867df55, 0x316e8eef, 0x4669be79,
0xcb61b38c, 0xbc66831a, 0x256fd2a0, 0x5268e236,
0xcc0c7795, 0xbb0b4703, 0x220216b9, 0x5505262f,
0xc5ba3bbe, 0xb2bd0b28, 0x2bb45a92, 0x5cb36a04,
0xc2d7ffa7, 0xb5d0cf31, 0x2cd99e8b, 0x5bdeae1d,
0x9b64c2b0, 0xec63f226, 0x756aa39c, 0x026d930a,
0x9c0906a9, 0xeb0e363f, 0x72076785, 0x05005713,
0x95bf4a82, 0xe2b87a14, 0x7bb12bae, 0x0cb61b38,
0x92d28e9b, 0xe5d5be0d, 0x7cdcefb7, 0x0bdbdf21,
0x86d3d2d4, 0xf1d4e242, 0x68ddb3f8, 0x1fda836e,
0x81be16cd, 0xf6b9265b, 0x6fb077e1, 0x18b74777,
0x88085ae6, 0xff0f6a70, 0x66063bca, 0x11010b5c,
0x8f659eff, 0xf862ae69, 0x616bffd3, 0x166ccf45,
0xa00ae278, 0xd70dd2ee, 0x4e048354, 0x3903b3c2,
0xa7672661, 0xd06016f7, 0x4969474d, 0x3e6e77db,
0xaed16a4a, 0xd9d65adc, 0x40df0b66, 0x37d83bf0,
0xa9bcae53, 0xdebb9ec5, 0x47b2cf7f, 0x30b5ffe9,
0xbdbdf21c, 0xcabac28a, 0x53b39330, 0x24b4a3a6,
0xbad03605, 0xcdd70693, 0x54de5729, 0x23d967bf,
0xb3667a2e, 0xc4614ab8, 0x5d681b02, 0x2a6f2b94,
0xb40bbe37, 0xc30c8ea1, 0x5a05df1b, 0x2d02ef8d,
0
};
static u32 __init crc32(u8 * buf, u32 len)
{
register int i;
u32 sum;
register u32 s0;
s0 = ~0;
for (i = 0; i < len; i++) {
s0 = (s0 >> 8) ^ crctab[(u8) (s0 & 0xFF) ^ buf[i]];
}
sum = ~s0;
return sum;
}
static int __init fixup_ar525w_header(struct mtd_info *master, struct image_header *header)
{
char *buffer;
int res;
u32 bufferlength = header->kernelsz + sizeof(struct image_header);
u32 len;
char crcbuf[0x400];
printk(KERN_INFO "Fixing up AR525W header, old image size: %u, new image size: %u\n",
header->imagesz, bufferlength);
buffer = vmalloc(bufferlength);
if (!buffer) {
printk(KERN_ERR "Can't allocate %u bytes\n", bufferlength);
return -ENOMEM;
}
res = master->read(master, 0x0, bufferlength, &len, buffer);
if (res || len != bufferlength)
goto out;
header = (struct image_header *) buffer;
header->imagesz = bufferlength;
header->checksum = 0;
header->fastcksum = 0;
memcpy(crcbuf, buffer, 0x100);
memcpy(crcbuf + 0x100, buffer + (bufferlength >> 1) - ((bufferlength & 0x6) >> 1), 0x100);
memcpy(crcbuf + 0x200, buffer + bufferlength - 0x200, 0x200);
header->fastcksum = crc32(crcbuf, sizeof(crcbuf));
header->checksum = crc32(buffer, bufferlength);
if (master->unlock)
master->unlock(master, 0, master->erasesize);
res = erase_write (master, 0, master->erasesize, buffer);
if (res)
printk(KERN_ERR "Can't rewrite image header\n");
out:
vfree(buffer);
return res;
}
static int __init parse_ar525w_partitions(struct mtd_info *master, struct mtd_partition **pparts, unsigned long plat_data)
{
struct image_header header;
int res;
size_t len;
struct mtd_partition *rdc_flash_parts;
struct rdc_platform_data *pdata = (struct rdc_platform_data *) plat_data;
if (master->size != 0x400000) //4MB
return -ENOSYS;
res = master->read(master, 0x0, sizeof(header), &len, (char *)&header);
if (res)
return res;
if (strncmp(header.magic, "GMTK", 4))
return -ENOSYS;
if (header.kernelsz > 0x400000 || header.kernelsz < master->erasesize) {
printk(KERN_ERR "AR525W image header found, but seems corrupt, kernel size %u\n", header.kernelsz);
return -EINVAL;
}
if (header.kernelsz + sizeof(header) != header.imagesz) {
res = fixup_ar525w_header(master, &header);
if (res)
return res;
}
rdc_flash_parts = kzalloc(sizeof(struct mtd_partition) * 3, GFP_KERNEL);
rdc_flash_parts[0].name = "firmware";
rdc_flash_parts[0].offset = 0x0;
rdc_flash_parts[0].size = 0x3E0000;
rdc_flash_parts[1].name = "rootfs";
rdc_flash_parts[1].offset = header.kernelsz + sizeof(header);
rdc_flash_parts[1].size = rdc_flash_parts[0].size - rdc_flash_parts[1].offset;
rdc_flash_parts[2].name = "bootloader";
rdc_flash_parts[2].offset = 0x3E0000;
rdc_flash_parts[2].size = 0x20000;
*pparts = rdc_flash_parts;
pdata->led_data.num_leds = ARRAY_SIZE(ar525w_leds);
pdata->led_data.leds = ar525w_leds;
pdata->button_data.nbuttons = ARRAY_SIZE(ar525w_btns);
pdata->button_data.buttons = ar525w_btns;
return 3;
}
static struct mtd_part_parser __initdata ar525w_parser = {
.owner = THIS_MODULE,
.parse_fn = parse_ar525w_partitions,
.name = "AR525W",
};
static int __init ar525w_setup(void)
{
return register_mtd_parser(&ar525w_parser);
}
arch_initcall(ar525w_setup);
/*
* ar525w RDC321x platform devices
*
* Copyright (C) 2007-2009 OpenWrt.org
* Copyright (C) 2007 Florian Fainelli <florian@openwrt.org>
* Copyright (C) 2008-2009 Daniel Gimpelevich <daniel@gimpelevich.san-francisco.ca.us>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*
*/
#include <linux/init.h>
#include <linux/mtd/physmap.h>
#include <linux/input.h>
#include <linux/vmalloc.h>
#include <linux/mtd/mtd.h>
#include <asm/rdc_boards.h>
struct image_header {
char magic[4]; /* ASICII: GMTK */
u32 checksum; /* CRC32 */
u32 version; /* x.x.x.x */
u32 kernelsz; /* The size of the kernel image */
u32 imagesz; /* The length of this image file ( kernel + romfs + this header) */
u32 pid; /* Product ID */
u32 fastcksum; /* Partial CRC32 on (First(256), medium(256), last(512)) */
u32 reserved;
};
static struct gpio_led ar525w_leds[] = {
{ .name = "rdc321x:dmz", .gpio = 1, .active_low = 1},
};
static struct gpio_button ar525w_btns[] = {
{
.gpio = 6,
.code = BTN_0,
.desc = "Reset",
.active_low = 1,
}
};
static u32 __initdata crctab[257] = {
0x00000000, 0x77073096, 0xee0e612c, 0x990951ba,
0x076dc419, 0x706af48f, 0xe963a535, 0x9e6495a3,
0x0edb8832, 0x79dcb8a4, 0xe0d5e91e, 0x97d2d988,
0x09b64c2b, 0x7eb17cbd, 0xe7b82d07, 0x90bf1d91,
0x1db71064, 0x6ab020f2, 0xf3b97148, 0x84be41de,
0x1adad47d, 0x6ddde4eb, 0xf4d4b551, 0x83d385c7,
0x136c9856, 0x646ba8c0, 0xfd62f97a, 0x8a65c9ec,
0x14015c4f, 0x63066cd9, 0xfa0f3d63, 0x8d080df5,
0x3b6e20c8, 0x4c69105e, 0xd56041e4, 0xa2677172,
0x3c03e4d1, 0x4b04d447, 0xd20d85fd, 0xa50ab56b,
0x35b5a8fa, 0x42b2986c, 0xdbbbc9d6, 0xacbcf940,
0x32d86ce3, 0x45df5c75, 0xdcd60dcf, 0xabd13d59,
0x26d930ac, 0x51de003a, 0xc8d75180, 0xbfd06116,
0x21b4f4b5, 0x56b3c423, 0xcfba9599, 0xb8bda50f,
0x2802b89e, 0x5f058808, 0xc60cd9b2, 0xb10be924,
0x2f6f7c87, 0x58684c11, 0xc1611dab, 0xb6662d3d,
0x76dc4190, 0x01db7106, 0x98d220bc, 0xefd5102a,
0x71b18589, 0x06b6b51f, 0x9fbfe4a5, 0xe8b8d433,
0x7807c9a2, 0x0f00f934, 0x9609a88e, 0xe10e9818,
0x7f6a0dbb, 0x086d3d2d, 0x91646c97, 0xe6635c01,
0x6b6b51f4, 0x1c6c6162, 0x856530d8, 0xf262004e,
0x6c0695ed, 0x1b01a57b, 0x8208f4c1, 0xf50fc457,
0x65b0d9c6, 0x12b7e950, 0x8bbeb8ea, 0xfcb9887c,
0x62dd1ddf, 0x15da2d49, 0x8cd37cf3, 0xfbd44c65,
0x4db26158, 0x3ab551ce, 0xa3bc0074, 0xd4bb30e2,
0x4adfa541, 0x3dd895d7, 0xa4d1c46d, 0xd3d6f4fb,
0x4369e96a, 0x346ed9fc, 0xad678846, 0xda60b8d0,
0x44042d73, 0x33031de5, 0xaa0a4c5f, 0xdd0d7cc9,
0x5005713c, 0x270241aa, 0xbe0b1010, 0xc90c2086,
0x5768b525, 0x206f85b3, 0xb966d409, 0xce61e49f,
0x5edef90e, 0x29d9c998, 0xb0d09822, 0xc7d7a8b4,
0x59b33d17, 0x2eb40d81, 0xb7bd5c3b, 0xc0ba6cad,
0xedb88320, 0x9abfb3b6, 0x03b6e20c, 0x74b1d29a,
0xead54739, 0x9dd277af, 0x04db2615, 0x73dc1683,
0xe3630b12, 0x94643b84, 0x0d6d6a3e, 0x7a6a5aa8,
0xe40ecf0b, 0x9309ff9d, 0x0a00ae27, 0x7d079eb1,
0xf00f9344, 0x8708a3d2, 0x1e01f268, 0x6906c2fe,
0xf762575d, 0x806567cb, 0x196c3671, 0x6e6b06e7,
0xfed41b76, 0x89d32be0, 0x10da7a5a, 0x67dd4acc,
0xf9b9df6f, 0x8ebeeff9, 0x17b7be43, 0x60b08ed5,
0xd6d6a3e8, 0xa1d1937e, 0x38d8c2c4, 0x4fdff252,
0xd1bb67f1, 0xa6bc5767, 0x3fb506dd, 0x48b2364b,
0xd80d2bda, 0xaf0a1b4c, 0x36034af6, 0x41047a60,
0xdf60efc3, 0xa867df55, 0x316e8eef, 0x4669be79,
0xcb61b38c, 0xbc66831a, 0x256fd2a0, 0x5268e236,
0xcc0c7795, 0xbb0b4703, 0x220216b9, 0x5505262f,
0xc5ba3bbe, 0xb2bd0b28, 0x2bb45a92, 0x5cb36a04,
0xc2d7ffa7, 0xb5d0cf31, 0x2cd99e8b, 0x5bdeae1d,
0x9b64c2b0, 0xec63f226, 0x756aa39c, 0x026d930a,
0x9c0906a9, 0xeb0e363f, 0x72076785, 0x05005713,
0x95bf4a82, 0xe2b87a14, 0x7bb12bae, 0x0cb61b38,
0x92d28e9b, 0xe5d5be0d, 0x7cdcefb7, 0x0bdbdf21,
0x86d3d2d4, 0xf1d4e242, 0x68ddb3f8, 0x1fda836e,
0x81be16cd, 0xf6b9265b, 0x6fb077e1, 0x18b74777,
0x88085ae6, 0xff0f6a70, 0x66063bca, 0x11010b5c,
0x8f659eff, 0xf862ae69, 0x616bffd3, 0x166ccf45,
0xa00ae278, 0xd70dd2ee, 0x4e048354, 0x3903b3c2,
0xa7672661, 0xd06016f7, 0x4969474d, 0x3e6e77db,
0xaed16a4a, 0xd9d65adc, 0x40df0b66, 0x37d83bf0,
0xa9bcae53, 0xdebb9ec5, 0x47b2cf7f, 0x30b5ffe9,
0xbdbdf21c, 0xcabac28a, 0x53b39330, 0x24b4a3a6,
0xbad03605, 0xcdd70693, 0x54de5729, 0x23d967bf,
0xb3667a2e, 0xc4614ab8, 0x5d681b02, 0x2a6f2b94,
0xb40bbe37, 0xc30c8ea1, 0x5a05df1b, 0x2d02ef8d,
0
};
static u32 __init crc32(u8 * buf, u32 len)
{
register int i;
u32 sum;
register u32 s0;
s0 = ~0;
for (i = 0; i < len; i++) {
s0 = (s0 >> 8) ^ crctab[(u8) (s0 & 0xFF) ^ buf[i]];
}
sum = ~s0;
return sum;
}
static int __init fixup_ar525w_header(struct mtd_info *master, struct image_header *header)
{
char *buffer;
int res;
u32 bufferlength = header->kernelsz + sizeof(struct image_header);
u32 len;
char crcbuf[0x400];
printk(KERN_INFO "Fixing up AR525W header, old image size: %u, new image size: %u\n",
header->imagesz, bufferlength);
buffer = vmalloc(bufferlength);
if (!buffer) {
printk(KERN_ERR "Can't allocate %u bytes\n", bufferlength);
return -ENOMEM;
}
res = master->read(master, 0x0, bufferlength, &len, buffer);
if (res || len != bufferlength)
goto out;
header = (struct image_header *) buffer;
header->imagesz = bufferlength;
header->checksum = 0;
header->fastcksum = 0;
memcpy(crcbuf, buffer, 0x100);
memcpy(crcbuf + 0x100, buffer + (bufferlength >> 1) - ((bufferlength & 0x6) >> 1), 0x100);
memcpy(crcbuf + 0x200, buffer + bufferlength - 0x200, 0x200);
header->fastcksum = crc32(crcbuf, sizeof(crcbuf));
header->checksum = crc32(buffer, bufferlength);
if (master->unlock)
master->unlock(master, 0, master->erasesize);
res = erase_write (master, 0, master->erasesize, buffer);
if (res)
printk(KERN_ERR "Can't rewrite image header\n");
out:
vfree(buffer);
return res;
}
static int __init parse_ar525w_partitions(struct mtd_info *master, struct mtd_partition **pparts, unsigned long plat_data)
{
struct image_header header;
int res;
size_t len;
struct mtd_partition *rdc_flash_parts;
struct rdc_platform_data *pdata = (struct rdc_platform_data *) plat_data;
if (master->size != 0x400000) //4MB
return -ENOSYS;
res = master->read(master, 0x0, sizeof(header), &len, (char *)&header);
if (res)
return res;
if (strncmp(header.magic, "GMTK", 4))
return -ENOSYS;
if (header.kernelsz > 0x400000 || header.kernelsz < master->erasesize) {
printk(KERN_ERR "AR525W image header found, but seems corrupt, kernel size %u\n", header.kernelsz);
return -EINVAL;
}
if (header.kernelsz + sizeof(header) != header.imagesz) {
res = fixup_ar525w_header(master, &header);
if (res)
return res;
}
rdc_flash_parts = kzalloc(sizeof(struct mtd_partition) * 3, GFP_KERNEL);
rdc_flash_parts[0].name = "firmware";
rdc_flash_parts[0].offset = 0x0;
rdc_flash_parts[0].size = 0x3E0000;
rdc_flash_parts[1].name = "rootfs";
rdc_flash_parts[1].offset = header.kernelsz + sizeof(header);
rdc_flash_parts[1].size = rdc_flash_parts[0].size - rdc_flash_parts[1].offset;
rdc_flash_parts[2].name = "bootloader";
rdc_flash_parts[2].offset = 0x3E0000;
rdc_flash_parts[2].size = 0x20000;
*pparts = rdc_flash_parts;
pdata->led_data.num_leds = ARRAY_SIZE(ar525w_leds);
pdata->led_data.leds = ar525w_leds;
pdata->button_data.nbuttons = ARRAY_SIZE(ar525w_btns);
pdata->button_data.buttons = ar525w_btns;
return 3;
}
static struct mtd_part_parser __initdata ar525w_parser = {
.owner = THIS_MODULE,
.parse_fn = parse_ar525w_partitions,
.name = "AR525W",
};
static int __init ar525w_setup(void)
{
return register_mtd_parser(&ar525w_parser);
}
arch_initcall(ar525w_setup);

View File

@ -1,91 +1,74 @@
config X86_GRUB_IMAGES
bool "Build GRUB images (Linux x86 or x86_64 host only)"
depends TARGET_x86 && !TARGET_x86_olpc
depends TARGET_ROOTFS_EXT2FS || TARGET_ROOTFS_JFFS2 || TARGET_ROOTFS_SQUASHFS || TARGET_ROOTFS_ISO
select PACKAGE_grub
default y
config X86_GRUB_IMAGES_PAD
bool "Pad GRUB images to filesystem size (for JFFS2)"
depends X86_GRUB_IMAGES
bool "Build GRUB images (Linux x86 or x86_64 host only)"
depends TARGET_x86 && !TARGET_x86_olpc
depends TARGET_ROOTFS_EXT2FS || TARGET_ROOTFS_ISO || TARGET_ROOTFS_JFFS2 || TARGET_ROOTFS_SQUASHFS
select PACKAGE_grub
default y
config X86_GRUB_CONSOLE
bool
depends X86_GRUB_IMAGES
prompt "Use Console Terminal (in addition to Serial)"
default n if TARGET_x86_generic_Soekris48xx || TARGET_x86_generic_Soekris45xx || TARGET_x86_net5501
default y if ! (TARGET_x86_generic_Soekris48xx || TARGET_x86_generic_Soekris45xx || TARGET_x86_net5501)
bool "Use Console Terminal (in addition to Serial)"
depends X86_GRUB_IMAGES
default n if (TARGET_x86_generic_Soekris45xx || TARGET_x86_generic_Soekris48xx || TARGET_x86_net5501)
default y
config X86_GRUB_SERIAL
string
prompt "Serial port device"
depends X86_GRUB_IMAGES
default "hvc0" if TARGET_x86_xen_domu
default "ttyS0" if ! TARGET_x86_xen_domu
string "Serial port device"
depends X86_GRUB_IMAGES
default "hvc0" if TARGET_x86_xen_domu
default "ttyS0"
config X86_GRUB_BAUDRATE
int "Serial port baud rate"
depends X86_GRUB_IMAGES
default 19200 if TARGET_x86_generic_Soekris48xx || TARGET_x86_generic_Soekris45xx || TARGET_x86_net5501
default 38400 if ! (TARGET_x86_generic_Soekris48xx || TARGET_x86_generic_Soekris45xx || TARGET_x86_net5501)
config X86_GRUB_KERNELPART
int "Kernel partition size (in MB)"
depends X86_GRUB_IMAGES
default 4
config X86_GRUB_ROOTPART
string
prompt "Root partition on target device" if X86_GRUB_IMAGES
default "/dev/xvda2" if TARGET_x86_xen_domu
default "/dev/sda2" if ! TARGET_x86_xen_domu
help
The root partition on the final device. If you don't know,
you probably want the default (/dev/sda2).
int "Serial port baud rate"
depends X86_GRUB_IMAGES
default 19200 if TARGET_x86_generic_Soekris45xx || TARGET_x86_generic_Soekris48xx || TARGET_x86_net5501
default 38400
config X86_GRUB_BOOTOPTS
string
prompt "Extra kernel boot options" if X86_GRUB_IMAGES
default "xencons=hvc" if TARGET_x86_xen_domu
default "" if ! TARGET_x86_xen_domu
help
If you don't know, just leave it blank.
string "Extra kernel boot options"
depends X86_GRUB_IMAGES
default "xencons=hvc" if TARGET_x86_xen_domu
help
If you don't know, just leave it blank.
config X86_VDI_IMAGES
bool "Build VirtualBox image files (VDI). Requires VBoxManage"
depends TARGET_x86_generic
depends TARGET_ROOTFS_EXT2FS
depends X86_GRUB_IMAGES
select PACKAGE_kmod-pcnet32
bool "Build VirtualBox image files (VDI)"
depends X86_GRUB_IMAGES
depends TARGET_x86_generic
depends TARGET_ROOTFS_EXT2FS
select PACKAGE_kmod-pcnet32
help
Requires VBoxManage installed on the build system.
config X86_VMDK_IMAGES
bool "Build VMware image files (VMDK). Requires qemu-img"
depends TARGET_x86_generic
depends TARGET_ROOTFS_EXT2FS
depends X86_GRUB_IMAGES
select PACKAGE_kmod-e1000
bool "Build VMware image files (VMDK)"
depends X86_GRUB_IMAGES
depends TARGET_x86_generic
depends TARGET_ROOTFS_EXT2FS
select PACKAGE_kmod-e1000
help
Requires qemu-img installed on the build system.
config OLPC_BOOTSCRIPT_IMAGES
bool "Build images with bootscript"
depends TARGET_x86_olpc
depends TARGET_ROOTFS_EXT2FS || TARGET_ROOTFS_JFFS2 || TARGET_ROOTFS_SQUASHFS || TARGET_ROOTFS_ISO
default y
bool "Build images with bootscript"
depends TARGET_x86_olpc
depends TARGET_ROOTFS_EXT2FS || TARGET_ROOTFS_ISO || TARGET_ROOTFS_JFFS2 || TARGET_ROOTFS_SQUASHFS
config OLPC_BOOTSCRIPT_IMAGES_PAD
bool "Pad bootscript images to filesystem size (for JFFS2)"
depends OLPC_BOOTSCRIPT_IMAGES
config OLPC_BOOTSCRIPT_KERNELPART
int "Kernel partition size (in MB)"
depends OLPC_BOOTSCRIPT_IMAGES
default 4
config TARGET_IMAGES_PAD
bool "Pad images to filesystem size (for JFFS2)"
depends OLPC_BOOTSCRIPT_IMAGES || X86_GRUB_IMAGES
config OLPC_BOOTSCRIPT_ROOTPART
string
prompt "Root partition on target device" if OLPC_BOOTSCRIPT_IMAGES
default "/dev/sda2"
help
The root partition on the final device. If you don't know,
you probably want the default (/dev/sda2).
config TARGET_KERNEL_PARTSIZE
int "Kernel partition size (in MB)"
depends OLPC_BOOTSCRIPT_IMAGES || X86_GRUB_IMAGES
default 4
config TARGET_ROOTFS_PARTNAME
string "Root partition on target device"
depends OLPC_BOOTSCRIPT_IMAGES || X86_GRUB_IMAGES
default "/dev/xvda2" if TARGET_x86_xen_domu
default "/dev/sda2"
help
The root partition on the final device. If you don't know,
you probably want the default (/dev/sda2).

View File

@ -29,12 +29,12 @@ ifneq ($(GRUB_TERMINALS),)
GRUB_TERMINAL_CONFIG := terminal --timeout=2 $(GRUB_TERMINALS)
endif
ROOTPART:=$(call qstrip,$(CONFIG_TARGET_ROOTFS_PARTNAME))
ifneq ($(CONFIG_X86_GRUB_IMAGES),)
ifneq ($(HOST_OS),Darwin)
BOOTOPTS:=$(call qstrip,$(CONFIG_X86_GRUB_BOOTOPTS))
ROOTPART:=$(call qstrip,$(CONFIG_X86_GRUB_ROOTPART))
define Image/cmdline/ext2
root=$(ROOTPART) rootfstype=ext2 rootwait
@ -66,10 +66,10 @@ ifneq ($(CONFIG_X86_GRUB_IMAGES),)
-e 's#@TERMINAL_CONFIG@#$(strip $(GRUB_TERMINAL_CONFIG))#g' \
-e 's#@CMDLINE@#$(strip $(call Image/cmdline/$(1)) $(BOOTOPTS) $(GRUB_CONSOLE_CMDLINE))#g' \
./menu.lst > $(KDIR)/root.grub/boot/grub/menu.lst
PADDING="$(CONFIG_X86_GRUB_IMAGES_PAD)" PATH="$(TARGET_PATH)" ./gen_image_x86.sh \
PADDING="$(CONFIG_TARGET_IMAGES_PAD)" PATH="$(TARGET_PATH)" ./gen_image_x86.sh \
$(BIN_DIR)/$(IMG_PREFIX)-combined-$(1).img \
$(CONFIG_X86_GRUB_KERNELPART) $(KDIR)/root.grub \
$(CONFIG_TARGET_ROOTFS_FSPART) $(KDIR)/root.$(1)
$(CONFIG_TARGET_KERNEL_PARTSIZE) $(KDIR)/root.grub \
$(CONFIG_TARGET_ROOTFS_PARTSIZE) $(KDIR)/root.$(1)
$(call Image/Build/grub/$(1))
endef
@ -88,8 +88,8 @@ ifneq ($(CONFIG_X86_GRUB_IMAGES),)
define Image/Build/grub
PADDING="$(CONFIG_X86_GRUB_IMAGES_PAD)" PATH="$(TARGET_PATH)" NOGRUB=1 ./gen_image_x86.sh \
$(BIN_DIR)/$(IMG_PREFIX)-combined-$(1).img \
$(CONFIG_X86_GRUB_KERNELPART) "" \
$(CONFIG_TARGET_ROOTFS_FSPART) $(KDIR)/root.$(1)
$(CONFIG_TARGET_KERNEL_PARTSIZE) "" \
$(CONFIG_TARGET_ROOTFS_PARTSIZE) $(KDIR)/root.$(1)
endef
endif
@ -99,8 +99,6 @@ ROOTDELAY=10
ifneq ($(CONFIG_OLPC_BOOTSCRIPT_IMAGES),)
ROOTPART:=$(call qstrip,$(CONFIG_OLPC_BOOTSCRIPT_ROOTPART))
define Image/cmdline/ext2
root=$(ROOTPART) rootfstype=ext2 rootwait
endef
@ -123,10 +121,10 @@ ifneq ($(CONFIG_OLPC_BOOTSCRIPT_IMAGES),)
$(CP) $(KDIR)/bzImage $(KDIR)/root.bootscript/boot/vmlinuz
sed -e 's#@CMDLINE@#$(strip $(call Image/cmdline/$(1))) $(BOOTOPTS)#g' \
./olpc.fth > $(KDIR)/root.bootscript/boot/olpc.fth
PADDING="$(CONFIG_OLPC_BOOTSCRIPT_IMAGES_PAD)" PATH="$(TARGET_PATH)" ./gen_image_olpc.sh \
PADDING="$(CONFIG_TARGET_IMAGES_PAD)" PATH="$(TARGET_PATH)" ./gen_image_olpc.sh \
$(BIN_DIR)/$(IMG_PREFIX)-combined-$(1).img \
$(CONFIG_OLPC_BOOTSCRIPT_KERNELPART) $(KDIR)/root.bootscript \
$(CONFIG_TARGET_ROOTFS_FSPART) $(KDIR)/root.$(1)
$(CONFIG_TARGET_KERNEL_PARTSIZE) $(KDIR)/root.bootscript \
$(CONFIG_TARGET_ROOTFS_PARTSIZE) $(KDIR)/root.$(1)
endef
endif

View File

@ -1,42 +1,42 @@
#
# linux/arch/mips/boot/compressed/Makefile
#
# create a compressed zImage from the original vmlinux
#
targets := zImage vmlinuz vmlinux.bin.gz head.o misc.o piggy.o dummy.o
OBJS := $(obj)/head.o $(obj)/misc.o
LD_ARGS := -T $(obj)/ld.script -Ttext 0x80600000 -Bstatic
OBJCOPY_ARGS := -O elf32-tradlittlemips
ENTRY := $(obj)/../tools/entry
FILESIZE := $(obj)/../tools/filesize
drop-sections = .reginfo .mdebug .comment .note .pdr .options .MIPS.options
strip-flags = $(addprefix --remove-section=,$(drop-sections))
$(obj)/vmlinux.bin.gz: vmlinux
rm -f $(obj)/vmlinux.bin.gz
$(OBJCOPY) -O binary $(strip-flags) vmlinux $(obj)/vmlinux.bin
gzip -v9f $(obj)/vmlinux.bin
$(obj)/head.o: $(obj)/head.S $(obj)/vmlinux.bin.gz vmlinux
$(CC) $(KBUILD_AFLAGS) \
-DIMAGESIZE=$(shell sh $(FILESIZE) $(obj)/vmlinux.bin.gz) \
-DKERNEL_ENTRY=$(shell sh $(ENTRY) $(NM) vmlinux ) \
-DLOADADDR=$(loadaddr) \
-c -o $(obj)/head.o $<
$(obj)/vmlinuz: $(OBJS) $(obj)/ld.script $(obj)/vmlinux.bin.gz $(obj)/dummy.o
$(OBJCOPY) \
--add-section=.image=$(obj)/vmlinux.bin.gz \
--set-section-flags=.image=contents,alloc,load,readonly,data \
$(obj)/dummy.o $(obj)/piggy.o
$(LD) $(LD_ARGS) -o $@ $(OBJS) $(obj)/piggy.o
$(OBJCOPY) $(OBJCOPY_ARGS) $@ $@ -R .comment -R .stab -R .stabstr -R .initrd -R .sysmap
zImage: $(obj)/vmlinuz
$(OBJCOPY) -O binary $(obj)/vmlinuz $(obj)/zImage
#
# linux/arch/mips/boot/compressed/Makefile
#
# create a compressed zImage from the original vmlinux
#
targets := zImage vmlinuz vmlinux.bin.gz head.o misc.o piggy.o dummy.o
OBJS := $(obj)/head.o $(obj)/misc.o
LD_ARGS := -T $(obj)/ld.script -Ttext 0x80600000 -Bstatic
OBJCOPY_ARGS := -O elf32-tradlittlemips
ENTRY := $(obj)/../tools/entry
FILESIZE := $(obj)/../tools/filesize
drop-sections = .reginfo .mdebug .comment .note .pdr .options .MIPS.options
strip-flags = $(addprefix --remove-section=,$(drop-sections))
$(obj)/vmlinux.bin.gz: vmlinux
rm -f $(obj)/vmlinux.bin.gz
$(OBJCOPY) -O binary $(strip-flags) vmlinux $(obj)/vmlinux.bin
gzip -v9f $(obj)/vmlinux.bin
$(obj)/head.o: $(obj)/head.S $(obj)/vmlinux.bin.gz vmlinux
$(CC) $(KBUILD_AFLAGS) \
-DIMAGESIZE=$(shell sh $(FILESIZE) $(obj)/vmlinux.bin.gz) \
-DKERNEL_ENTRY=$(shell sh $(ENTRY) $(NM) vmlinux ) \
-DLOADADDR=$(loadaddr) \
-c -o $(obj)/head.o $<
$(obj)/vmlinuz: $(OBJS) $(obj)/ld.script $(obj)/vmlinux.bin.gz $(obj)/dummy.o
$(OBJCOPY) \
--add-section=.image=$(obj)/vmlinux.bin.gz \
--set-section-flags=.image=contents,alloc,load,readonly,data \
$(obj)/dummy.o $(obj)/piggy.o
$(LD) $(LD_ARGS) -o $@ $(OBJS) $(obj)/piggy.o
$(OBJCOPY) $(OBJCOPY_ARGS) $@ $@ -R .comment -R .stab -R .stabstr -R .initrd -R .sysmap
zImage: $(obj)/vmlinuz
$(OBJCOPY) -O binary $(obj)/vmlinuz $(obj)/zImage

View File

@ -1,204 +1,204 @@
/*
* calculate ecc code for nand flash
*
* Copyright (C) 2008 yajin <yajin@vm-kernel.org>
* Copyright (C) 2009 Felix Fietkau <nbd@openwrt.org>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 or
* (at your option) version 3 of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
* MA 02111-1307 USA
*/
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <stdlib.h>
#include <stdint.h>
#include <fcntl.h>
#include <stdio.h>
#define DEF_NAND_PAGE_SIZE 2048
#define DEF_NAND_OOB_SIZE 64
#define DEF_NAND_ECC_OFFSET 0x28
static int page_size = DEF_NAND_PAGE_SIZE;
static int oob_size = DEF_NAND_OOB_SIZE;
static int ecc_offset = DEF_NAND_ECC_OFFSET;
/*
* Pre-calculated 256-way 1 byte column parity
*/
static const uint8_t nand_ecc_precalc_table[] = {
0x00, 0x55, 0x56, 0x03, 0x59, 0x0c, 0x0f, 0x5a, 0x5a, 0x0f, 0x0c, 0x59, 0x03, 0x56, 0x55, 0x00,
0x65, 0x30, 0x33, 0x66, 0x3c, 0x69, 0x6a, 0x3f, 0x3f, 0x6a, 0x69, 0x3c, 0x66, 0x33, 0x30, 0x65,
0x66, 0x33, 0x30, 0x65, 0x3f, 0x6a, 0x69, 0x3c, 0x3c, 0x69, 0x6a, 0x3f, 0x65, 0x30, 0x33, 0x66,
0x03, 0x56, 0x55, 0x00, 0x5a, 0x0f, 0x0c, 0x59, 0x59, 0x0c, 0x0f, 0x5a, 0x00, 0x55, 0x56, 0x03,
0x69, 0x3c, 0x3f, 0x6a, 0x30, 0x65, 0x66, 0x33, 0x33, 0x66, 0x65, 0x30, 0x6a, 0x3f, 0x3c, 0x69,
0x0c, 0x59, 0x5a, 0x0f, 0x55, 0x00, 0x03, 0x56, 0x56, 0x03, 0x00, 0x55, 0x0f, 0x5a, 0x59, 0x0c,
0x0f, 0x5a, 0x59, 0x0c, 0x56, 0x03, 0x00, 0x55, 0x55, 0x00, 0x03, 0x56, 0x0c, 0x59, 0x5a, 0x0f,
0x6a, 0x3f, 0x3c, 0x69, 0x33, 0x66, 0x65, 0x30, 0x30, 0x65, 0x66, 0x33, 0x69, 0x3c, 0x3f, 0x6a,
0x6a, 0x3f, 0x3c, 0x69, 0x33, 0x66, 0x65, 0x30, 0x30, 0x65, 0x66, 0x33, 0x69, 0x3c, 0x3f, 0x6a,
0x0f, 0x5a, 0x59, 0x0c, 0x56, 0x03, 0x00, 0x55, 0x55, 0x00, 0x03, 0x56, 0x0c, 0x59, 0x5a, 0x0f,
0x0c, 0x59, 0x5a, 0x0f, 0x55, 0x00, 0x03, 0x56, 0x56, 0x03, 0x00, 0x55, 0x0f, 0x5a, 0x59, 0x0c,
0x69, 0x3c, 0x3f, 0x6a, 0x30, 0x65, 0x66, 0x33, 0x33, 0x66, 0x65, 0x30, 0x6a, 0x3f, 0x3c, 0x69,
0x03, 0x56, 0x55, 0x00, 0x5a, 0x0f, 0x0c, 0x59, 0x59, 0x0c, 0x0f, 0x5a, 0x00, 0x55, 0x56, 0x03,
0x66, 0x33, 0x30, 0x65, 0x3f, 0x6a, 0x69, 0x3c, 0x3c, 0x69, 0x6a, 0x3f, 0x65, 0x30, 0x33, 0x66,
0x65, 0x30, 0x33, 0x66, 0x3c, 0x69, 0x6a, 0x3f, 0x3f, 0x6a, 0x69, 0x3c, 0x66, 0x33, 0x30, 0x65,
0x00, 0x55, 0x56, 0x03, 0x59, 0x0c, 0x0f, 0x5a, 0x5a, 0x0f, 0x0c, 0x59, 0x03, 0x56, 0x55, 0x00
};
/**
* nand_calculate_ecc - [NAND Interface] Calculate 3-byte ECC for 256-byte block
* @dat: raw data
* @ecc_code: buffer for ECC
*/
int nand_calculate_ecc(const uint8_t *dat,
uint8_t *ecc_code)
{
uint8_t idx, reg1, reg2, reg3, tmp1, tmp2;
int i;
/* Initialize variables */
reg1 = reg2 = reg3 = 0;
/* Build up column parity */
for(i = 0; i < 256; i++) {
/* Get CP0 - CP5 from table */
idx = nand_ecc_precalc_table[*dat++];
reg1 ^= (idx & 0x3f);
/* All bit XOR = 1 ? */
if (idx & 0x40) {
reg3 ^= (uint8_t) i;
reg2 ^= ~((uint8_t) i);
}
}
/* Create non-inverted ECC code from line parity */
tmp1 = (reg3 & 0x80) >> 0; /* B7 -> B7 */
tmp1 |= (reg2 & 0x80) >> 1; /* B7 -> B6 */
tmp1 |= (reg3 & 0x40) >> 1; /* B6 -> B5 */
tmp1 |= (reg2 & 0x40) >> 2; /* B6 -> B4 */
tmp1 |= (reg3 & 0x20) >> 2; /* B5 -> B3 */
tmp1 |= (reg2 & 0x20) >> 3; /* B5 -> B2 */
tmp1 |= (reg3 & 0x10) >> 3; /* B4 -> B1 */
tmp1 |= (reg2 & 0x10) >> 4; /* B4 -> B0 */
tmp2 = (reg3 & 0x08) << 4; /* B3 -> B7 */
tmp2 |= (reg2 & 0x08) << 3; /* B3 -> B6 */
tmp2 |= (reg3 & 0x04) << 3; /* B2 -> B5 */
tmp2 |= (reg2 & 0x04) << 2; /* B2 -> B4 */
tmp2 |= (reg3 & 0x02) << 2; /* B1 -> B3 */
tmp2 |= (reg2 & 0x02) << 1; /* B1 -> B2 */
tmp2 |= (reg3 & 0x01) << 1; /* B0 -> B1 */
tmp2 |= (reg2 & 0x01) << 0; /* B7 -> B0 */
/* Calculate final ECC code */
#ifdef CONFIG_MTD_NAND_ECC_SMC
ecc_code[0] = ~tmp2;
ecc_code[1] = ~tmp1;
#else
ecc_code[0] = ~tmp1;
ecc_code[1] = ~tmp2;
#endif
ecc_code[2] = ((~reg1) << 2) | 0x03;
return 0;
}
/*
* usage: bb-nandflash-ecc start_address size
*/
void usage(const char *prog)
{
fprintf(stderr, "Usage: %s [options] <input> <output>\n"
"Options:\n"
" -p <pagesize> NAND page size (default: %d)\n"
" -o <oobsize> NAND OOB size (default: %d)\n"
" -e <offset> NAND ECC offset (default: %d)\n"
"\n", prog, DEF_NAND_PAGE_SIZE, DEF_NAND_OOB_SIZE,
DEF_NAND_ECC_OFFSET);
exit(1);
}
/*start_address/size does not include oob
*/
int main(int argc, char **argv)
{
uint8_t *page_data = NULL;
uint8_t *ecc_data;
int infd = -1, outfd = -1;
int ret = 1;
ssize_t bytes;
int ch;
while ((ch = getopt(argc, argv, "e:o:p:")) != -1) {
switch(ch) {
case 'p':
page_size = strtoul(optarg, NULL, 0);
break;
case 'o':
oob_size = strtoul(optarg, NULL, 0);
break;
case 'e':
ecc_offset = strtoul(optarg, NULL, 0);
break;
default:
usage(argv[0]);
}
}
argc -= optind;
if (argc < 2)
usage(argv[0]);
argv += optind;
infd = open(argv[0], O_RDONLY, 0);
if (infd < 0) {
perror("open input file");
goto out;
}
outfd = open(argv[1], O_WRONLY|O_CREAT|O_TRUNC, 0644);
if (outfd < 0) {
perror("open output file");
goto out;
}
page_data = malloc(page_size + oob_size);
while ((bytes = read(infd, page_data, page_size)) == page_size) {
int j;
ecc_data = page_data + page_size + ecc_offset;
for (j = 0; j < page_size / 256; j++)
{
nand_calculate_ecc(page_data + j * 256, ecc_data);
ecc_data += 3;
}
write(outfd, page_data, page_size + oob_size);
}
ret = 0;
out:
if (infd >= 0)
close(infd);
if (outfd >= 0)
close(outfd);
if (page_data)
free(page_data);
return ret;
}
/*
* calculate ecc code for nand flash
*
* Copyright (C) 2008 yajin <yajin@vm-kernel.org>
* Copyright (C) 2009 Felix Fietkau <nbd@openwrt.org>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 or
* (at your option) version 3 of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
* MA 02111-1307 USA
*/
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <stdlib.h>
#include <stdint.h>
#include <fcntl.h>
#include <stdio.h>
#define DEF_NAND_PAGE_SIZE 2048
#define DEF_NAND_OOB_SIZE 64
#define DEF_NAND_ECC_OFFSET 0x28
static int page_size = DEF_NAND_PAGE_SIZE;
static int oob_size = DEF_NAND_OOB_SIZE;
static int ecc_offset = DEF_NAND_ECC_OFFSET;
/*
* Pre-calculated 256-way 1 byte column parity
*/
static const uint8_t nand_ecc_precalc_table[] = {
0x00, 0x55, 0x56, 0x03, 0x59, 0x0c, 0x0f, 0x5a, 0x5a, 0x0f, 0x0c, 0x59, 0x03, 0x56, 0x55, 0x00,
0x65, 0x30, 0x33, 0x66, 0x3c, 0x69, 0x6a, 0x3f, 0x3f, 0x6a, 0x69, 0x3c, 0x66, 0x33, 0x30, 0x65,
0x66, 0x33, 0x30, 0x65, 0x3f, 0x6a, 0x69, 0x3c, 0x3c, 0x69, 0x6a, 0x3f, 0x65, 0x30, 0x33, 0x66,
0x03, 0x56, 0x55, 0x00, 0x5a, 0x0f, 0x0c, 0x59, 0x59, 0x0c, 0x0f, 0x5a, 0x00, 0x55, 0x56, 0x03,
0x69, 0x3c, 0x3f, 0x6a, 0x30, 0x65, 0x66, 0x33, 0x33, 0x66, 0x65, 0x30, 0x6a, 0x3f, 0x3c, 0x69,
0x0c, 0x59, 0x5a, 0x0f, 0x55, 0x00, 0x03, 0x56, 0x56, 0x03, 0x00, 0x55, 0x0f, 0x5a, 0x59, 0x0c,
0x0f, 0x5a, 0x59, 0x0c, 0x56, 0x03, 0x00, 0x55, 0x55, 0x00, 0x03, 0x56, 0x0c, 0x59, 0x5a, 0x0f,
0x6a, 0x3f, 0x3c, 0x69, 0x33, 0x66, 0x65, 0x30, 0x30, 0x65, 0x66, 0x33, 0x69, 0x3c, 0x3f, 0x6a,
0x6a, 0x3f, 0x3c, 0x69, 0x33, 0x66, 0x65, 0x30, 0x30, 0x65, 0x66, 0x33, 0x69, 0x3c, 0x3f, 0x6a,
0x0f, 0x5a, 0x59, 0x0c, 0x56, 0x03, 0x00, 0x55, 0x55, 0x00, 0x03, 0x56, 0x0c, 0x59, 0x5a, 0x0f,
0x0c, 0x59, 0x5a, 0x0f, 0x55, 0x00, 0x03, 0x56, 0x56, 0x03, 0x00, 0x55, 0x0f, 0x5a, 0x59, 0x0c,
0x69, 0x3c, 0x3f, 0x6a, 0x30, 0x65, 0x66, 0x33, 0x33, 0x66, 0x65, 0x30, 0x6a, 0x3f, 0x3c, 0x69,
0x03, 0x56, 0x55, 0x00, 0x5a, 0x0f, 0x0c, 0x59, 0x59, 0x0c, 0x0f, 0x5a, 0x00, 0x55, 0x56, 0x03,
0x66, 0x33, 0x30, 0x65, 0x3f, 0x6a, 0x69, 0x3c, 0x3c, 0x69, 0x6a, 0x3f, 0x65, 0x30, 0x33, 0x66,
0x65, 0x30, 0x33, 0x66, 0x3c, 0x69, 0x6a, 0x3f, 0x3f, 0x6a, 0x69, 0x3c, 0x66, 0x33, 0x30, 0x65,
0x00, 0x55, 0x56, 0x03, 0x59, 0x0c, 0x0f, 0x5a, 0x5a, 0x0f, 0x0c, 0x59, 0x03, 0x56, 0x55, 0x00
};
/**
* nand_calculate_ecc - [NAND Interface] Calculate 3-byte ECC for 256-byte block
* @dat: raw data
* @ecc_code: buffer for ECC
*/
int nand_calculate_ecc(const uint8_t *dat,
uint8_t *ecc_code)
{
uint8_t idx, reg1, reg2, reg3, tmp1, tmp2;
int i;
/* Initialize variables */
reg1 = reg2 = reg3 = 0;
/* Build up column parity */
for(i = 0; i < 256; i++) {
/* Get CP0 - CP5 from table */
idx = nand_ecc_precalc_table[*dat++];
reg1 ^= (idx & 0x3f);
/* All bit XOR = 1 ? */
if (idx & 0x40) {
reg3 ^= (uint8_t) i;
reg2 ^= ~((uint8_t) i);
}
}
/* Create non-inverted ECC code from line parity */
tmp1 = (reg3 & 0x80) >> 0; /* B7 -> B7 */
tmp1 |= (reg2 & 0x80) >> 1; /* B7 -> B6 */
tmp1 |= (reg3 & 0x40) >> 1; /* B6 -> B5 */
tmp1 |= (reg2 & 0x40) >> 2; /* B6 -> B4 */
tmp1 |= (reg3 & 0x20) >> 2; /* B5 -> B3 */
tmp1 |= (reg2 & 0x20) >> 3; /* B5 -> B2 */
tmp1 |= (reg3 & 0x10) >> 3; /* B4 -> B1 */
tmp1 |= (reg2 & 0x10) >> 4; /* B4 -> B0 */
tmp2 = (reg3 & 0x08) << 4; /* B3 -> B7 */
tmp2 |= (reg2 & 0x08) << 3; /* B3 -> B6 */
tmp2 |= (reg3 & 0x04) << 3; /* B2 -> B5 */
tmp2 |= (reg2 & 0x04) << 2; /* B2 -> B4 */
tmp2 |= (reg3 & 0x02) << 2; /* B1 -> B3 */
tmp2 |= (reg2 & 0x02) << 1; /* B1 -> B2 */
tmp2 |= (reg3 & 0x01) << 1; /* B0 -> B1 */
tmp2 |= (reg2 & 0x01) << 0; /* B7 -> B0 */
/* Calculate final ECC code */
#ifdef CONFIG_MTD_NAND_ECC_SMC
ecc_code[0] = ~tmp2;
ecc_code[1] = ~tmp1;
#else
ecc_code[0] = ~tmp1;
ecc_code[1] = ~tmp2;
#endif
ecc_code[2] = ((~reg1) << 2) | 0x03;
return 0;
}
/*
* usage: bb-nandflash-ecc start_address size
*/
void usage(const char *prog)
{
fprintf(stderr, "Usage: %s [options] <input> <output>\n"
"Options:\n"
" -p <pagesize> NAND page size (default: %d)\n"
" -o <oobsize> NAND OOB size (default: %d)\n"
" -e <offset> NAND ECC offset (default: %d)\n"
"\n", prog, DEF_NAND_PAGE_SIZE, DEF_NAND_OOB_SIZE,
DEF_NAND_ECC_OFFSET);
exit(1);
}
/*start_address/size does not include oob
*/
int main(int argc, char **argv)
{
uint8_t *page_data = NULL;
uint8_t *ecc_data;
int infd = -1, outfd = -1;
int ret = 1;
ssize_t bytes;
int ch;
while ((ch = getopt(argc, argv, "e:o:p:")) != -1) {
switch(ch) {
case 'p':
page_size = strtoul(optarg, NULL, 0);
break;
case 'o':
oob_size = strtoul(optarg, NULL, 0);
break;
case 'e':
ecc_offset = strtoul(optarg, NULL, 0);
break;
default:
usage(argv[0]);
}
}
argc -= optind;
if (argc < 2)
usage(argv[0]);
argv += optind;
infd = open(argv[0], O_RDONLY, 0);
if (infd < 0) {
perror("open input file");
goto out;
}
outfd = open(argv[1], O_WRONLY|O_CREAT|O_TRUNC, 0644);
if (outfd < 0) {
perror("open output file");
goto out;
}
page_data = malloc(page_size + oob_size);
while ((bytes = read(infd, page_data, page_size)) == page_size) {
int j;
ecc_data = page_data + page_size + ecc_offset;
for (j = 0; j < page_size / 256; j++)
{
nand_calculate_ecc(page_data + j * 256, ecc_data);
ecc_data += 3;
}
write(outfd, page_data, page_size + oob_size);
}
ret = 0;
out:
if (infd >= 0)
close(infd);
if (outfd >= 0)
close(outfd);
if (page_data)
free(page_data);
return ret;
}