Merge branch 'cockpit' into telephony

This commit is contained in:
Stefan Eichenberger 2016-08-31 10:17:44 +02:00
commit f75988662e
11 changed files with 282 additions and 80 deletions

View File

@ -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 \
"

View File

@ -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} \
"

View File

@ -1,45 +1,27 @@
inherit core-image inherit core-image
SUMMARY = "Test image" SUMMARY = "nmrouter image"
KERNEL_IMAGETYPE = "uImage" KERNEL_IMAGETYPE = "uImage"
IMAGE_FSTYPES_append = " tar.gz " IMAGE_FSTYPES_append = " tar.gz "
IMAGE_FEATURES_append = " \
tools-debug \
"
IMAGE_FEATURES_append = " \ IMAGE_FEATURES_append = " \
package-management \ package-management \
ssh-server-openssh \ 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" PREFERED_VERSION-pn_nodejs = "4.4.5"
IMAGE_INSTALL_append = " \ FIRMWARE ?= "linux-firmware"
linux-firmware \ FIRMWARE_am335x-nbhw16 = " \
linux-firmware-ath6k \
linux-firmware-ath9k \ linux-firmware-ath9k \
linux-firmware-wl12xx\
linux-firmware-wl18xx\
"
IMAGE_INSTALL_append = " \
hostapd \ hostapd \
iw \ iw \
crda \ crda \
@ -48,22 +30,19 @@ IMAGE_INSTALL_append = " \
bash \ bash \
iproute2 \ iproute2 \
ethtool \ ethtool \
i2c-tools \
lrzsz \
devmem2 \ devmem2 \
openvpn \ openvpn \
iptables \ iptables \
pciutils \ pciutils \
kernel-modules \ kernel-modules \
kernel-devicetree \ kernel-devicetree \
node \
python-subprocess \ python-subprocess \
networkmanager \ networkmanager \
modemmanager \
cockpit \ cockpit \
board-descriptor \ board-descriptor \
sw-update \ sw-update \
${BENCH_TOOLS} \ ${FIRMWARE} \
${EASY_EDITOR} \
" "
IMAGE_INSTALL_cortex9hf-neon_append = " kernel-devicetree " IMAGE_INSTALL_cortex9hf-neon_append = " kernel-devicetree "
@ -71,6 +50,7 @@ IMAGE_INSTALL_cortex9hf_append = " kernel-devicetree "
IMAGE_INSTALL_append_am335x-nbhw16 = " \ IMAGE_INSTALL_append_am335x-nbhw16 = " \
nbhw16-ctrl \ nbhw16-ctrl \
tibluetooth \ tibluetooth \
bluez5-obex \
" "
LICENSE = "BSD" LICENSE = "BSD"

View File

@ -1,20 +1,23 @@
inherit core-image DISTRO_FEATURES_BACKFILL_CONSIDERED = " wifi bluetooth"
inherit image
SUMMARY = "Minimal image for bringup" SUMMARY = "Minimal image for bringup"
IMAGE_FEATURES += " \ #IMAGE_FEATURES += " \
package-management \ # "
ssh-server-openssh \
"
IMAGE_INSTALL += " \ #IMAGE_INSTALL += " \
openssh-sftp-server \ # lrzsz \
bash \ # devmem2 \
ethtool \ # "
i2c-tools \
lrzsz \
devmem2 \
"
IMAGE_INSTALL = " \
packagegroup-core-boot \
e2fsprogs \
lrzsz \
devmem2 \
"
LICENSE = "BSD" LICENSE = "BSD"

View File

@ -17,7 +17,8 @@ source /etc/default/sw_update_config
log() { log() {
local level=${1?} local level=${1?}
shift shift
local code= line="[$(date '+%F %T')] $level: $*" local code=
local line="[$(date '+%F %T')] $level: $*"
if [ -t 2 ] if [ -t 2 ]
then then
case "$level" in case "$level" in
@ -190,18 +191,44 @@ check_file()
fi fi
} }
get_bin()
{
echo $(dd if=$IMAGE_LOCATION bs=1 count=$2 skip=$1 2>/dev/null | hexdump -ve '1/1 "%.2x"')
}
update_linux() update_linux()
{ {
log INFO "Starting linux update ..." log INFO "Starting linux update ..."
check_file $1 check_file $1
#extract_header_infos head=$(get_bin 0 2)
#check_image_compatibility 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 # 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 # Also don't check the md5 sum
# check_image_md5 # check_image_md5
log INFO "Installing linux update ..."
flash_firmware flash_firmware
cleanup cleanup

View File

@ -1,12 +1,35 @@
PLATFORM_FIRST_PARTITION="/dev/mmcblk0p2" PLATFORM_FIRST_PARTITION="/dev/mmcblk0p1"
PLATFORM_SECOND_PARTITION="/dev/mmcblk0p3" PLATFORM_SECOND_PARTITION="/dev/mmcblk0p2"
PLATFORM_BOOT_PARTITION="/dev/mmcblk0p1"
PLATFORM_PROD_COMPATIBILITY= PLATFORM_PROD_COMPATIBILITY=
PLATFORM_HW_VERSION= 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() 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
} }

View File

@ -30,39 +30,96 @@ def write_to_modem(data, read=False):
return data 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): def setup_modem(provider):
if provider == "swisscom": apn = "gprs.swisscom.ch"
write_to_modem("AT^NDISDUP=1,1,\"gprs.swisscom.ch\"\r\n")
if provider == "salt": 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(): def setup_ap():
call_and_throw("ifconfig {0} 192.168.0.1".format(WLAN_INTERFACE)) ap_config = """ [connection]
# Start udhcpd with config from /etc/udhcpd.conf id=Wifi
call_and_throw("udhcpd") 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(): def setup_routing():
f = open("/proc/sys/net/ipv4/ip_forward", "w") f = open("/proc/sys/net/ipv4/ip_forward", "w")
f.write("1\n") f.write("1\n")
f.close() f.close()
call_and_throw("iptables -t nat -A POSTROUTING -o {0} -j MASQUERADE". call_and_throw("iptables -t nat -A POSTROUTING -o eth2 -j MASQUERADE")
format(get_modem()))
def main(): def main():

View File

@ -1,4 +1,9 @@
#%PAM-1.0 #%PAM-1.0
auth required pam_unix.so auth required pam_unix.so
account required pam_unix.so auth optional pam_reauthorize.so prepare
session required pam_unix.so 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

View File

@ -5,6 +5,8 @@ SECTION = "console/network"
LICENSE = "GPLv2+" LICENSE = "GPLv2+"
LIC_FILES_CHKSUM = "file://COPYING;md5=4fbd65380cdd255951079008b364516c" LIC_FILES_CHKSUM = "file://COPYING;md5=4fbd65380cdd255951079008b364516c"
inherit systemd
SRCREV = "39be0a69e4b03907a947d957afe20d394179677e" SRCREV = "39be0a69e4b03907a947d957afe20d394179677e"
SRC_URI = "git://github.com/cockpit-project/cockpit.git;protocol=https \ SRC_URI = "git://github.com/cockpit-project/cockpit.git;protocol=https \
file://cockpit.pam \ file://cockpit.pam \
@ -13,10 +15,13 @@ SRC_URI = "git://github.com/cockpit-project/cockpit.git;protocol=https \
S = "${WORKDIR}/git" S = "${WORKDIR}/git"
DEPENDS = "node-native json-glib libssh libpam keyutils krb5 systemd polkit glib-networking" 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" EXTRA_AUTORECONF_append = " -I ${STAGING_DATADIR}/aclocal"
SYSTEMD_SERVICE_${PN} = "cockpit.socket"
INHIBIT_PACKAGE_DEBUG_SPLIT = "1" INHIBIT_PACKAGE_DEBUG_SPLIT = "1"
INHIBIT_PACKAGE_STRIP = "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 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 oe_runmake DESTDIR=${D} install
mkdir -p ${D}/lib
mv ${D}/usr/local/lib/security ${D}/lib/
mkdir -p ${D}/etc/pam.d/ mkdir -p ${D}/etc/pam.d/
cp ${WORKDIR}/cockpit.pam ${D}/etc/pam.d/cockpit cp ${WORKDIR}/cockpit.pam ${D}/etc/pam.d/cockpit
} }

View File

@ -0,0 +1 @@
PACKAGECONFIG_append = " dbus"

View File

@ -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 \
"