Compare commits
36 Commits
| Author | SHA1 | Date |
|---|---|---|
|
|
1f08b06381 | |
|
|
31f86005b3 | |
|
|
e578b54105 | |
|
|
1658fc3621 | |
|
|
2713389914 | |
|
|
331ff2291b | |
|
|
4f7c0fece9 | |
|
|
92654f1907 | |
|
|
0e0ae3254c | |
|
|
b98dbc71a3 | |
|
|
40aca5599e | |
|
|
5fd5028063 | |
|
|
becbb56002 | |
|
|
4f1be4fe1b | |
|
|
8cea86285c | |
|
|
50723f08d9 | |
|
|
fa843b5729 | |
|
|
e74942f372 | |
|
|
a44eb7a9f6 | |
|
|
0f50b0ad35 | |
|
|
b033cd3f9d | |
|
|
0ab0535705 | |
|
|
d146532b31 | |
|
|
c3135842b5 | |
|
|
5116f1802d | |
|
|
011fc23c21 | |
|
|
68af9813d6 | |
|
|
c001bc907f | |
|
|
56295e2ed0 | |
|
|
d0e8bfaf25 | |
|
|
1f23dae1db | |
|
|
064ed29756 | |
|
|
4aa5842711 | |
|
|
4e12267cf4 | |
|
|
e2dba2dc79 | |
|
|
f1f908ce59 |
|
|
@ -0,0 +1 @@
|
|||
WKS_FILE_sota = "sdimage-sota-mek.wks"
|
||||
|
|
@ -25,4 +25,4 @@ UBOOT_ENTRYPOINT ?= "0x80008000"
|
|||
IMAGE_BOOT_FILES = "MLO u-boot.img"
|
||||
|
||||
PREFERRED_PROVIDER_virtual/kernel = "linux-netmodule"
|
||||
PREFERRED_PROVIDER_virtual/bootloader = "u-boot-am335x-nmhw21-v1"
|
||||
PREFERRED_PROVIDER_virtual/bootloader = "u-boot-am335x-nmhw21"
|
||||
|
|
|
|||
|
|
@ -12,10 +12,17 @@ MACHINE_EXTRA_RRECOMMENDS = " kernel-modules kernel-devicetree"
|
|||
KERNEL_DEFCONFIG ??= "am335x-nrhw20_defconfig"
|
||||
KERNEL_DEVICETREE = "am335x-nrhw20-prod1.dtb \
|
||||
"
|
||||
|
||||
SOTA_MACHINE = "${MACHINE}"
|
||||
|
||||
KERNEL_CLASSES_append = " kernel-fitimage"
|
||||
|
||||
KERNEL_IMAGETYPE = "zImage"
|
||||
KERNEL_IMAGETYPES = "fitImage zImage"
|
||||
KERNEL_IMAGETYPE_sota = "fitImage"
|
||||
KERNEL_IMAGETYPES_sota = "fitImage"
|
||||
UBOOT_ENTRYPOINT ?= "0x80008000"
|
||||
IMAGE_BOOT_FILES = "MLO u-boot.img"
|
||||
|
||||
PREFERRED_PROVIDER_virtual/bootloader = "u-boot-am335x-nrhw20-v1"
|
||||
PREFERRED_PROVIDER_virtual/kernel = "linux-netmodule"
|
||||
PV_pn-linux-netmodule = "4.14.14-${SRCPV}"
|
||||
SRC_URI_pn-linux-netmodule ?= "git://git.netmodule.intranet/yoctoproject/linux-netmodule.git;protocol=ssh;user=gitea;branch=4.14/standard/nrhw20"
|
||||
|
||||
PREFERRED_PROVIDER_virtual/bootloader = "u-boot-am335x-nrhw20-v1"
|
||||
|
|
|
|||
|
|
@ -0,0 +1,28 @@
|
|||
#@TYPE: Machine
|
||||
#@NAME: NXP MEK Board
|
||||
#@DESCRIPTION: Machine configuration for the mek evalboard
|
||||
|
||||
require conf/machine/include/arm/arch-arm64.inc
|
||||
|
||||
IMAGE_FSTYPES += "tar.gz cpio cpio.gz.u-boot"
|
||||
IMAGE_CLASSES += "image_types"
|
||||
|
||||
MACHINE_EXTRA_RRECOMMENDS = " kernel-modules kernel-devicetree"
|
||||
|
||||
KERNEL_DEFCONFIG = ""
|
||||
KERNEL_DEVICETREE = "freescale/fsl-imx8qxp-mek.dtb freescale/fsl-imx8qxp-mek-dom0.dtb"
|
||||
|
||||
SOTA_MACHINE = "${MACHINE}"
|
||||
|
||||
KERNEL_CLASSES_append = " kernel-fitimage"
|
||||
|
||||
KERNEL_IMAGETYPE = "Image"
|
||||
KERNEL_IMAGETYPES = "fitImage Image"
|
||||
KERNEL_IMAGETYPE_sota = "fitImage"
|
||||
KERNEL_IMAGETYPES_sota = "fitImage"
|
||||
UBOOT_ENTRYPOINT ?= "0x80020000"
|
||||
UBOOT_MACHINE = "imx8qxp_mek_defconfig"
|
||||
IMAGE_BOOT_FILES = "flash.bin"
|
||||
|
||||
PREFERRED_PROVIDER_virtual/kernel = "linux-netmodule"
|
||||
PREFERRED_PROVIDER_virtual/bootloader = "u-boot-imx8-mek"
|
||||
Binary file not shown.
|
|
@ -0,0 +1,11 @@
|
|||
[Unit]
|
||||
After=tibluetooth.service
|
||||
|
||||
[Service]
|
||||
Type=oneshot
|
||||
ExecStart=/usr/bin/mac-address-set
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,25 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
eth_mac=$(ip addr show eth0 | awk '$1 == "link/ether" {gsub(/\/.*$/, "", $2); print $2}')
|
||||
wlan_mac=$(echo $eth_mac | sed -r "s/^(.{9})50(.{6})/\170\2/")
|
||||
bt_addr=$(echo $eth_mac | sed -r "s/^(.{9})50(.{6})/\180\2/")
|
||||
|
||||
|
||||
# Set WLAN address
|
||||
ifconfig wlan0 | grep UP > /dev/null
|
||||
up=$?
|
||||
if [[ $up == 0 ]]; then
|
||||
ifconfig wlan0 down
|
||||
fi
|
||||
ip link set wlan0 address $wlan_mac
|
||||
|
||||
if [[ $up == 0 ]]; then
|
||||
ifconfig wlan0 up
|
||||
fi
|
||||
|
||||
|
||||
# Set BT address
|
||||
bt_addr_rev=$(echo $bt_addr | sed -r "s/^(.{2}):(.{2}):(.{2}):(.{2}):(.{2}):(.{2})/\6:\5:\4:\3:\2:\1/")
|
||||
bdaddr $bt_addr_rev
|
||||
hciconfig hci0 reset
|
||||
systemctl restart bluetooth
|
||||
|
|
@ -1,26 +1,23 @@
|
|||
SUMMARY = "Ublox gsm configuration"
|
||||
DESCRIPTION = "Configure ublox gsm modem on first boot"
|
||||
SUMMARY = "Set mac addresses of Wifi and bluetooth chips"
|
||||
DESCRIPTION = "Small scripts that set the mac addresses based on ethernet mac"
|
||||
AUTHOR = "Alexandre Bard"
|
||||
|
||||
SECTION = "connectivity"
|
||||
LICENSE = "GPLv2+"
|
||||
LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/GPL-2.0;md5=801f80980d171dd6425610833a22dbe6"
|
||||
PR = "r2"
|
||||
|
||||
RDEPENDS_${PN}="python3-pyserial"
|
||||
|
||||
inherit systemd
|
||||
|
||||
SRC_URI = " \
|
||||
file://ublox-config.service \
|
||||
file://ublox-config.py \
|
||||
file://mac-address-set.service \
|
||||
file://mac-address-set.sh \
|
||||
"
|
||||
|
||||
S = "${WORKDIR}"
|
||||
|
||||
INHIBIT_PACKAGE_DEBUG_SPLIT = "1"
|
||||
|
||||
SYSTEMD_SERVICE_${PN} = "ublox-config.service"
|
||||
SYSTEMD_SERVICE_${PN} = "mac-address-set.service"
|
||||
SYSTEMD_AUTO_ENABLE ?= "enable"
|
||||
|
||||
FILES_${PN}_append = " \
|
||||
|
|
@ -30,9 +27,9 @@ FILES_${PN}_append = " \
|
|||
|
||||
do_install () {
|
||||
install -d ${D}${systemd_unitdir}/system/
|
||||
install -m 0644 ublox-config.service ${D}${systemd_unitdir}/system/
|
||||
install -m 0644 mac-address-set.service ${D}${systemd_unitdir}/system/
|
||||
|
||||
install -d ${D}/usr/bin
|
||||
install -m 0755 ublox-config.py ${D}/usr/bin
|
||||
install -m 0755 mac-address-set.sh ${D}/usr/bin/mac-address-set
|
||||
}
|
||||
|
||||
|
|
@ -7,7 +7,7 @@ UBOOT_MACHINE = "am335x_nmhw21_defconfig"
|
|||
SRC_URI = "git://git.netmodule.intranet/nmrouter/u-boot;protocol=ssh;user=gitea;branch=2016.05-am335x-netmodule"
|
||||
|
||||
# Should be updated when a new U-Boot Version is available
|
||||
SRCREV ?= "${AUTOREV}"
|
||||
SRCREV ?= "5c5c0b98fea0e9514d56de05c2033440608a53ef"
|
||||
PV = "v2016.05+git${SRCPV}"
|
||||
|
||||
SPL_BINARY = "MLO"
|
||||
|
|
@ -1,8 +1,8 @@
|
|||
require u-boot-nm.inc
|
||||
|
||||
# Force machine configuration for this recipe
|
||||
UBOOT_MACHINE = "am335x_nbhw16_defconfig"
|
||||
|
||||
require u-boot-nm.inc
|
||||
|
||||
# Be aware github/netmodule git
|
||||
SRC_URI = "git://git.netmodule.intranet/nmrouter/u-boot;protocol=ssh;user=gitea;branch=2016.05-am335x-netmodule"
|
||||
|
||||
|
|
@ -14,13 +14,11 @@ SPL_BINARY = "MLO"
|
|||
UBOOT_SUFFIX = "img"
|
||||
|
||||
do_deploy_append() {
|
||||
rm -f ${DEPLOYDIR}/${PN}-spl.bin
|
||||
rm -f ${DEPLOYDIR}/${PN}.bin
|
||||
rm -f ${DEPLOYDIR}/${PN}.img
|
||||
rm -f ${DEPLOYDIR}/MLO-${PN}
|
||||
cp ${S}/spl/u-boot-spl.bin ${DEPLOYDIR}/${PN}-spl.bin
|
||||
cp ${S}/u-boot.bin ${DEPLOYDIR}/${PN}.bin
|
||||
cp ${S}/u-boot.img ${DEPLOYDIR}/${PN}.img
|
||||
cp ${S}/MLO ${DEPLOYDIR}/MLO-${PN}
|
||||
rm -f ${DEPLOYDIR}/*${PN}.xmodem.bin
|
||||
rm -f ${DEPLOYDIR}/*${PN}.${UBOOT_SUFFIX}
|
||||
cp ${S}/spl/u-boot-spl.bin ${DEPLOYDIR}/spl-${PN}.xmodem.bin
|
||||
cp ${S}/u-boot.bin ${DEPLOYDIR}/${PN}.xmodem.bin
|
||||
cp ${S}/u-boot.img ${DEPLOYDIR}/${PN}.${UBOOT_SUFFIX}
|
||||
cp ${S}/MLO ${DEPLOYDIR}/spl-${PN}.${UBOOT_SUFFIX}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -3,5 +3,5 @@ require u-boot-am335x-nrhw16-v1_git.bb
|
|||
# Force machine configuration for this recipe
|
||||
UBOOT_MACHINE = "am335x_nbhw16_v2_defconfig"
|
||||
|
||||
SRCREV = "0b985705d558caceeb968b234af27cfc536ef019"
|
||||
SRCREV ?= "${AUTOREV}"
|
||||
|
||||
|
|
|
|||
|
|
@ -7,21 +7,18 @@ UBOOT_MACHINE = "am335x_nrhw20_defconfig"
|
|||
SRC_URI = "git://git.netmodule.intranet/nmrouter/u-boot;protocol=ssh;user=gitea;branch=2016.05-am335x-netmodule"
|
||||
|
||||
# Should be updated when a new U-Boot Version is available
|
||||
SRCREV ?= "297c60c69942e7d377925181b29a1f8e9515284d"
|
||||
|
||||
PV = "v2016.04+git${SRCPV}"
|
||||
SRCREV ?= "88720cc579ddc712aa73a61e3426fe4bd1b8628e"
|
||||
PV = "v2016.05+git${SRCPV}"
|
||||
|
||||
SPL_BINARY = "MLO"
|
||||
UBOOT_SUFFIX = "img"
|
||||
|
||||
do_deploy_append() {
|
||||
rm -f ${DEPLOYDIR}/${PN}-spl.bin
|
||||
rm -f ${DEPLOYDIR}/${PN}.bin
|
||||
rm -f ${DEPLOYDIR}/${PN}.img
|
||||
rm -f ${DEPLOYDIR}/MLO-${PN}
|
||||
cp ${S}/spl/u-boot-spl.bin ${DEPLOYDIR}/${PN}-spl.bin
|
||||
cp ${S}/u-boot.bin ${DEPLOYDIR}/${PN}.bin
|
||||
cp ${S}/u-boot.img ${DEPLOYDIR}/${PN}.img
|
||||
cp ${S}/MLO ${DEPLOYDIR}/MLO-${PN}
|
||||
rm -f ${DEPLOYDIR}/*${PN}.xmodem.bin
|
||||
rm -f ${DEPLOYDIR}/*${PN}.${UBOOT_SUFFIX}
|
||||
cp ${S}/spl/u-boot-spl.bin ${DEPLOYDIR}/spl-${PN}.xmodem.bin
|
||||
cp ${S}/u-boot.bin ${DEPLOYDIR}/${PN}.xmodem.bin
|
||||
cp ${S}/u-boot.img ${DEPLOYDIR}/${PN}.${UBOOT_SUFFIX}
|
||||
cp ${S}/MLO ${DEPLOYDIR}/spl-${PN}.${UBOOT_SUFFIX}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,36 @@
|
|||
require u-boot-nm.inc
|
||||
|
||||
DEPENDS += "bc-native coreutils-native dtc-native"
|
||||
|
||||
# Force machine configuration for this recipe
|
||||
UBOOT_MACHINE = "imx8qxp_mek_defconfig"
|
||||
|
||||
# Be aware github/netmodule git
|
||||
SRC_URI = "git://git.netmodule.intranet/nmrouter/u-boot;protocol=ssh;user=gitea;branch=2019.04/standard/imx8-mek"
|
||||
|
||||
# License
|
||||
LICENSE = "GPLv2+"
|
||||
LIC_FILES_CHKSUM = "file://Licenses/README;md5=30503fd321432fc713238f582193b78e"
|
||||
|
||||
# Should be updated when a new U-Boot Version is available
|
||||
SRCREV ?= "${AUTOREV}"
|
||||
PV = "v2019.04pre+git${SRCPV}"
|
||||
|
||||
UBOOT_BINARY = "flash.bin"
|
||||
UBOOT_MAKE_TARGET = "flash.bin"
|
||||
|
||||
do_compile() {
|
||||
export ATF_LOAD_ADDR=0x80000000
|
||||
export BL33_LOAD_ADDR=0x80020000
|
||||
oe_runmake ${UBOOT_MACHINE}
|
||||
# TODO: move this to U-Boot defconfig
|
||||
echo "CONFIG_CMD_EXT2=y" >> ${B}/.config
|
||||
echo "CONFIG_CMD_EXT4=y" >> ${B}/.config
|
||||
echo "CONFIG_CMD_EXT4_WRITE=y" >> ${B}/.config
|
||||
oe_runmake ${UBOOT_MAKE_TARGET}
|
||||
dd if=${S}/u-boot.itb of=${S}/flash.bin bs=512 seek=528
|
||||
}
|
||||
|
||||
do_deploy_append() {
|
||||
cp ${S}/flash.bin ${DEPLOYDIR}/flash.bin
|
||||
}
|
||||
|
|
@ -65,20 +65,20 @@ UBOOT_ENV_IMAGE ?= "${UBOOT_ENV}-${MACHINE}-${PV}-${PR}.${UBOOT_ENV_SUFFIX}"
|
|||
UBOOT_ENV_SYMLINK ?= "${UBOOT_ENV}-${MACHINE}.${UBOOT_ENV_SUFFIX}"
|
||||
|
||||
do_compile () {
|
||||
if [ "${@bb.utils.contains('DISTRO_FEATURES', 'ld-is-gold', 'ld-is-gold', '', d)}" = "ld-is-gold" ] ; then
|
||||
sed -i 's/$(CROSS_COMPILE)ld$/$(CROSS_COMPILE)ld.bfd/g' config.mk
|
||||
fi
|
||||
if [ "${@bb.utils.contains('DISTRO_FEATURES', 'ld-is-gold', 'ld-is-gold', '', d)}" = "ld-is-gold" ] ; then
|
||||
sed -i 's/$(CROSS_COMPILE)ld$/$(CROSS_COMPILE)ld.bfd/g' config.mk
|
||||
fi
|
||||
|
||||
unset LDFLAGS
|
||||
unset CFLAGS
|
||||
unset CPPFLAGS
|
||||
unset LDFLAGS
|
||||
unset CFLAGS
|
||||
unset CPPFLAGS
|
||||
|
||||
if [ ! -e ${B}/.scmversion -a ! -e ${S}/.scmversion ]
|
||||
then
|
||||
echo ${UBOOT_LOCALVERSION} > ${B}/.scmversion
|
||||
echo ${UBOOT_LOCALVERSION} > ${S}/.scmversion
|
||||
fi
|
||||
|
||||
if [ ! -e ${B}/.scmversion -a ! -e ${S}/.scmversion ]
|
||||
then
|
||||
echo ${UBOOT_LOCALVERSION} > ${B}/.scmversion
|
||||
echo ${UBOOT_LOCALVERSION} > ${S}/.scmversion
|
||||
fi
|
||||
|
||||
if [ "x${UBOOT_CONFIG}" != "x" ]
|
||||
then
|
||||
for config in ${UBOOT_MACHINE}; do
|
||||
|
|
|
|||
|
|
@ -1,9 +1,13 @@
|
|||
FILESEXTRAPATHS_prepend_am335x-nrhw20 := "${THISDIR}/${PN}:"
|
||||
FILESEXTRAPATHS_prepend_am335x-nmhw21 := "${THISDIR}/${PN}:"
|
||||
|
||||
#SRC_URI_append = " file://gpsd.service"
|
||||
|
||||
SRC_URI =+ "git://git.netmodule.intranet/nmsw/gpsd.git;protocol=ssh;user=gitea;branch=imu-integration"
|
||||
SRC_URI_remove = "http://download.savannah.gnu.org/releases/gpsd/gpsd-3.17.tar.gz"
|
||||
|
||||
# overwrite default gpsd.service file with our configuration
|
||||
SRCREV = "${AUTOREV}"
|
||||
S = "${WORKDIR}/git"
|
||||
|
||||
TTY_DEVICE = "/dev/ttyS3"
|
||||
USBAUTO_STATE = "false"
|
||||
|
|
|
|||
|
|
@ -0,0 +1,2 @@
|
|||
[device]
|
||||
wifi.scan-rand-mac-address=no
|
||||
|
|
@ -1,12 +1,16 @@
|
|||
PACKAGECONFIG_append = " modemmanager bluez5"
|
||||
FILESEXTRAPATHS_append := "${THISDIR}/${PN}"
|
||||
|
||||
SRC_URI_append = " file://system-connections.tar.gz"
|
||||
SRC_URI_append = "\
|
||||
file://system-connections.tar.gz \
|
||||
file://NetworkManager.conf \
|
||||
"
|
||||
|
||||
|
||||
do_install_append() {
|
||||
rm -rf ${D}/run ${D}${localstatedir}/run
|
||||
mkdir -p ${D}${sysconfdir}/NetworkManager/system-connections
|
||||
install -m 0600 ${WORKDIR}/system-connections/* ${D}${sysconfdir}/NetworkManager/system-connections/
|
||||
install -m 0644 ${WORKDIR}/NetworkManager.conf ${D}${sysconfdir}/NetworkManager/
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ Requires=bluetooth.target
|
|||
|
||||
[Service]
|
||||
Type=forking
|
||||
ExecStartPre=/bin/sleep 10
|
||||
ExecStartPre=-/bin/sh -c "/bin/echo 100 > /sys/class/gpio/export"
|
||||
ExecStartPre=-/bin/sh -c "/bin/echo out > /sys/class/gpio/gpio100/direction"
|
||||
ExecStartPre=/bin/sh -c "/bin/echo 1 > /sys/class/gpio/gpio100/value"
|
||||
|
|
|
|||
|
|
@ -1,39 +0,0 @@
|
|||
#!/usr/bin/env python3
|
||||
|
||||
import serial
|
||||
import sys
|
||||
import time
|
||||
|
||||
MAX_TRY = 5
|
||||
tries = 0
|
||||
ser = serial.Serial('/dev/ttyACM0', 115200, timeout=0.5)
|
||||
|
||||
def execute_and_check(cmd):
|
||||
global tries
|
||||
ser.flushInput()
|
||||
ser.write(cmd)
|
||||
ser.write(b'\r')
|
||||
s = ser.read_until(b'OK')
|
||||
if b'OK' not in s:
|
||||
print("Failed cmd : " + str(cmd))
|
||||
print("Output: " + str(s))
|
||||
tries += 1
|
||||
if tries < MAX_TRY:
|
||||
time.sleep(1)
|
||||
execute_and_check(cmd)
|
||||
else:
|
||||
sys.exit(-1)
|
||||
tries = 0
|
||||
|
||||
|
||||
print("Setting up bridge mode")
|
||||
execute_and_check(b'AT+UBMCONF=2')
|
||||
|
||||
|
||||
print("Setting up USB mode to ECM")
|
||||
execute_and_check(b'AT+UUSBCONF=2,"ECM",0')
|
||||
|
||||
|
||||
print("Resetting modem")
|
||||
ser.write(b'AT+CFUN=16\r')
|
||||
|
||||
|
|
@ -1,11 +0,0 @@
|
|||
[Unit]
|
||||
Before=ModemManager.service
|
||||
|
||||
[Service]
|
||||
Type=oneshot
|
||||
ExecStart=/bin/bash -c "ifconfig wwan0 && { echo 'already configured'; exit 0; };/usr/bin/ublox-config.py;"
|
||||
|
||||
[Install]
|
||||
WantedBy=ModemManager.service
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,89 @@
|
|||
#!/usr/bin/env python3
|
||||
|
||||
import serial
|
||||
import os
|
||||
import time
|
||||
import re
|
||||
|
||||
CONF_PATH = '/run/modem'
|
||||
|
||||
|
||||
def usb_profile_parser(output):
|
||||
x = re.search('UUSBCONF:\s\d,"(.*)",', output)
|
||||
return x.group(1)
|
||||
|
||||
def mode_parser(output):
|
||||
x = re.search('UBMCONF:\s(\d)', output)
|
||||
mode = int(x.group(1))
|
||||
if mode == 1:
|
||||
return "Router"
|
||||
elif mode == 2:
|
||||
return "Bridge"
|
||||
else:
|
||||
return "unsupported"
|
||||
|
||||
def apn_parser(output):
|
||||
x = re.search('","(.*)",', output)
|
||||
return x.group(1)
|
||||
|
||||
def default_parser(output):
|
||||
x = re.search('(.*)\n.*\nOK',output)
|
||||
return x.group(1)
|
||||
|
||||
def execute_command(ser, cmd):
|
||||
while True:
|
||||
try:
|
||||
ser.flushInput()
|
||||
ser.write(cmd)
|
||||
ser.write(b'\r')
|
||||
s = ser.read_until(b'OK')
|
||||
if(len(s.decode('utf-8')) < 4): # Avoid empty response just after reset
|
||||
continue
|
||||
break
|
||||
except Exception as e:
|
||||
print("Exception : " + str(e))
|
||||
time.sleep(1)
|
||||
continue
|
||||
return s
|
||||
|
||||
def read_config(ser, config_file, full_config_file, cmd, label='', parser=default_parser):
|
||||
s = execute_command(ser, cmd)
|
||||
if s is None:
|
||||
print('Failed to execute command : ' + str(cmd))
|
||||
return
|
||||
|
||||
full_conf = label + '\n' + s.decode('utf-8').strip("OK")
|
||||
conf = (label + ':').ljust(20) + parser(s.decode('utf-8')) + '\n'
|
||||
|
||||
full_config_file.write(full_conf)
|
||||
config_file.write(conf)
|
||||
|
||||
def dump_modem_config(ser):
|
||||
os.makedirs(CONF_PATH, exist_ok=True)
|
||||
full_config_file = open(CONF_PATH + '/modem-at.config', 'w')
|
||||
config_file = open(CONF_PATH + '/modem.config', 'w')
|
||||
|
||||
read_config(ser, config_file, full_config_file, b'AT+CGMI', 'VendorID')
|
||||
read_config(ser, config_file, full_config_file, b'AT+CGMM', 'ModelID')
|
||||
read_config(ser, config_file, full_config_file, b'AT+CGMR', 'Firmware')
|
||||
|
||||
full_config_file.write('-' * 80 + '\n' * 2)
|
||||
|
||||
read_config(ser, config_file, full_config_file, b'AT+UCGDFLT?', 'Default APN', apn_parser)
|
||||
read_config(ser, config_file, full_config_file, b'AT+UBMCONF?', 'Mode', mode_parser)
|
||||
read_config(ser, config_file, full_config_file, b'AT+UUSBCONF?', 'USBprofile', usb_profile_parser)
|
||||
|
||||
def get_usb_profile(ser):
|
||||
s = execute_command(ser, b'AT+UUSBCONF?')
|
||||
if s is None:
|
||||
print('Failed to get UUSBCONF')
|
||||
return None
|
||||
|
||||
return usb_profile_parser(s.decode('utf-8'))
|
||||
|
||||
def get_mode(ser):
|
||||
s = execute_command(ser, b'AT+UBMCONF?')
|
||||
if s is None:
|
||||
print('Failed to get UBMCONF')
|
||||
return None
|
||||
return mode_parser(s.decode('utf-8'))
|
||||
|
|
@ -0,0 +1,19 @@
|
|||
#
|
||||
# Select the SIM card to be used by the modem
|
||||
# This file is part of ublox-gsm-config service
|
||||
#
|
||||
# auto: The script will detect if a physical SIM card is
|
||||
# present and switch to eSIM if it is not the case
|
||||
# main: Use the physical SIM card on the main board
|
||||
# esim: Use the eSIM of the main bard
|
||||
# ui-top: Use the SIM card that is on top of the User Interface
|
||||
# ui-btm: Use the SIM card that is on the bottom of the User Interface
|
||||
#
|
||||
|
||||
[default]
|
||||
#SIM=esim
|
||||
#SIM=main
|
||||
#SIM=ui-top
|
||||
#SIM=ui-btm
|
||||
SIM=auto
|
||||
|
||||
|
|
@ -0,0 +1,195 @@
|
|||
#!/usr/bin/env python3
|
||||
|
||||
import serial
|
||||
import sys
|
||||
import time
|
||||
import os
|
||||
import configparser
|
||||
import gpiod
|
||||
config_dump = __import__("modem-config-dump")
|
||||
|
||||
SERIAL_DEV = '/dev/ttyACM0'
|
||||
WWAN_DEV = '/sys/class/net/wwan0'
|
||||
SIM_CONFIG = '/etc/sim.conf'
|
||||
APN_CONFIG = '/etc/apn.conf'
|
||||
|
||||
def execute_and_check(ser, cmd):
|
||||
tries = 0
|
||||
MAX_TRY = 5
|
||||
ser.flushInput()
|
||||
ser.write(cmd)
|
||||
ser.write(b'\r')
|
||||
s = ser.read_until(b'OK')
|
||||
if b'OK' not in s:
|
||||
print("Failed cmd : " + str(cmd))
|
||||
print("Output: " + str(s))
|
||||
tries += 1
|
||||
if tries < MAX_TRY:
|
||||
time.sleep(1)
|
||||
execute_and_check(ser, cmd)
|
||||
else:
|
||||
sys.exit(-1)
|
||||
tries = 0
|
||||
|
||||
def switch_sim():
|
||||
line = gpiod.find_line('SIM_SW')
|
||||
line.request(consumer='ublox-config', type=gpiod.LINE_REQ_DIR_OUT)
|
||||
line.set_value(0)
|
||||
|
||||
def sim_present(ser):
|
||||
cmd = b'AT+CCID?'
|
||||
while True:
|
||||
try:
|
||||
ser.flushInput()
|
||||
ser.write(cmd)
|
||||
ser.write(b'\r')
|
||||
s = ser.read_until(b'OK')
|
||||
if b'ERROR' in s:
|
||||
return False
|
||||
elif b'OK' in s:
|
||||
return True
|
||||
except Exception as e:
|
||||
print("Exception : " + str(e))
|
||||
time.sleep(1)
|
||||
|
||||
return s
|
||||
|
||||
def check_sim_presence(ser):
|
||||
if sim_present(ser):
|
||||
print("SIM present")
|
||||
return False
|
||||
else:
|
||||
print("no SIM card, switching to eSIM")
|
||||
switch_sim()
|
||||
return True
|
||||
|
||||
def sim_config(ser):
|
||||
config = configparser.ConfigParser()
|
||||
config.read(SIM_CONFIG)
|
||||
sim = config.get('default', 'SIM')
|
||||
print(sim)
|
||||
if sim == 'auto':
|
||||
return check_sim_presence(ser)
|
||||
elif sim == 'esim' or sim == 'ui-top':
|
||||
switch_sim()
|
||||
return True
|
||||
# ui-btm and main are default
|
||||
return False
|
||||
|
||||
def apn_setup(ser):
|
||||
if not os.path.exists(APN_CONFIG):
|
||||
print('No APN configured')
|
||||
return
|
||||
|
||||
config = configparser.ConfigParser()
|
||||
config.read(APN_CONFIG)
|
||||
|
||||
try:
|
||||
apn = config.get('default', 'apn')
|
||||
except:
|
||||
print('apn.conf malformed : no apn found\n')
|
||||
return
|
||||
try:
|
||||
user = '"' + config.get('default', 'user') + '"'
|
||||
try:
|
||||
password = '"' + config.get('default', 'password') + '"'
|
||||
except:
|
||||
print("No password for APN")
|
||||
password = 'NULL'
|
||||
except:
|
||||
print("No user for APN")
|
||||
user = 'NULL'
|
||||
password = 'NULL'
|
||||
|
||||
if not apn:
|
||||
return
|
||||
auth = '1' if user is not 'NULL' else '0'
|
||||
print("Switching to airplane mode")
|
||||
execute_and_check(ser, b'AT+CFUN=4\r')
|
||||
|
||||
print("Configuring default ctx")
|
||||
cmd = 'AT+UCGDFLT=0,"IP","' + str(apn) + '",0,0,0,0,0,0,0,0,0,0,1,0,1,0,0,0,0,' + auth + ',' + str(user) + ',' + str(password) + ',""\r'
|
||||
execute_and_check(ser, bytes(cmd, 'utf8'))
|
||||
|
||||
print("Full functionality mode")
|
||||
execute_and_check(ser, b'AT+CFUN=1\r')
|
||||
|
||||
def reset_modem(ser):
|
||||
print("Resetting modem")
|
||||
ser.write(b'AT+CFUN=16\r')
|
||||
ser.close()
|
||||
while os.path.exists(SERIAL_DEV):
|
||||
time.sleep(1)
|
||||
while not os.path.exists(SERIAL_DEV):
|
||||
time.sleep(1)
|
||||
return serial.Serial(SERIAL_DEV, 115200, timeout=0.5)
|
||||
|
||||
def factory_reset():
|
||||
print('factory reset the modem')
|
||||
if not os.path.exists(SERIAL_DEV):
|
||||
print('serial interface is not available, abort')
|
||||
return -1
|
||||
ser = serial.Serial(SERIAL_DEV, 115200, timeout=0.5)
|
||||
execute_and_check(ser, b'AT+UFACTORY=2,1')
|
||||
reset_modem(ser)
|
||||
|
||||
def poweroff(gpio):
|
||||
print('poweroff')
|
||||
if not os.path.exists(SERIAL_DEV):
|
||||
print('serial interface is not available')
|
||||
gpio.set_value(0)
|
||||
return -1
|
||||
ser = serial.Serial(SERIAL_DEV, 115200, timeout=0.5)
|
||||
ser.write(b'AT+CPWROFF\r')
|
||||
ser.close()
|
||||
|
||||
time.sleep(7.5)
|
||||
|
||||
gpio.set_value(0)
|
||||
|
||||
def help():
|
||||
print('Usage : {} [stop|factory-reset]'.format(sys.argv[0]))
|
||||
|
||||
def main():
|
||||
line = gpiod.find_line('GSM_SUP_EN')
|
||||
line.request(consumer='ublox-config', type=gpiod.LINE_REQ_DIR_OUT)
|
||||
|
||||
if len(sys.argv) == 2:
|
||||
if sys.argv[1] == 'stop':
|
||||
return poweroff(line)
|
||||
elif sys.argv[1] == 'factory-reset':
|
||||
return factory_reset()
|
||||
else:
|
||||
return help()
|
||||
|
||||
# Power on
|
||||
line.set_value(1)
|
||||
|
||||
# Wait on device
|
||||
while not os.path.exists(SERIAL_DEV):
|
||||
time.sleep(1)
|
||||
ser = serial.Serial(SERIAL_DEV, 115200, timeout=0.5)
|
||||
|
||||
rst = False
|
||||
|
||||
if 'Bridge' != config_dump.get_mode(ser):
|
||||
print("Setting up bridge mode")
|
||||
execute_and_check(ser, b'AT+UBMCONF=2')
|
||||
rst = True
|
||||
|
||||
if 'ECM' != config_dump.get_usb_profile(ser):
|
||||
print("Setting up USB mode to ECM")
|
||||
execute_and_check(ser, b'AT+UUSBCONF=2,"ECM",0')
|
||||
rst = True
|
||||
|
||||
rst = sim_config(ser) or rst
|
||||
|
||||
if rst:
|
||||
ser = reset_modem(ser)
|
||||
|
||||
apn_setup(ser)
|
||||
config_dump.dump_modem_config(ser)
|
||||
ser.close()
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
|
@ -0,0 +1,15 @@
|
|||
[Unit]
|
||||
Description=ublox GSM Modem configuration
|
||||
Before=ModemManager.service
|
||||
|
||||
[Service]
|
||||
Type=oneshot
|
||||
ExecStart=/usr/bin/ublox-gsm-config
|
||||
ExecStop=/usr/bin/ublox-gsm-config stop
|
||||
RemainAfterExit=yes
|
||||
TimeoutStopSec=20
|
||||
|
||||
[Install]
|
||||
RequiredBy=ModemManager.service
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,48 @@
|
|||
SUMMARY = "Ublox gsm configuration"
|
||||
DESCRIPTION = "Configure ublox gsm modem on first boot"
|
||||
AUTHOR = "Alexandre Bard"
|
||||
|
||||
SECTION = "connectivity"
|
||||
LICENSE = "GPLv2+"
|
||||
LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/GPL-2.0;md5=801f80980d171dd6425610833a22dbe6"
|
||||
PR = "r2"
|
||||
|
||||
RDEPENDS_${PN}="python3-pyserial"
|
||||
|
||||
inherit systemd python3-dir
|
||||
|
||||
SRC_URI = " \
|
||||
file://ublox-gsm-config.service \
|
||||
file://ublox-gsm-config.py \
|
||||
file://modem-config-dump.py \
|
||||
file://sim.conf \
|
||||
"
|
||||
|
||||
S = "${WORKDIR}"
|
||||
|
||||
INHIBIT_PACKAGE_DEBUG_SPLIT = "1"
|
||||
|
||||
SYSTEMD_SERVICE_${PN} = "ublox-gsm-config.service"
|
||||
SYSTEMD_AUTO_ENABLE ?= "enable"
|
||||
|
||||
FILES_${PN}_append = " \
|
||||
/lib \
|
||||
/usr \
|
||||
"
|
||||
|
||||
do_install () {
|
||||
install -d ${D}${systemd_unitdir}/system/
|
||||
install -m 0644 ublox-gsm-config.service ${D}${systemd_unitdir}/system/
|
||||
|
||||
install -d ${D}/usr/bin
|
||||
install -m 0755 ublox-gsm-config.py ${D}/usr/bin/ublox-gsm-config
|
||||
|
||||
install -d ${D}${PYTHON_SITEPACKAGES_DIR}
|
||||
install -m 0755 modem-config-dump.py ${D}${PYTHON_SITEPACKAGES_DIR}/
|
||||
|
||||
install -d ${D}/etc
|
||||
install -m 0644 sim.conf ${D}/etc/
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -2,9 +2,8 @@
|
|||
"tag_list": "/etc/bd/bd.json",
|
||||
"eeprom": [
|
||||
{ "path": "/sys/bus/i2c/devices/1-0050/eeprom", "valid_bds": [
|
||||
{"name": "board", "start": 0, "size": 1024},
|
||||
{"name": "platform", "start": 512, "size": 512},
|
||||
{"name": "settings", "start": 1536, "size": 512}
|
||||
{"name": "board", "start": 0, "size": 512},
|
||||
{"name": "product", "start": 512, "size": 512}
|
||||
]
|
||||
}
|
||||
]
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
"eeprom": [
|
||||
{ "path": "/sys/bus/i2c/devices/2-0050/eeprom", "valid_bds": [
|
||||
{"name": "board", "start": 0, "size": 1024},
|
||||
{"name": "platform", "start": 512, "size": 512},
|
||||
{"name": "platform", "start": 1024, "size": 512},
|
||||
{"name": "settings", "start": 1536, "size": 512}
|
||||
]
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
"eeprom": [
|
||||
{ "path": "/sys/bus/i2c/devices/0-0050/eeprom", "valid_bds": [
|
||||
{"name": "board", "start": 0, "size": 1024},
|
||||
{"name": "platform", "start": 512, "size": 512},
|
||||
{"name": "platform", "start": 1024, "size": 512},
|
||||
{"name": "settings", "start": 1536, "size": 512}
|
||||
]
|
||||
}
|
||||
|
|
|
|||
|
|
@ -155,10 +155,10 @@ class _BdRaw:
|
|||
j = 0
|
||||
self.tlvs = []
|
||||
while i < self.buffer_len + 8:
|
||||
# Zero means end of bd
|
||||
# Zero or 0xffff means end of bd
|
||||
tag = self._get_hw(data[i:i + 2])
|
||||
i += 2
|
||||
if tag == 0:
|
||||
if tag == 0 or tag == 0xffff:
|
||||
i -= 2
|
||||
break
|
||||
length = self._get_hw(data[i:i + 2])
|
||||
|
|
@ -175,7 +175,7 @@ class _BdRaw:
|
|||
|
||||
data_length = self._read_binary(data)
|
||||
|
||||
if self.checksum != 0:
|
||||
if self.checksum != 0 and self.checksum != 0xffff:
|
||||
self._verify_checksum(data[8:data_length], self.checksum)
|
||||
else:
|
||||
self.is_writable = True
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ LIC_FILES_CHKSUM = "file://COPYING;md5=d7810fab7487fb0aad327b76f1be7cd7"
|
|||
BRANCH_NAME = "${@'${MACHINE}'.split('-')[-1]}"
|
||||
SRC_URI = "git://git.netmodule.intranet/yoctoproject/linux-netmodule.git;protocol=ssh;user=gitea;branch=4.14/standard/${BRANCH_NAME}"
|
||||
SRCREV ?= "${AUTOREV}"
|
||||
PV ?= "4.14.77-${SRCPV}"
|
||||
PV ?= "4.14.y-${SRCPV}"
|
||||
|
||||
PR = "r0"
|
||||
|
||||
|
|
@ -43,6 +43,24 @@ do_install_append(){
|
|||
cp Module.symvers ${STAGING_KERNEL_BUILDDIR}/
|
||||
}
|
||||
|
||||
# NRHW18
|
||||
|
||||
do_install_append_armada-385-nrhw18() {
|
||||
ln -s devicetree-${DTB_SYMLINK_NAME}.dtb ${D}/${KERNEL_IMAGEDEST}/armada-385-nbhw18-prod4.dtb
|
||||
}
|
||||
|
||||
# MEK
|
||||
|
||||
do_configure_prepend_imx8-mek() {
|
||||
install -d ${B}
|
||||
mkdir -p ${B}
|
||||
cp ${S}/arch/arm64/configs/defconfig ${B}/.config
|
||||
echo "CONFIG_BLK_DEV_RAM=y" >> ${B}/.config
|
||||
echo "CONFIG_BLK_DEV_RAM_COUNT=1" >> ${B}/.config
|
||||
echo "CONFIG_BLK_DEV_RAM_SIZE=131072" >> ${B}/.config
|
||||
echo "CONFIG_BLK_DEV_RAM_BLOCKSIZE=1024" >> ${B}/.config
|
||||
echo "CONFIG_INITRAMFS_COMPRESSION_GZIP=y" >> ${B}/.config
|
||||
}
|
||||
EXTRA_OEMAKE_append_imx8-mek = " ARCH=arm64"
|
||||
KERNEL_EXTRA_ARGS_append_imx8-mek += "LOADADDR=${UBOOT_ENTRYPOINT}"
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,17 @@
|
|||
require recipes-support/libgpiod/libgpiod.inc
|
||||
|
||||
DEPENDS += "autoconf-archive-native"
|
||||
|
||||
SRC_URI[md5sum] = "34a9972f2f4e9c32fa940301301b007d"
|
||||
SRC_URI[sha256sum] = "b6b9079c933f7c8524815437937dda6b795a16141bca202a9eec70ba5844b5ba"
|
||||
|
||||
PACKAGECONFIG[cxx] = "--enable-bindings-cxx,--disable-bindings-cxx"
|
||||
|
||||
PACKAGECONFIG[python3] = "--enable-bindings-python,--disable-bindings-python,python3,python3-core"
|
||||
inherit ${@bb.utils.contains('PACKAGECONFIG', 'python3', 'python3native', '', d)}
|
||||
|
||||
PACKAGES =+ "${PN}-python"
|
||||
FILES_${PN}-python = "${PYTHON_SITEPACKAGES_DIR}"
|
||||
RRECOMMENDS_PYTHON = "${@bb.utils.contains('PACKAGECONFIG', 'python3', '${PN}-python', '',d)}"
|
||||
RRECOMMENDS_${PN} += "${RRECOMMENDS_PYTHON}"
|
||||
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
# short-description: Create OTA-enabled SD card image
|
||||
# long-description: Creates a partitioned SD card image with OSTree
|
||||
|
||||
part u-boot --source rawcopy --sourceparams="file=flash.bin" --ondisk mmcblk --no-table --align 32
|
||||
part / --source otaimage --ondisk mmcblk --fstype=ext4 --align 4096
|
||||
Loading…
Reference in New Issue