Skip to content

Commit 733c2f0

Browse files
authored
Merge pull request rancher#2595 from Jason-ZW/add-4glte-support
Add 4glte support
2 parents 6dd6b27 + ef792df commit 733c2f0

32 files changed

+1432
-46
lines changed

Makefile

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,11 @@ hyperv: .dapper
6060
APPEND_SYSTEM_IMAGES="rancher/os-hypervvmtools:v4.14.85-rancher-1" \
6161
./.dapper release-hyperv 2>&1 | tee dist/release.log
6262

63+
4glte: .dapper
64+
mkdir -p dist
65+
APPEND_SYSTEM_IMAGES="rancher/os-modemmanager:v1.6.4-1" \
66+
./.dapper release-4glte 2>&1 | tee dist/release.log
67+
6368
help:
6469
@./scripts/help
6570

cmd/control/udevsettle.go

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,61 @@
11
package control
22

33
import (
4+
"io/ioutil"
45
"os"
56
"os/exec"
7+
"path/filepath"
68

9+
"github.com/rancher/os/config"
710
"github.com/rancher/os/pkg/log"
811

912
"github.com/codegangsta/cli"
1013
)
1114

1215
func udevSettleAction(c *cli.Context) {
16+
if err := extraRules(); err != nil {
17+
log.Error(err)
18+
}
19+
1320
if err := UdevSettle(); err != nil {
1421
log.Fatal(err)
1522
}
1623
}
1724

25+
func extraRules() error {
26+
cfg := config.LoadConfig()
27+
if len(cfg.Rancher.Network.ModemNetworks) > 0 {
28+
rules, err := ioutil.ReadDir(config.UdevRulesExtrasDir)
29+
if err != nil {
30+
return err
31+
}
32+
for _, r := range rules {
33+
if r.IsDir() || filepath.Ext(r.Name()) != ".rules" {
34+
continue
35+
}
36+
err := os.Symlink(filepath.Join(config.UdevRulesExtrasDir, r.Name()), filepath.Join(config.UdevRulesDir, r.Name()))
37+
if err != nil {
38+
return err
39+
}
40+
}
41+
} else {
42+
rules, err := ioutil.ReadDir(config.UdevRulesDir)
43+
if err != nil {
44+
return err
45+
}
46+
for _, r := range rules {
47+
if r.IsDir() || (filepath.Ext(r.Name()) != ".rules") || (r.Mode()&os.ModeSymlink != 0) {
48+
continue
49+
}
50+
err := os.Remove(filepath.Join(config.UdevRulesDir, r.Name()))
51+
if err != nil {
52+
return err
53+
}
54+
}
55+
}
56+
return nil
57+
}
58+
1859
func UdevSettle() error {
1960
cmd := exec.Command("udevd", "--daemon")
2061
defer exec.Command("killall", "udevd").Run()

cmd/init/init.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,6 @@ func RunInit() error {
5858
{"mount OEM2", fsmount.MountOem},
5959
{"mount BOOT", fsmount.MountBoot},
6060
{"write cfg and log files", configfiles.WriteConfigFiles},
61-
{"hypervisor Env", hypervisor.Env},
6261
{"b2d Env", b2d.Env},
6362
{"hypervisor tools", hypervisor.Tools},
6463
{"preparefs2", prepare.FS},

config/schema.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,8 @@ var schema = `{
8888
"http_proxy": {"type": "string"},
8989
"https_proxy": {"type": "string"},
9090
"no_proxy": {"type": "string"},
91-
"wifi_networks": {"type": "object"}
91+
"wifi_networks": {"type": "object"},
92+
"modem_networks": {"type": "object"}
9293
}
9394
},
9495

config/types.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,8 @@ const (
5353
DHCPCDTemplateFile = "/etc/dhcpcd.conf.tpl"
5454
MultiDockerConfFile = "/var/lib/rancher/conf.d/m-user-docker.yml"
5555
MultiDockerDataDir = "/var/lib/m-user-docker"
56+
UdevRulesDir = "/etc/udev/rules.d"
57+
UdevRulesExtrasDir = "/lib/udev/rules-extras.d"
5658
)
5759

5860
var (
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# stub for immediately telling the kernel that userspace firmware loading
2+
# failed; necessary to avoid long timeouts with CONFIG_FW_LOADER_USER_HELPER=y
3+
SUBSYSTEM=="firmware", ACTION=="add", ATTR{loading}="-1"
Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
# This file is part of systemd.
2+
#
3+
# systemd is free software; you can redistribute it and/or modify it
4+
# under the terms of the GNU Lesser General Public License as published by
5+
# the Free Software Foundation; either version 2.1 of the License, or
6+
# (at your option) any later version.
7+
8+
ACTION=="remove", GOTO="uaccess_end"
9+
ENV{MAJOR}=="", GOTO="uaccess_end"
10+
11+
# PTP/MTP protocol devices, cameras, portable media players
12+
SUBSYSTEM=="usb", ENV{ID_USB_INTERFACES}=="*:060101:*", TAG+="uaccess"
13+
14+
# Digicams with proprietary protocol
15+
ENV{ID_GPHOTO2}=="?*", TAG+="uaccess"
16+
17+
# SCSI and USB scanners
18+
ENV{libsane_matched}=="yes", TAG+="uaccess"
19+
20+
# HPLIP devices (necessary for ink level check and HP tool maintenance)
21+
ENV{ID_HPLIP}=="1", TAG+="uaccess"
22+
23+
# optical drives
24+
SUBSYSTEM=="block", ENV{ID_CDROM}=="1", TAG+="uaccess"
25+
SUBSYSTEM=="scsi_generic", SUBSYSTEMS=="scsi", ATTRS{type}=="4|5", TAG+="uaccess"
26+
27+
# Sound devices
28+
SUBSYSTEM=="sound", TAG+="uaccess" \
29+
OPTIONS+="static_node=snd/timer", OPTIONS+="static_node=snd/seq"
30+
31+
# ffado is an userspace driver for firewire sound cards
32+
SUBSYSTEM=="firewire", ENV{ID_FFADO}=="1", TAG+="uaccess"
33+
34+
# Webcams, frame grabber, TV cards
35+
SUBSYSTEM=="video4linux", TAG+="uaccess"
36+
SUBSYSTEM=="dvb", TAG+="uaccess"
37+
38+
# IIDC devices: industrial cameras and some webcams
39+
SUBSYSTEM=="firewire", ATTR{units}=="*0x00a02d:0x00010*", TAG+="uaccess"
40+
SUBSYSTEM=="firewire", ATTR{units}=="*0x00b09d:0x00010*", TAG+="uaccess"
41+
# AV/C devices: camcorders, set-top boxes, TV sets, audio devices, and more
42+
SUBSYSTEM=="firewire", ATTR{units}=="*0x00a02d:0x010001*", TAG+="uaccess"
43+
SUBSYSTEM=="firewire", ATTR{units}=="*0x00a02d:0x014001*", TAG+="uaccess"
44+
45+
# DRI video devices
46+
SUBSYSTEM=="drm", KERNEL=="card*|renderD*", TAG+="uaccess"
47+
48+
# KVM
49+
SUBSYSTEM=="misc", KERNEL=="kvm", TAG+="uaccess"
50+
51+
# smart-card readers
52+
ENV{ID_SMARTCARD_READER}=="?*", TAG+="uaccess"
53+
54+
# (USB) authentication devices
55+
ENV{ID_SECURITY_TOKEN}=="?*", TAG+="uaccess"
56+
57+
# PDA devices
58+
ENV{ID_PDA}=="?*", TAG+="uaccess"
59+
60+
# Programmable remote control
61+
ENV{ID_REMOTE_CONTROL}=="1", TAG+="uaccess"
62+
63+
# joysticks
64+
SUBSYSTEM=="input", ENV{ID_INPUT_JOYSTICK}=="?*", TAG+="uaccess"
65+
66+
# color measurement devices
67+
ENV{COLOR_MEASUREMENT_DEVICE}=="?*", TAG+="uaccess"
68+
69+
# DDC/CI device, usually high-end monitors such as the DreamColor
70+
ENV{DDC_DEVICE}=="?*", TAG+="uaccess"
71+
72+
# media player raw devices (for user-mode drivers, Android SDK, etc.)
73+
SUBSYSTEM=="usb", ENV{ID_MEDIA_PLAYER}=="?*", TAG+="uaccess"
74+
75+
# software-defined radio communication devices
76+
ENV{ID_SOFTWARE_RADIO}=="?*", TAG+="uaccess"
77+
78+
LABEL="uaccess_end"
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# On Dell PowerEdge systems, the iDRAC7 and later support a USB Virtual NIC
2+
# which terminates in the iDRAC. Help identify this with 'idrac'
3+
ACTION=="add", SUBSYSTEM=="net", SUBSYSTEMS=="usb", ATTRS{idVendor}=="413c", ATTRS{idProduct}=="a102", NAME="idrac"
4+
5+
# ibmveth devices' $DEVPATH number is tied to (virtual) hardware (slot id
6+
# selected in the HMC), thus this provides a reliable naming (e. g.
7+
# "/devices/vio/30000002/net/eth1"); we ignore the bus number, as
8+
# there should only ever be one bus, and then remove leading zeros
9+
ACTION=="add", SUBSYSTEM=="net", NAME=="", DRIVERS=="ibmveth", PROGRAM="/bin/sh -ec 'D=${DEVPATH#*/vio/}; D=${D%%%%/*}; D=${D#????}; D=${D#0}; D=${D#0}; D=${D#0}; D=${D#0}; echo ${D:-0}'", NAME="ibmveth$result"
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# Use MAC based names for network interfaces which are directly or indirectly
2+
# on USB and have an universally administered (stable) MAC address (second bit
3+
# is 0). Don't do this when ifnames is disabled via kernel command line or
4+
# customizing/disabling 80-net-setup-link.rules.
5+
6+
IMPORT{cmdline}="net.ifnames"
7+
ENV{net.ifnames}=="0", GOTO="usb_net_by_mac_end"
8+
9+
ACTION=="add", SUBSYSTEM=="net", SUBSYSTEMS=="usb", NAME=="", \
10+
ATTR{address}=="?[014589cd]:*", \
11+
TEST!="/etc/udev/rules.d/80-net-setup-link.rules", \
12+
IMPORT{builtin}="net_id", NAME="$env{ID_NET_NAME_MAC}"
13+
14+
LABEL="usb_net_by_mac_end"
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# do not edit this file, it will be overwritten on update
2+
3+
ACTION!="add|change|move", GOTO="mm_cinterion_port_types_end"
4+
SUBSYSTEM!="tty", GOTO="mm_cinterion_port_types_end"
5+
ENV{ID_VENDOR_ID}!="1e2d", GOTO="mm_cinterion_port_types_end"
6+
7+
SUBSYSTEMS=="usb", ATTRS{bInterfaceNumber}=="?*", ENV{.MM_USBIFNUM}="$attr{bInterfaceNumber}"
8+
9+
ATTRS{idVendor}=="1e2d", ATTRS{idProduct}=="0053", ENV{.MM_USBIFNUM}=="01", ENV{ID_MM_CINTERION_PORT_TYPE_GPS}="1"
10+
11+
LABEL="mm_cinterion_port_types_end"

0 commit comments

Comments
 (0)