From 79f28944960b4335e9492557bed34f6d562ff523 Mon Sep 17 00:00:00 2001 From: Bart Van Der Meerssche Date: Tue, 18 Aug 2009 22:43:06 +0000 Subject: [PATCH] openwrt: reset button triggers a network restart, dhcpc ignores SIGTERM, fixtime removed from luci --- openwrt/config | 14 ++++++-------- openwrt/files/etc/config/system | 4 ++-- openwrt/files/etc/config/wireless | 3 +-- openwrt/packages/flukso/Makefile | 2 +- openwrt/packages/flukso/src/auth.lua | 2 +- openwrt/packages/flukso/src/flukso.init | 6 +++--- .../packages/luci/contrib/package/luci/Makefile | 3 +-- .../packages/luci/host/etc/init.d/luci_fixtime | 11 ----------- .../luci/modules/admin-core/ipkg/postinst | 1 - .../admin-core/root/etc/init.d/luci_fixtime | 11 ----------- .../admin-mini/luasrc/model/cbi/mini/wifi.lua | 12 +++++------- .../patches/110.set.console.baud.to.4800.patch | 13 +++++++++++++ .../120.set.AR5315_RESET_GPIO.to.6.patch | 13 +++++++++++++ openwrt/patches/130.ignore.dhcpc.sigterm.patch | 17 +++++++++++++++++ openwrt/patches/INSTALL.txt | 8 ++++++++ 15 files changed, 71 insertions(+), 49 deletions(-) delete mode 100755 openwrt/packages/luci/host/etc/init.d/luci_fixtime delete mode 100755 openwrt/packages/luci/modules/admin-core/root/etc/init.d/luci_fixtime create mode 100644 openwrt/patches/110.set.console.baud.to.4800.patch create mode 100644 openwrt/patches/120.set.AR5315_RESET_GPIO.to.6.patch create mode 100644 openwrt/patches/130.ignore.dhcpc.sigterm.patch create mode 100644 openwrt/patches/INSTALL.txt diff --git a/openwrt/config b/openwrt/config index f98c6d5..d8d6a2f 100644 --- a/openwrt/config +++ b/openwrt/config @@ -1,7 +1,7 @@ # # Automatically generated make config: don't edit # OpenWrt version: Kamikaze (r16491) -# Sun Jun 21 11:25:33 2009 +# Thu Jun 25 23:46:42 2009 # CONFIG_HAVE_DOT_CONFIG=y # CONFIG_TARGET_ppc40x is not set @@ -609,9 +609,7 @@ CONFIG_BUSYBOX_CONFIG_FDISK_SUPPORT_LARGE_DISKS=y CONFIG_BUSYBOX_CONFIG_HEXDUMP=y # CONFIG_BUSYBOX_CONFIG_FEATURE_HEXDUMP_REVERSE is not set # CONFIG_BUSYBOX_CONFIG_HD is not set -CONFIG_BUSYBOX_CONFIG_HWCLOCK=y -# CONFIG_BUSYBOX_CONFIG_FEATURE_HWCLOCK_LONG_OPTIONS is not set -# CONFIG_BUSYBOX_CONFIG_FEATURE_HWCLOCK_ADJTIME_FHS is not set +# CONFIG_BUSYBOX_CONFIG_HWCLOCK is not set # CONFIG_BUSYBOX_CONFIG_IPCRM is not set # CONFIG_BUSYBOX_CONFIG_IPCS is not set # CONFIG_BUSYBOX_CONFIG_LOSETUP is not set @@ -731,8 +729,8 @@ CONFIG_BUSYBOX_CONFIG_FEATURE_IFCONFIG_BROADCAST_PLUS=y # CONFIG_BUSYBOX_CONFIG_NAMEIF is not set CONFIG_BUSYBOX_CONFIG_NC=y CONFIG_BUSYBOX_CONFIG_NETMSG=y -# CONFIG_BUSYBOX_CONFIG_NC_SERVER is not set -# CONFIG_BUSYBOX_CONFIG_NC_EXTRA is not set +CONFIG_BUSYBOX_CONFIG_NC_SERVER=y +CONFIG_BUSYBOX_CONFIG_NC_EXTRA=y CONFIG_BUSYBOX_CONFIG_NETSTAT=y CONFIG_BUSYBOX_CONFIG_FEATURE_NETSTAT_WIDE=y CONFIG_BUSYBOX_CONFIG_NSLOOKUP=y @@ -1227,9 +1225,9 @@ CONFIG_PACKAGE_luci-admin-mini=y # CONFIG_PACKAGE_luci-cbi=y CONFIG_PACKAGE_luci-core=y -CONFIG_PACKAGE_luci-core_compile=y +# CONFIG_PACKAGE_luci-core_compile is not set # CONFIG_PACKAGE_luci-core_stripped is not set -# CONFIG_PACKAGE_luci-core_source is not set +CONFIG_PACKAGE_luci-core_source=y # CONFIG_PACKAGE_luci-fastindex is not set CONFIG_PACKAGE_luci-http=y # CONFIG_PACKAGE_luci-ipkg is not set diff --git a/openwrt/files/etc/config/system b/openwrt/files/etc/config/system index 0188be5..5c36d60 100644 --- a/openwrt/files/etc/config/system +++ b/openwrt/files/etc/config/system @@ -2,9 +2,9 @@ config system option hostname flukso option device 0123456789abcdef0123456789abcdef option key 00112233445566778899aabbccddeeff - option version 5 + option version 6 config button option button reset option action pressed - option handler 'gpioctl set 7; gpioctl clear 7' + option handler '/etc/init.d/network restart' diff --git a/openwrt/files/etc/config/wireless b/openwrt/files/etc/config/wireless index 65b0699..a099c79 100644 --- a/openwrt/files/etc/config/wireless +++ b/openwrt/files/etc/config/wireless @@ -1,6 +1,7 @@ config wifi-device wifi0 option type atheros option channel auto + option mode 11bg option diversity 0 option txantenna 1 option rxantenna 1 @@ -12,8 +13,6 @@ config wifi-iface option mode sta option nosbeacon 1 option hidden 0 - option txpower 16 option ssid zwaluw option encryption wep option key 4ae56b7820f6b6b3cba78da46b - diff --git a/openwrt/packages/flukso/Makefile b/openwrt/packages/flukso/Makefile index 2e36296..74c3652 100644 --- a/openwrt/packages/flukso/Makefile +++ b/openwrt/packages/flukso/Makefile @@ -14,7 +14,7 @@ include $(INCLUDE_DIR)/package.mk define Package/flukso SECTION:=utils CATEGORY:=Utilities - DEPENDS:=+liblua-xmlrpc +ntpclient +netcat + DEPENDS:=+liblua-xmlrpc +ntpclient TITLE:=Flukso - community metering endef diff --git a/openwrt/packages/flukso/src/auth.lua b/openwrt/packages/flukso/src/auth.lua index 850b928..85009e4 100644 --- a/openwrt/packages/flukso/src/auth.lua +++ b/openwrt/packages/flukso/src/auth.lua @@ -66,7 +66,7 @@ function hmac(T, M, timestamp) end T.timestamp = timestamp or os.time() - T.message = T.timestamp..':'..serialise(M)..':'..T.key -- or T.timestamp..':'..T.nonce..':'..T.key + T.message = T.timestamp..':'..serialise(M)..':'..T.key T.signature = lxyssl.hash('hmac-sha1', T.key):digest(T.message):hex() T.message, T.key, T.version = nil, nil, nil diff --git a/openwrt/packages/flukso/src/flukso.init b/openwrt/packages/flukso/src/flukso.init index 3885786..35d6066 100755 --- a/openwrt/packages/flukso/src/flukso.init +++ b/openwrt/packages/flukso/src/flukso.init @@ -1,5 +1,5 @@ #!/bin/sh /etc/rc.common -# Copyroght (c) 2008 jokamajo.org +# Copyright (c) 2008-2009 jokamajo.org # $Id$ START=98 @@ -8,10 +8,10 @@ start() { stty 4800 < /dev/ttyS0 /usr/share/lua/flukso/flukso.lua >&- 2>&- <&- & /usr/share/lua/flukso/heartbeat.lua 1 >&- 2>&- <&- - echo -e "$(date '+%M') * * * * /usr/share/lua/flukso/heartbeat.lua 0\n"'*/15 * * * * [ -z "$(ps | grep '\'fluks[o]\'')" ] && reboot' | crontab - + echo -e "$(date '+%M') * * * * /usr/share/lua/flukso/heartbeat.lua 0\n"'*/15 * * * * [ -z "$(ps | grep '\'flukso.lu[a]\'')" ] && reboot' | crontab - } stop() { crontab -r - kill $(ps | grep 'fluks[o]' | awk '{print $1}') + kill -SIGKILL $(ps | grep 'flukso.lu[a]' | awk '{print $1}') } diff --git a/openwrt/packages/luci/contrib/package/luci/Makefile b/openwrt/packages/luci/contrib/package/luci/Makefile index c0ede0e..1d91891 100644 --- a/openwrt/packages/luci/contrib/package/luci/Makefile +++ b/openwrt/packages/luci/contrib/package/luci/Makefile @@ -10,7 +10,7 @@ PKG_NAME:=luci PKG_RELEASE:=1 ifeq ($(USELOCAL),1) - PKG_VERSION:=0.8+svn + PKG_VERSION:=0.8.6 else PKG_SOURCE_URL:=http://svn.luci.subsignal.org/luci/$(PKG_BRANCH) ifeq ($(DUMP),) @@ -287,7 +287,6 @@ endef define Package/luci-admin-core/install $(call Package/luci/install/template,$(1),modules/admin-core) - touch $(1)/etc/init.d/luci_fixtime || true endef diff --git a/openwrt/packages/luci/host/etc/init.d/luci_fixtime b/openwrt/packages/luci/host/etc/init.d/luci_fixtime deleted file mode 100755 index f300e45..0000000 --- a/openwrt/packages/luci/host/etc/init.d/luci_fixtime +++ /dev/null @@ -1,11 +0,0 @@ -#!/bin/sh /etc/rc.common - -START=05 - -start() { - cat <<' EOF' | lua -l luci.fs -l luci.util - - if (os.time() < 1000000000) then - os.execute('date -s ' .. os.date('%m%d%H%M%Y', luci.fs.mtime("/etc/init.d/luci_fixtime"))) - end - EOF -} diff --git a/openwrt/packages/luci/modules/admin-core/ipkg/postinst b/openwrt/packages/luci/modules/admin-core/ipkg/postinst index b0293a7..214f2ca 100755 --- a/openwrt/packages/luci/modules/admin-core/ipkg/postinst +++ b/openwrt/packages/luci/modules/admin-core/ipkg/postinst @@ -1,7 +1,6 @@ #!/bin/sh [ -n "${IPKG_INSTROOT}" ] || { - /etc/init.d/luci_fixtime enabled || /etc/init.d/luci_fixtime enable /etc/init.d/luci_ethers enabled || /etc/init.d/luci_ethers enable /etc/init.d/luci_hosts enabled || /etc/init.d/luci_hosts enable } diff --git a/openwrt/packages/luci/modules/admin-core/root/etc/init.d/luci_fixtime b/openwrt/packages/luci/modules/admin-core/root/etc/init.d/luci_fixtime deleted file mode 100755 index f300e45..0000000 --- a/openwrt/packages/luci/modules/admin-core/root/etc/init.d/luci_fixtime +++ /dev/null @@ -1,11 +0,0 @@ -#!/bin/sh /etc/rc.common - -START=05 - -start() { - cat <<' EOF' | lua -l luci.fs -l luci.util - - if (os.time() < 1000000000) then - os.execute('date -s ' .. os.date('%m%d%H%M%Y', luci.fs.mtime("/etc/init.d/luci_fixtime"))) - end - EOF -} diff --git a/openwrt/packages/luci/modules/admin-mini/luasrc/model/cbi/mini/wifi.lua b/openwrt/packages/luci/modules/admin-mini/luasrc/model/cbi/mini/wifi.lua index a182fcb..061629d 100644 --- a/openwrt/packages/luci/modules/admin-mini/luasrc/model/cbi/mini/wifi.lua +++ b/openwrt/packages/luci/modules/admin-mini/luasrc/model/cbi/mini/wifi.lua @@ -64,11 +64,6 @@ function bssid.cfgvalue(self, section) or wifidata[ifname]["Access Point"])) or "-" end -channel = s:option(DummyValue, "channel", translate("channel")) -function channel.cfgvalue(self, section) - return wireless[self.map:get(section, "device")].channel -end - protocol = s:option(DummyValue, "_mode", translate("protocol")) function protocol.cfgvalue(self, section) local mode = wireless[self.map:get(section, "device")].mode @@ -134,6 +129,9 @@ end -- Config Section -- +local hwtype = m:get(wifidevs[1], "type") + +--[[ s = m:section(NamedSection, wifidevs[1], "wifi-device", translate("devices")) s.addremove = false @@ -155,7 +153,7 @@ ch = s:option(Value, "channel", translate("a_w_channel")) for i=1, 14 do ch:value(i, i .. " (2.4 GHz)") end - +]]-- s = m:section(TypedSection, "wifi-iface", translate("m_n_local")) s.anonymous = true @@ -238,7 +236,7 @@ function key:validate(value, section) return nil end elseif encr:formvalue(section) == 'psk' or encr:formvalue(section) == 'psk2' then - return #value == 64 and value:hexcheck() + return #value > 7 and #value < 64 and value else return value end diff --git a/openwrt/patches/110.set.console.baud.to.4800.patch b/openwrt/patches/110.set.console.baud.to.4800.patch new file mode 100644 index 0000000..2e9ca59 --- /dev/null +++ b/openwrt/patches/110.set.console.baud.to.4800.patch @@ -0,0 +1,13 @@ +Index: config-2.6.26 +=================================================================== +--- config-2.6.26 (revision 16491) ++++ config-2.6.26 (working copy) +@@ -20,7 +20,7 @@ + # CONFIG_BT is not set + CONFIG_CEVT_R4K=y + CONFIG_CLASSIC_RCU=y +-CONFIG_CMDLINE="console=ttyS0,9600 rootfstype=squashfs,jffs2 init=/etc/preinit" ++CONFIG_CMDLINE="console=ttyS0,4800 rootfstype=squashfs,jffs2 init=/etc/preinit" + CONFIG_CPU_BIG_ENDIAN=y + CONFIG_CPU_HAS_LLSC=y + CONFIG_CPU_HAS_PREFETCH=y diff --git a/openwrt/patches/120.set.AR5315_RESET_GPIO.to.6.patch b/openwrt/patches/120.set.AR5315_RESET_GPIO.to.6.patch new file mode 100644 index 0000000..7412146 --- /dev/null +++ b/openwrt/patches/120.set.AR5315_RESET_GPIO.to.6.patch @@ -0,0 +1,13 @@ +Index: ar5315.h +=================================================================== +--- ar5315.h (revision 16491) ++++ ar5315.h (working copy) +@@ -355,7 +355,7 @@ + #define AR5315_GPIO_INT_LVL_HIGH 2 /* High Level Triggered */ + #define AR5315_GPIO_INT_LVL_EDGE 3 /* Edge Triggered */ + +-#define AR5315_RESET_GPIO 5 ++#define AR5315_RESET_GPIO 6 + #define AR5315_NUM_GPIO 22 + + diff --git a/openwrt/patches/130.ignore.dhcpc.sigterm.patch b/openwrt/patches/130.ignore.dhcpc.sigterm.patch new file mode 100644 index 0000000..03180cc --- /dev/null +++ b/openwrt/patches/130.ignore.dhcpc.sigterm.patch @@ -0,0 +1,17 @@ +--- dhcpc.c 2009-08-18 23:24:17.000000000 +0200 ++++ dhcpc.c 2009-08-18 23:25:52.000000000 +0200 +@@ -616,10 +616,10 @@ + timeout = INT_MAX; + break; + case SIGTERM: +- bb_info_msg("Received SIGTERM"); +- if (opt & OPT_R) /* release on quit */ +- perform_release(requested_ip, server_addr); +- goto ret0; ++ bb_info_msg("Received SIGTERM: ignoring!"); ++ // if (opt & OPT_R) /* release on quit */ ++ // perform_release(requested_ip, server_addr); ++ // goto ret0; + } + } + } /* for (;;) - main loop ends */ diff --git a/openwrt/patches/INSTALL.txt b/openwrt/patches/INSTALL.txt new file mode 100644 index 0000000..984d29b --- /dev/null +++ b/openwrt/patches/INSTALL.txt @@ -0,0 +1,8 @@ +$Id$ + +apply following patches to a fresh 8.09 installation: +----------------------------------------------------- +100.disable.console.patch in 8.09_base_dir/target/linux/generic-2.6/ +110.set.console.baud.to.4800.patch in 8.09_base_dir/target/linux/atheros/ +120.set.AR5315_RESET_GPIO.to.6.patch in 8.09_base_dir/target/linux/atheros/files/include/asm-mips/mach-atheros/ar5315/ +130.ignore.dhcpc.sigterm.patch in 8.09_base_dir/build_dir/mips/busybox-1.11.2/networking/udhcp/