Merge commit '1f660fd4b00076baa867a75fdf766e8fe2c75b9d' into dora

This commit is contained in:
Holger Hans Peter Freyther 2015-03-31 17:08:27 +02:00
commit 436d02dfa6
23 changed files with 32 additions and 239 deletions

View File

@ -1,6 +1,6 @@
SYSMOCOM := "${@os.path.dirname(bb.data.getVar('FILE', d, True))}"
FILESEXTRAPATHS_prepend := "${SYSMOCOM}/netbase-${PV}:${SYSMOCOM}/netbase:"
PRINC = "9"
FILESEXTRAPATHS_prepend := "${SYSMOCOM}/init-ifupdown-${PV}:${SYSMOCOM}/init-ifupdown:"
PRINC = "10"
# systemd does not look at /etc/rcS.d for the script. Make sure
# there is a symlink available

View File

@ -1,6 +1,6 @@
SYSMOCOM := "${@os.path.dirname(bb.data.getVar('FILE', d, True))}"
FILESEXTRAPATHS_prepend := "${SYSMOCOM}/${PN}-${PV}:${SYSMOCOM}/${PN}:"
PRINC = "20"
PRINC = "21"
# bug in poky meta/classes/base.bbclass

View File

@ -1,6 +1,6 @@
# Configuration script used by ntpdate-sync script
NTPSERVERS=""
NTPSERVERS="pool.ntp.org"
# Set to "yes" to write time to hardware clock on success
UPDATE_HWCLOCK="no"

View File

@ -23,7 +23,7 @@ SRC_URI = "http://www.eecis.udel.edu/~ntp/ntp_spool/ntp4/ntp-4.2/ntp-${PV}.tar.g
file://ntpd.list \
"
PR = "r6"
PR = "r7"
SRC_URI[md5sum] = "65d8cdfae4722226fbe29863477641ed"
SRC_URI[sha256sum] = "948274b88f1ed002d867ced6aaefdfd0999668b11285ac2b3a67ff2629d59d88"

View File

@ -4,4 +4,16 @@ change_udev_automounter_ro() {
sed -i -e 's/\-t auto/\-t auto \-o ro/' ${IMAGE_ROOTFS}/etc/udev/scripts/mount.sh
}
ROOTFS_POSTPROCESS_COMMAND += "change_udev_automounter_ro ; "
bootuser = "${@d.getVar('BOOT_USER', True) or ""}"
bootpasswd = "${@d.getVar('BOOT_PASSWD', True) or ""}"
set_boot_passwd() {
if [ -n "${bootpasswd}" ] && [ -n "${bootuser}" ]; then
sed -e "s/^\(BOOTPASSWD=\)/\1${bootpasswd}/g" \
-e "s/^\(BOOTUSER=\)/\1${bootuser}/g" \
-i ${IMAGE_ROOTFS}/install.sh
echo "Generated new grub-passwd"
fi
}
ROOTFS_POSTPROCESS_COMMAND += "change_udev_automounter_ro ; set_boot_passwd; "

View File

@ -175,10 +175,22 @@ terminal_input --append serial
terminal_output --append serial
EOF
BOOTPASSWD=
BOOTUSER=
if [ -n "${BOOTPASSWD}" ] && [ -n "${BOOTUSER}" ]; then
cat >> $GRUBCFG << EOF
set superusers="$BOOTUSER"
password $BOOTUSER $BOOTPASSWD
EOF
fi
if [ -f /etc/grub.d/40_custom ] ; then
echo "Preparing custom grub2 menu..."
cat /etc/grub.d/40_custom >> $GRUBCFG
if [ -n "${BOOTPASSWD}" ] && [ -n "${BOOTUSER}" ]; then
sed -i "s/\(menuentry\)\(.*\)\({\)/\1\2--unrestricted \3/g" $GRUBCFG
fi
sed -i "s@__ROOTFS__@$rootfs $rootwait@g" $GRUBCFG
sed -i "s/__VIDEO_MODE__/$kernel_cmdline_video_mode/g" $GRUBCFG
sed -i "s/__VGA_MODE__/$kernel_cmdline_vga_mode/g" $GRUBCFG

View File

@ -1,6 +1,6 @@
SYSMOCOM := "${@os.path.dirname(bb.data.getVar('FILE', d, True))}"
FILESEXTRAPATHS_prepend := "${SYSMOCOM}/files:"
PRINC = "1"
PRINC = "2"
RDEPENDS_${PN} += "e2fsprogs-e2fsck"

View File

@ -1,197 +0,0 @@
From 987960ea03c59a2ef9164e4f7309031ef4e0242d Mon Sep 17 00:00:00 2001
Message-Id: <987960ea03c59a2ef9164e4f7309031ef4e0242d.1410189314.git.daniel@totalueberwachung.de>
From: Daniel Willmann <dwillmann@sysmocom.de>
Date: Mon, 8 Sep 2014 15:53:54 +0200
Subject: [PATCH 1/1] Add wifi2udp program
---
Makefile | 4 +-
wifi2udp.c | 146 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 149 insertions(+), 1 deletion(-)
create mode 100644 wifi2udp.c
Index: wireless_tools.30/Makefile
===================================================================
--- wireless_tools.30.orig/Makefile
+++ wireless_tools.30/Makefile
@@ -50,7 +50,7 @@ WEXT_HEADER = wireless.$(WE_VERSION).h
# Targets to build
STATIC=libiw.a
DYNAMIC=libiw.so.$(WT_VERSION)
-PROGS= iwconfig iwlist iwpriv iwspy iwgetid iwevent ifrename
+PROGS= iwconfig iwlist iwpriv iwspy iwgetid iwevent ifrename wifi2udp
MANPAGES8=iwconfig.8 iwlist.8 iwpriv.8 iwspy.8 iwgetid.8 iwevent.8 ifrename.8
MANPAGES7=wireless.7
MANPAGES5=iftab.5
@@ -105,7 +105,7 @@ endif
# Other flags
CFLAGS=-Os -W -Wall -Wstrict-prototypes -Wmissing-prototypes -Wshadow \
- -Wpointer-arith -Wcast-qual -Winline -I.
+ -Wpointer-arith -Wcast-qual -Winline -I. -ggdb3
#CFLAGS=-O2 -W -Wall -Wstrict-prototypes -I.
DEPFLAGS=-MMD
XCFLAGS=$(CFLAGS) $(DEPFLAGS) $(WARN) $(HEADERS) $(WELIB_FLAG) $(WEDEF_FLAG)
@@ -137,6 +137,8 @@ ifrename: ifrename.o $(IWLIB)
macaddr: macaddr.o $(IWLIB)
+wifi2udp: wifi2udp.o $(IWLIB)
+
iwmulticall: iwmulticall.o
$(CC) $(LDFLAGS) $(STRIPFLAGS) $(XCFLAGS) -o $@ $^ $(LIBS)
Index: wireless_tools.30/wifi2udp.c
===================================================================
--- /dev/null
+++ wireless_tools.30/wifi2udp.c
@@ -0,0 +1,149 @@
+
+#include <unistd.h>
+#include <stdio.h>
+#include <time.h>
+#include <iwlib.h>
+
+#include <sys/socket.h>
+
+static int verbose = 0;
+static int delay = 10;
+
+static void escape_essid(const char *src, char *dst, ssize_t len)
+{
+ int i, j;
+
+ for (i = 0, j = 0; j < len; i++, j++) {
+ if (src[i] == '"') {
+ dst[j] = '\\';
+ j++;
+ if (j == len)
+ break;
+ }
+
+ dst[j] = src[i];
+
+ if (!src[i])
+ return;
+ }
+}
+
+static void scan_wifi(char *iface, const char *oduiface, const char *server, int port)
+{
+ int sock, rc;
+ iwrange range;
+ struct ifreq buf;
+ char mac[20];
+
+ struct sockaddr_in remote;
+ struct hostent *hp;
+
+ hp = gethostbyname(server);
+ if (!hp) {
+ printf("Could not resolve %s\n", server);
+ exit(-1);
+ }
+
+ remote.sin_family = AF_INET;
+ memcpy(&remote.sin_addr, hp->h_addr, hp->h_length);
+ remote.sin_port = htons(port);
+
+ /* Retrieve MAC address of Wifi card */
+ sock = socket(PF_INET, SOCK_DGRAM, 0);
+ memset(&buf, 0, sizeof(buf));
+
+ strcpy(buf.ifr_name, oduiface);
+ ioctl(sock, SIOCGIFHWADDR, &buf);
+ iw_sawap_ntop(&buf.ifr_hwaddr, mac);
+
+ sock = iw_sockets_open();
+
+ rc = iw_get_range_info(sock, iface, &range);
+ if (rc < 0) {
+ printf("iw_get_range_info() returned %i\n", rc);
+ exit(2);
+ }
+
+ while (1) {
+ time_t now;
+ wireless_scan_head head;
+ wireless_scan *result;
+ /* Scan for wireless networks */
+ rc = iw_scan(sock, iface, range.we_version_compiled, &head);
+ if (rc < 0) {
+ printf("iw_scan() returned %i\n", rc);
+ exit(2);
+ }
+
+ now = time(NULL);
+
+ /* Print the results */
+ result = head.result;
+ while (NULL != result) {
+ char bssid[20];
+ char line[1024];
+ char essid_escaped[50];
+ wireless_scan *old_result;
+ iw_sawap_ntop(&result->ap_addr, bssid);
+
+ escape_essid(result->b.essid, essid_escaped, 50);
+ snprintf(line, 1024, "WIFI,%li,%s,\"%s\",%s,%0.0f,%i\r\n", now, mac, essid_escaped, bssid, result->b.freq/1000000, (int8_t)result->stats.qual.level);
+ if (verbose)
+ printf("%s", line);
+ rc = sendto(sock, line, strlen(line), 0, (struct sockaddr*)&remote, sizeof(remote));
+ if (rc == -1)
+ printf("Failed to send message: %s\n", strerror(errno));
+ old_result = result;
+ result = result->next;
+ free(old_result);
+ }
+ sleep(delay);
+ }
+}
+
+static void usage(void)
+{
+ printf("Usage: prog [options] host [port]\n");
+}
+
+int main(int argc, char *argv[])
+{
+ int option;
+ char *wifiiface = NULL, *ifacename = NULL, *server;
+ int port = 20001;
+
+ while ((option = getopt(argc, argv, "?hvw:i:d:")) != -1) {
+ switch (option) {
+ case 'v':
+ verbose = 1;
+ break;
+ case 'w':
+ wifiiface = optarg;
+ break;
+ case 'i':
+ ifacename = optarg;
+ break;
+ case 'd':
+ delay = atoi(optarg);
+ break;
+ case '?':
+ case 'h':
+ usage();
+ exit(1);
+ }
+ }
+
+ if (optind < argc) {
+ server = argv[optind];
+ optind++;
+ } else {
+ usage();
+ exit(-1);
+ }
+ if (optind < argc)
+ port = atoi(argv[optind]);
+
+ scan_wifi(wifiiface, ifacename, server, port);
+
+ return 0;
+}

View File

@ -1,9 +0,0 @@
[Unit]
Description=WIFI scan service
[Service]
EnvironmentFile=/etc/default/odu_gps.conf
ExecStartPre=/sbin/ifconfig wlan0 up
ExecStart=/usr/sbin/wifi2udp -w wlan0 -i eth0 ${UDP_SINK}
Restart=always
RestartSec=2

View File

@ -1,21 +0,0 @@
THISDIR := "${@os.path.dirname(bb.data.getVar('FILE', d, True))}"
FILESPATH =. "${@base_set_filespath(["${THISDIR}/files"], d)}:"
PRINC="8"
SRC_URI += "file://0001-Add-wifi2udp-program.patch \
file://wifi2udp.service"
PACKAGES =+ "wireless-tools-wifi2udp"
FILES_wireless-tools-wifi2udp = "${sbindir}/wifi2udp \
${systemd_unitdir}/system/wifi2udp.service \
${systemd_unitdir}/system/multi-user.target.wants/wifi2udp.service"
do_install_append() {
install -m 0755 wifi2udp ${D}${sbindir}/wifi2udp
install -d ${D}${systemd_unitdir}/system/
install -m 0644 ${WORKDIR}/wifi2udp.service ${D}${systemd_unitdir}/system/
install -d ${D}${systemd_unitdir}/system/multi-user.target.wants/
ln -sf ../wifi2udp.service ${D}${systemd_unitdir}/system/multi-user.target.wants/
}

View File

@ -1 +0,0 @@
require recipes-bsp/netbase/${PN}_sysmocom.inc

View File

@ -1 +0,0 @@
require recipes-fixes/wireless-tools/${PN}_sysmocom.inc

View File

@ -1 +1 @@
require recipes-bsp/netbase/${PN}_sysmocom.inc
require recipes-bsp/init-ifupdown/${PN}_sysmocom.inc

View File

@ -1 +0,0 @@
require recipes-fixes/wireless-tools/${PN}_sysmocom.inc

View File

@ -1 +0,0 @@
require recipes-bsp/netbase/${PN}_sysmocom.inc