From 9ca63fd8eb716b16da00496b1e5bbc9dd70b622d Mon Sep 17 00:00:00 2001 From: Stefan Eichenberger Date: Thu, 11 Aug 2016 18:17:21 +0200 Subject: [PATCH 01/10] nmrouter-image: add a dev image Add a dev image and remove unwanted stuff from the normal image --- recipes-core/images/nmrouter-dev-image.bb | 35 +++++++++++++++++++ recipes-core/images/nmrouter-image.bb | 42 ++++++----------------- recipes-core/images/nmrouter-minimal.bb | 29 +++++++++------- 3 files changed, 61 insertions(+), 45 deletions(-) create mode 100644 recipes-core/images/nmrouter-dev-image.bb diff --git a/recipes-core/images/nmrouter-dev-image.bb b/recipes-core/images/nmrouter-dev-image.bb new file mode 100644 index 0000000..385ed2c --- /dev/null +++ b/recipes-core/images/nmrouter-dev-image.bb @@ -0,0 +1,35 @@ +require nmrouter-image.bb + +SUMMARY = "nmrouter image for developement only" + +IMAGE_FEATURES_append = " \ + tools-debug \ + " + +BENCH_TOOLS = " \ + tcpdump \ + lrzsz \ + lmbench \ + dbench \ + memtester \ + nbench-byte \ + tiobench \ + iozone3 \ + iperf \ + strongswan \ + " + +EASY_EDITOR = " \ + nano \ + " + +BENCH_TOOLS_cortexa9hf-neon_append = " cpuburn-neon " +BENCH_TOOLS_cortexa8hf-neon_append = " cpuburn-neon " + + +IMAGE_INSTALL_append = " \ + lrzsz \ + ${BENCH_TOOLS} \ + ${EASY_EDITOR} \ + " + diff --git a/recipes-core/images/nmrouter-image.bb b/recipes-core/images/nmrouter-image.bb index cfee616..1b920c8 100644 --- a/recipes-core/images/nmrouter-image.bb +++ b/recipes-core/images/nmrouter-image.bb @@ -1,45 +1,27 @@ inherit core-image -SUMMARY = "Test image" +SUMMARY = "nmrouter image" KERNEL_IMAGETYPE = "uImage" IMAGE_FSTYPES_append = " tar.gz " -IMAGE_FEATURES_append = " \ - tools-debug \ - " - IMAGE_FEATURES_append = " \ package-management \ ssh-server-openssh \ " -BENCH_TOOLS = " \ - tcpdump \ - lrzsz \ - lmbench \ - dbench \ - memtester \ - nbench-byte \ - tiobench \ - iozone3 \ - iperf \ - strongswan \ - " - -EASY_EDITOR = " \ - nano \ - " - -BENCH_TOOLS_cortexa9hf-neon_append = " cpuburn-neon " -BENCH_TOOLS_cortexa8hf-neon_append = " cpuburn-neon " - PREFERED_VERSION-pn_nodejs = "4.4.5" -IMAGE_INSTALL_append = " \ - linux-firmware \ +FIRMWARE ?= "linux-firmware" +FIRMWARE_am335x-nbhw16 = " \ + linux-firmware-ath6k \ linux-firmware-ath9k \ + linux-firmware-wl12xx\ + linux-firmware-wl18xx\ + " + +IMAGE_INSTALL_append = " \ hostapd \ iw \ crda \ @@ -48,22 +30,18 @@ IMAGE_INSTALL_append = " \ bash \ iproute2 \ ethtool \ - i2c-tools \ - lrzsz \ devmem2 \ openvpn \ iptables \ pciutils \ kernel-modules \ kernel-devicetree \ - node \ python-subprocess \ networkmanager \ cockpit \ board-descriptor \ sw-update \ - ${BENCH_TOOLS} \ - ${EASY_EDITOR} \ + ${FIRMWARE} \ " IMAGE_INSTALL_cortex9hf-neon_append = " kernel-devicetree " diff --git a/recipes-core/images/nmrouter-minimal.bb b/recipes-core/images/nmrouter-minimal.bb index 2ac523d..1425381 100644 --- a/recipes-core/images/nmrouter-minimal.bb +++ b/recipes-core/images/nmrouter-minimal.bb @@ -1,20 +1,23 @@ -inherit core-image +DISTRO_FEATURES_BACKFILL_CONSIDERED = " wifi bluetooth" + +inherit image SUMMARY = "Minimal image for bringup" -IMAGE_FEATURES += " \ - package-management \ - ssh-server-openssh \ - " +#IMAGE_FEATURES += " \ +# " -IMAGE_INSTALL += " \ - openssh-sftp-server \ - bash \ - ethtool \ - i2c-tools \ - lrzsz \ - devmem2 \ - " +#IMAGE_INSTALL += " \ +# lrzsz \ +# devmem2 \ +# " + +IMAGE_INSTALL = " \ + packagegroup-core-boot \ + e2fsprogs \ + lrzsz \ + devmem2 \ + " LICENSE = "BSD" From 77d75f8968833847dc2fd9e6ab4e2a9946c9b8cf Mon Sep 17 00:00:00 2001 From: Stefan Eichenberger Date: Fri, 12 Aug 2016 17:24:19 +0200 Subject: [PATCH 02/10] sw-update: use reworked bd utility --- .../sw-update/sw-update/sw_update_config | 33 ++++++++++++++++--- 1 file changed, 28 insertions(+), 5 deletions(-) diff --git a/recipes-core/sw-update/sw-update/sw_update_config b/recipes-core/sw-update/sw-update/sw_update_config index 467ac9f..fdf8609 100644 --- a/recipes-core/sw-update/sw-update/sw_update_config +++ b/recipes-core/sw-update/sw-update/sw_update_config @@ -1,12 +1,35 @@ -PLATFORM_FIRST_PARTITION="/dev/mmcblk0p2" -PLATFORM_SECOND_PARTITION="/dev/mmcblk0p3" -PLATFORM_BOOT_PARTITION="/dev/mmcblk0p1" +PLATFORM_FIRST_PARTITION="/dev/mmcblk0p1" +PLATFORM_SECOND_PARTITION="/dev/mmcblk0p2" PLATFORM_PROD_COMPATIBILITY= PLATFORM_HW_VERSION= -PLATFORM_ACTIVE_PARTITION=$(bd -r boot_part) +get_active_partition() +{ + boot_part=$(bd read boot_part) + if [ "$boot_part" == "None" ]; then + flag=$(bd read partition64.flags) + if [ $flag -ne 0 ]; then + boot_part=0 + else + boot_part=1 + fi + fi + echo $boot_part +} +PLATFORM_ACTIVE_PARTITION=$(get_active_partition) set_active_partition() { - bd -w boot_part -v $1 + boot_part=$(bd read boot_part) + if [ "$boot_part" == "None" ]; then + if [ $1 -eq 0 ]; then + bd write partition64.flags=128 + bd write partition64_1.flags=0 + else + bd write partition64_1.flags=128 + bd write partition64.flags=0 + fi + else + bd write boot_part=$1 + fi } From d7ba3daf9f900218415fb80f91c6d6d8adba6f78 Mon Sep 17 00:00:00 2001 From: Stefan Eichenberger Date: Tue, 16 Aug 2016 15:30:35 +0200 Subject: [PATCH 03/10] sw-update: make sw-update robust sw-update will now also accept nmsw images. It will search for a valid tar.gz archive. --- recipes-core/sw-update/sw-update/sw-update.sh | 37 ++++++++++++++++--- 1 file changed, 32 insertions(+), 5 deletions(-) diff --git a/recipes-core/sw-update/sw-update/sw-update.sh b/recipes-core/sw-update/sw-update/sw-update.sh index 583ae0a..34ffd81 100755 --- a/recipes-core/sw-update/sw-update/sw-update.sh +++ b/recipes-core/sw-update/sw-update/sw-update.sh @@ -17,7 +17,8 @@ source /etc/default/sw_update_config log() { local level=${1?} shift - local code= line="[$(date '+%F %T')] $level: $*" + local code= + local line="[$(date '+%F %T')] $level: $*" if [ -t 2 ] then case "$level" in @@ -190,18 +191,44 @@ check_file() fi } +get_bin() +{ + echo $(dd if=$IMAGE_LOCATION bs=1 count=$2 skip=$1 2>/dev/null | hexdump -ve '1/1 "%.2x"') +} + update_linux() { log INFO "Starting linux update ..." check_file $1 - #extract_header_infos - #check_image_compatibility + head=$(get_bin 0 2) + if [ "a$head" == "a1f8b" ]; then + log INFO "Found valid gzip archive" + # gzip header found, normal image + # Don't use the header stuff for now, move the file instead + EXTRACTED_IMAGE=$IMAGE_LOCATION + else + log INFO "Search gzip archive in image" + for i in $(seq 0 1024); do + head=$(get_bin $i 2) + if [ "a$head" == "a1f8b" ]; then + log INFO "Found gzip archive in image, extracting now" + EXTRACTED_IMAGE=$(mktemp) + dd if=$IMAGE_LOCATION bs=$i skip=1 of=$EXTRACTED_IMAGE 2>/dev/null + break + fi + done + test $i -eq 1024 && echo "Could not find a vaild gzip archive" && exit -1 + fi + + # This is not the original sw-update, we use plain tar.gz + # extract_header_infos + # check_image_compatibility # extract_image - # Don't use the header stuff for now, move the file instead - EXTRACTED_IMAGE=$IMAGE_LOCATION # Also don't check the md5 sum # check_image_md5 + log INFO "Installing linux update ..." + flash_firmware cleanup From 8bd7aba78aa4a87fef42fbbfc8998a1076398797 Mon Sep 17 00:00:00 2001 From: Stefan Eichenberger Date: Tue, 23 Aug 2016 18:05:08 +0200 Subject: [PATCH 04/10] nbhw16-ctrl.py: update to networkmanager, etc. --- .../nbhw16-ctrl/nbhw16-ctrl/nbhw16-ctrl.py | 99 +++++++++++++++---- 1 file changed, 78 insertions(+), 21 deletions(-) diff --git a/recipes-demo/nbhw16-ctrl/nbhw16-ctrl/nbhw16-ctrl.py b/recipes-demo/nbhw16-ctrl/nbhw16-ctrl/nbhw16-ctrl.py index 5e1bc8e..309b713 100644 --- a/recipes-demo/nbhw16-ctrl/nbhw16-ctrl/nbhw16-ctrl.py +++ b/recipes-demo/nbhw16-ctrl/nbhw16-ctrl/nbhw16-ctrl.py @@ -30,39 +30,96 @@ def write_to_modem(data, read=False): return data -def get_modem(): - interface = "eth2" - try: - call_and_throw("ifconfig {0} &> /dev/null".format(interface)) - except: - interface = "usb0" - # Make sure that we now have a valid modem - call_and_throw("ifconfig {0} &> /dev/null".format(interface)) - return interface - - def setup_modem(provider): - if provider == "swisscom": - write_to_modem("AT^NDISDUP=1,1,\"gprs.swisscom.ch\"\r\n") - + apn = "gprs.swisscom.ch" if provider == "salt": - write_to_modem("AT^NDISDUP=1,1,\"click\"\r\n") + apn = "click" - call_and_throw("udhcpc -i {0}".format(get_modem())) + modem_config = """[connection] +id=Modem +type=gsm +interface-name=ttyUSB2 +permissions= +secondaries= + +[gsm] +apn={0} +number=*99# + +[ipv4] +dns-search= +method=auto + +[ipv6] +dns-search= +method=auto +""".format(apn) + + f = open("/etc/NetworkManager/system-connections/Modem", "w") + f.write(modem_config) + f.close() + + call_and_throw("chmod 600 /etc/NetworkManager/system-connections/Modem") + call_and_throw("nmcli c load /etc/NetworkManager/system-connections/Modem") + call_and_throw("nmcli c up Modem") def setup_ap(): - call_and_throw("ifconfig {0} 192.168.0.1".format(WLAN_INTERFACE)) - # Start udhcpd with config from /etc/udhcpd.conf - call_and_throw("udhcpd") + ap_config = """ [connection] +id=Wifi +type=wifi +interface-name=wlan0 +autoconnect=true +permissions= +secondaries= + +[wifi] +band=bg +mac-address-blacklist= +mode=ap +seen-bssids= +ssid=test + +[wifi-security] +auth-alg=open +group=ccmp; +key-mgmt=wpa-psk +pairwise=ccmp; +proto=rsn; +psk=NetModu1e + +[ipv4] +address1=192.168.0.1/24 +dns-search= +method=manual + +[ipv6] +dns-search= +method=auto +""" + f = open("/etc/NetworkManager/system-connections/Wifi", "w") + f.write(ap_config) + f.close() + call_and_throw("chmod 600 /etc/NetworkManager/system-connections/Wifi") + call_and_throw("nmcli c load /etc/NetworkManager/system-connections/Wifi") + call_and_throw("nmcli c up Wifi") + + dnsmasq_config = """ + domain-needed + bogus-priv + dhcp-range=192.168.0.100,192.168.0.200,12h + """ + f = open("/etc/dnsmasq.conf", "w") + f.write(dnsmasq_config) + f.close() + call_and_throw("systemctl restart dnsmasq") def setup_routing(): f = open("/proc/sys/net/ipv4/ip_forward", "w") f.write("1\n") f.close() - call_and_throw("iptables -t nat -A POSTROUTING -o {0} -j MASQUERADE". - format(get_modem())) + call_and_throw("iptables -t nat -A POSTROUTING -o eth2 -j MASQUERADE") def main(): From de9fca5ef8f065f593df75860926e88680071748 Mon Sep 17 00:00:00 2001 From: Stefan Eichenberger Date: Tue, 23 Aug 2016 18:05:46 +0200 Subject: [PATCH 05/10] cockpit: update dependencies and add new pam file --- recipes-extended/cockpit/cockpit/cockpit.pam | 11 ++++++++--- recipes-extended/cockpit/cockpit_0.115.bb | 10 +++++++++- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/recipes-extended/cockpit/cockpit/cockpit.pam b/recipes-extended/cockpit/cockpit/cockpit.pam index 06c6e20..2b94713 100644 --- a/recipes-extended/cockpit/cockpit/cockpit.pam +++ b/recipes-extended/cockpit/cockpit/cockpit.pam @@ -1,4 +1,9 @@ #%PAM-1.0 -auth required pam_unix.so -account required pam_unix.so -session required pam_unix.so +auth required pam_unix.so +auth optional pam_reauthorize.so prepare +auth optional pam_ssh_add.so +account required pam_unix.so +session required pam_unix.so +session optional pam_reauthorize.so prepare +session optional pam_ssh_add.so +password required pam_unix.so nullok obscure min=4 max=12 diff --git a/recipes-extended/cockpit/cockpit_0.115.bb b/recipes-extended/cockpit/cockpit_0.115.bb index d200130..9211fc4 100644 --- a/recipes-extended/cockpit/cockpit_0.115.bb +++ b/recipes-extended/cockpit/cockpit_0.115.bb @@ -5,6 +5,8 @@ SECTION = "console/network" LICENSE = "GPLv2+" LIC_FILES_CHKSUM = "file://COPYING;md5=4fbd65380cdd255951079008b364516c" +inherit systemd + SRCREV = "39be0a69e4b03907a947d957afe20d394179677e" SRC_URI = "git://github.com/cockpit-project/cockpit.git;protocol=https \ file://cockpit.pam \ @@ -13,10 +15,13 @@ SRC_URI = "git://github.com/cockpit-project/cockpit.git;protocol=https \ S = "${WORKDIR}/git" DEPENDS = "node-native json-glib libssh libpam keyutils krb5 systemd polkit glib-networking" -RDEPENDS_${PN} = "json-glib libssh libpam keyutils krb5 libsystemd polkit bash glib-networking" +# opnessh-misc gets ssh-agent which is needed to execute ssh commands on the target +RDEPENDS_${PN} = "json-glib libssh libpam keyutils krb5 libsystemd polkit bash glib-networking openssh-misc libpwquality" EXTRA_AUTORECONF_append = " -I ${STAGING_DATADIR}/aclocal" +SYSTEMD_SERVICE_${PN} = "cockpit.socket" + INHIBIT_PACKAGE_DEBUG_SPLIT = "1" INHIBIT_PACKAGE_STRIP = "1" @@ -38,6 +43,9 @@ do_install() { sed -i "s#install-data-local:: doc/guide/html/index.html#bla-install-data-local:: doc/guide/html/index.html#" ./Makefile oe_runmake DESTDIR=${D} install + mkdir -p ${D}/lib + mv ${D}/usr/local/lib/security ${D}/lib/ + mkdir -p ${D}/etc/pam.d/ cp ${WORKDIR}/cockpit.pam ${D}/etc/pam.d/cockpit } From 8cb7a7fca58ace4e06002804ecc689e49e5f30d0 Mon Sep 17 00:00:00 2001 From: Stefan Eichenberger Date: Tue, 23 Aug 2016 18:06:26 +0200 Subject: [PATCH 06/10] glibc: backport a patch from mainline Glibc locals were invalid without this patch --- recipes-core/glibc/cross-localedef-native_%.bbappend | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 recipes-core/glibc/cross-localedef-native_%.bbappend diff --git a/recipes-core/glibc/cross-localedef-native_%.bbappend b/recipes-core/glibc/cross-localedef-native_%.bbappend new file mode 100644 index 0000000..a99b159 --- /dev/null +++ b/recipes-core/glibc/cross-localedef-native_%.bbappend @@ -0,0 +1,4 @@ +# This is a backport of http://git.yoctoproject.org/cgit.cgi/poky/commit/meta/recipes-core/glibc?id=c57ba52b70d803c737d694eb3046d8ede6703749 can be removed with newer poky versions +SRC_URI_append = " \ + file://strcoll-Remove-incorrect-STRDIFF-based-optimization-.patch \ + " From c9ed61d6f6e8f4da5bbeac540a2e7fe9be57c132 Mon Sep 17 00:00:00 2001 From: Stefan Eichenberger Date: Tue, 23 Aug 2016 18:07:13 +0200 Subject: [PATCH 07/10] modemmanager: add support for me909s --- recipes-core/images/nmrouter-image.bb | 1 + 1 file changed, 1 insertion(+) diff --git a/recipes-core/images/nmrouter-image.bb b/recipes-core/images/nmrouter-image.bb index 1b920c8..3a75c80 100644 --- a/recipes-core/images/nmrouter-image.bb +++ b/recipes-core/images/nmrouter-image.bb @@ -38,6 +38,7 @@ IMAGE_INSTALL_append = " \ kernel-devicetree \ python-subprocess \ networkmanager \ + modemmanager \ cockpit \ board-descriptor \ sw-update \ From b48a9921ab72eaae1cfa2321f2f2ec3fd87c9aa9 Mon Sep 17 00:00:00 2001 From: Stefan Eichenberger Date: Tue, 23 Aug 2016 18:09:03 +0200 Subject: [PATCH 08/10] libpwquality: add recipe for libpwquality This recipe is used by cockpit to check the pwd quality --- .../libpwquality/libpwquality_1.3.0.bb | 59 +++++++++++++++++++ 1 file changed, 59 insertions(+) create mode 100644 recipes-support/libpwquality/libpwquality_1.3.0.bb diff --git a/recipes-support/libpwquality/libpwquality_1.3.0.bb b/recipes-support/libpwquality/libpwquality_1.3.0.bb new file mode 100644 index 0000000..3e2ed22 --- /dev/null +++ b/recipes-support/libpwquality/libpwquality_1.3.0.bb @@ -0,0 +1,59 @@ +SUMMARY = "Library for password quality checking and generating random passwords" +HOMEPAGE = "https://launchpad.net/libpwquality" +LICENSE = "GPLv2+" +LIC_FILES_CHKSUM = "file://COPYING;md5=6bd2f1386df813a459a0c34fde676fc2" + +SRC_URI = "https://launchpad.net/${BPN}/trunk/${PV}/+download/${BPN}-${PV}.tar.bz2" +SRC_URI[md5sum] = "2a3d4ba1d11b52b4f6a7f39622ebf736" +SRC_URI[sha256sum] = "74d2ea90e103323c1f2d6a6cc9617cdae6877573eddb31aaf31a40f354cc2d2a" + +inherit autotools-brokensep pkgconfig gettext pythonnative + +DEPENDS = "zlib cracklib libpam" + +EXTRA_OECONF = " \ + --with-securedir=${base_libdir}/security \ + --with-python-binary=${PYTHON} \ +" + +do_compile() { + # make distustils part for python bindings happy + export STAGING_INCDIR=${STAGING_INCDIR} + export STAGING_LIBDIR=${STAGING_LIBDIR} + export BUILD_SYS=${BUILD_SYS} + export HOST_SYS=${HOST_SYS} + base_do_compile +} + +do_install() { + # make distustils part for python bindings happy + export STAGING_INCDIR=${STAGING_INCDIR} + export STAGING_LIBDIR=${STAGING_LIBDIR} + export BUILD_SYS=${BUILD_SYS} + export HOST_SYS=${HOST_SYS} + autotools_do_install +} + +FILES_${PN} += " \ + ${base_libdir}/security/*.so \ +" + +PACKAGE_BEFORE_PN += "${PN}-python" + +FILES_${PN}-python = " \ + ${PYTHON_SITEPACKAGES_DIR} \ +" + +FILES_${PN}-staticdev += " \ + ${PYTHON_SITEPACKAGES_DIR}/*.a \ + ${base_libdir}/security/*.a \ +" +FILES_${PN}-dev += " \ + ${PYTHON_SITEPACKAGES_DIR}/*.la \ + ${base_libdir}/security/*.la \ +" + +FILES_${PN}-dbg += "\ + ${PYTHON_SITEPACKAGES_DIR}/.debug \ + ${base_libdir}/security/.debug \ +" From 8c64671994da75490acf58a93785ccd827a94679 Mon Sep 17 00:00:00 2001 From: Stefan Eichenberger Date: Tue, 23 Aug 2016 18:09:49 +0200 Subject: [PATCH 09/10] dnsmasq: add support for dbus --- recipes-support/dnsmasq/dnsmasq_%.bbappend | 1 + 1 file changed, 1 insertion(+) create mode 100644 recipes-support/dnsmasq/dnsmasq_%.bbappend diff --git a/recipes-support/dnsmasq/dnsmasq_%.bbappend b/recipes-support/dnsmasq/dnsmasq_%.bbappend new file mode 100644 index 0000000..2597af3 --- /dev/null +++ b/recipes-support/dnsmasq/dnsmasq_%.bbappend @@ -0,0 +1 @@ +PACKAGECONFIG_append = " dbus" From 1f7a1549242e39eb227f437e078f8ca2231c6ea8 Mon Sep 17 00:00:00 2001 From: Stefan Eichenberger Date: Thu, 25 Aug 2016 15:56:23 +0200 Subject: [PATCH 10/10] nbhw16: use bluetooth in non_st mode If bluetooth is used in non_st mode we can use the normal uart_hci driver. This driver works much better and the whole setup is much easier. We don't need the Shared Transfer stuff anyhow, because the module does not have GPS or FM. --- .../images/{nmrouter-dev-image.bb => nmrouter-image-dev.bb} | 0 recipes-core/images/nmrouter-image.bb | 1 + 2 files changed, 1 insertion(+) rename recipes-core/images/{nmrouter-dev-image.bb => nmrouter-image-dev.bb} (100%) diff --git a/recipes-core/images/nmrouter-dev-image.bb b/recipes-core/images/nmrouter-image-dev.bb similarity index 100% rename from recipes-core/images/nmrouter-dev-image.bb rename to recipes-core/images/nmrouter-image-dev.bb diff --git a/recipes-core/images/nmrouter-image.bb b/recipes-core/images/nmrouter-image.bb index 3a75c80..1802dbd 100644 --- a/recipes-core/images/nmrouter-image.bb +++ b/recipes-core/images/nmrouter-image.bb @@ -50,6 +50,7 @@ IMAGE_INSTALL_cortex9hf_append = " kernel-devicetree " IMAGE_INSTALL_append_am335x-nbhw16 = " \ nbhw16-ctrl \ tibluetooth \ + bluez5-obex \ " LICENSE = "BSD"