通常所謂
嵌入式系統
嵌入式系統(Embedded System),是一種嵌入機械或電氣系統內部、具有專一功能和實時計算效能的電腦系統。[1][2]嵌入式系統常被用於高效控制許多常見裝置,被嵌入的系統通常是包含數位硬體和機械部件的完整裝置,例如汽車的防鎖死煞車系統。相反,通用電腦如個人電腦則設計靈活,可以智慧型處理各式各樣的運算情況 ,以滿足廣大終端用戶不同的需要。
現代嵌入式系統通常是基於微控制器(如含整合記憶體和/或外設埠的中央處理單元)的,但在較複雜的系統中普通微處理器(使用外部儲存晶片和外設埠電路)也很常見。通用型處理器、專門進行某類計算的處理器、為手持應用訂製設計的處理器等,都可能應用到嵌入式系統。常見的專用處理器有數位訊號處理器。
嵌入式系統的關鍵特性是處理特定的任務,因此工程師能對其進行最佳化,以降低產品的體積和成本,提升可靠性和效能。
嵌入式系統的物理形態包括便攜裝置如計步器、電子手錶和MP3播放器,大型固定裝置如交通燈、工廠控制器,大型複雜系統如混合動力汽車、磁共振成像裝置、航空電子裝置等。它們的複雜度低至單晶片,高至大型底盤或外殼內安裝有多個部件、外設和網路。
Soekris net4801,適用於網路應用程式
軟件功能固定,不能隨意添加硬體。
OpenWrt 則不同也!
Opkg Package Manager
Like most Linux distributions (or mobile device operating systems like say Android or iOS), the functionality of the system can be upgraded rather significantly by downloading and installing pre-made packages from package repositories (local or on the Internet).
The opkg
utility is the lightweight package manager used for this job. Opkg is a fork of ipkg
, the package manager used in NSLU2’s Optware, which is designed to add software to stock firmware of embedded devices.
Opkg is a full package manager for the root file system, including kernel modules and drivers, while ipkg of just a way to add software to a seperate directory (e.g. /opt
).
Opkg is sometimes called Entware, as it is used also in the Entware repository for embedded devices (a fork of OpenWRT community packages repository).
The package manager opkg
attempts to resolve dependencies with packages in the repositories – if this fails, it will report an error and abort the installation of that package.
Missing dependencies with third-party packages are probably available from the source of the package.
To ignore dependency errors, pass the --force-depends
flag.
If you are using a snapshot / trunk / bleeding edge version, installing packages may fail if the package in the repository is for a newer kernel version than the kernel version you have.
In this case, you will get the error message “Cannot satisfy the following dependencies for…”.
For such usage of LEDE firmware, it’s warmly recommended to use the Image Builder to make a flashable image containing all packages you need.
When on trunk/snapshot, kernel and kmod packages are flagged as hold, the opkg upgrade
command won’t attempt to update them.
不過有時挺費工的哩?
比方說,作者想用已有的
RPI USB 802.11b/g/n 150m Wireles
WiFi 小 dongle ,實現無限連接網際網路,滿心以為『隨插即用』,結果竟然『不認識』呦!?
[75150.911561] usb 1-1.2: new high-speed USB device number 5 using dwc_otg [75151.039013] usb 1-1.2: New USB device found, idVendor=148f, idProduct=5370 [75151.048703] usb 1-1.2: New USB device strings: Mfr=1, Product=2, SerialNumber=3 [75151.058031] usb 1-1.2: Product: 802.11 n WLAN [75151.067496] usb 1-1.2: Manufacturer: Ralink [75151.076982] usb 1-1.2: SerialNumber: 1.0
只好鼻子摸著,探它一番︰
root@LEDE:~# opkg list | grep Ralink kmod-rt2500-usb - 4.4.153+2017-01-31-14 - Ralink Drivers for RT2x00 cards (RT2500 USB) kmod-rt2800-lib - 4.4.153+2017-01-31-14 - Ralink Drivers for RT2x00 cards (rt2800 LIB) kmod-rt2800-usb - 4.4.153+2017-01-31-14 - Ralink Drivers for RT2x00 cards (RT2870 USB) kmod-rt2x00-lib - 4.4.153+2017-01-31-14 - Ralink Drivers for RT2x00 cards (LIB) kmod-rt2x00-usb - 4.4.153+2017-01-31-14 - Ralink Drivers for RT2x00 cards (USB) kmod-rt73-usb - 4.4.153+2017-01-31-14 - Ralink Drivers for RT2x00 cards (RT73 USB) rt2800-pci-firmware - 2016-09-21-42ad5367-1 - Ralink RT28xx/3xxx PCI/SoC firmware rt2800-usb-firmware - 2016-09-21-42ad5367-1 - Ralink RT28xx/3xxx USB firmware rt61-pci-firmware - 2016-09-21-42ad5367-1 - Ralink RT2561 firmware rt73-usb-firmware - 2016-09-21-42ad5367-1 - Ralink RT2573 firmware
先把貌似者都給裝了?!
opkg update
opkg install kmod-rt2800-lib kmod-rt2800-usb kmod-rt2x00-lib kmod-rt2x00-usb
※ 註︰其實從樹莓派 3B 上知道的
[ 6622.081908] usb 1-1.2: new high-speed USB device number 6 using dwc_otg [ 6622.229405] usb 1-1.2: New USB device found, idVendor=148f, idProduct=5370 [ 6622.229422] usb 1-1.2: New USB device strings: Mfr=1, Product=2, SerialNumber=3 [ 6622.229430] usb 1-1.2: Product: 802.11 n WLAN [ 6622.229439] usb 1-1.2: Manufacturer: Ralink [ 6622.229447] usb 1-1.2: SerialNumber: 1.0 [ 6622.481916] usb 1-1.2: reset high-speed USB device number 6 using dwc_otg [ 6622.622595] ieee80211 phy1: rt2x00_set_rt: Info - RT chipset 5390, rev 0502 detected [ 6622.646310] ieee80211 phy1: rt2x00_set_rf: Info - RF chipset 5370 detected [ 6622.668724] ieee80211 phy1: Selected rate control algorithm 'minstrel_ht' [ 6622.674984] usbcore: registered new interface driver rt2800usb [ 6622.881228] ieee80211 phy1: rt2x00lib_request_firmware: Info - Loading firmware file 'rt2870.bin' [ 6622.889698] ieee80211 phy1: rt2x00lib_request_firmware: Info - Firmware detected - version: 0.36 [ 6623.171345] IPv6: ADDRCONF(NETDEV_UP): wlan1: link is not ready
果然『註冊』矣☺
[75355.772305] usb 1-1.2: reset high-speed USB device number 5 using dwc_otg [75355.892963] ieee80211 phy1: rt2x00_set_rt: Info - RT chipset 5390, rev 0502 detected [75355.924273] ieee80211 phy1: rt2x00_set_rf: Info - RF chipset 5370 detected [75355.934478] ieee80211 phy1: Selected rate control algorithm 'minstrel_ht' [75355.947328] usbcore: registered new interface driver rt2800usb
還不知能不能用呀☻
root@LEDE:~# iwconfig wlan0 IEEE 802.11 Mode:Master Tx-Power=31 dBm RTS thr:off Fragment thr:off Power Management:on br-wan no wireless extensions. lo no wireless extensions. eth0 no wireless extensions. wlan1 IEEE 802.11 ESSID:off/any Mode:Managed Access Point: Not-Associated Tx-Power=0 dBm RTS thr:off Fragment thr:off Encryption key:off Power Management:off br-lan no wireless extensions.
且先『觀察』一下︰
root@LEDE:~# iw list Wiphy phy1 max # scan SSIDs: 4 max scan IEs length: 2257 bytes max # sched scan SSIDs: 0 max # match sets: 0 max # scan plans: 1 max scan plan interval: -1 max scan plan iterations: 0 Retry short long limit: 2 Coverage class: 0 (up to 0m) Available Antennas: TX 0 RX 0 Supported interface modes: * IBSS * managed * AP * AP/VLAN * monitor * mesh point Band 1: Capabilities: 0x17e HT20/HT40 SM Power Save disabled RX Greenfield RX HT20 SGI RX HT40 SGI RX STBC 1-stream Max AMSDU length: 3839 bytes No DSSS/CCK HT40 Maximum RX AMPDU length 32767 bytes (exponent: 0x002) Minimum RX AMPDU time spacing: 2 usec (0x04) HT TX/RX MCS rate indexes supported: 0-7, 32 Frequencies: * 2412 MHz [1] (20.0 dBm) * 2417 MHz [2] (20.0 dBm) * 2422 MHz [3] (20.0 dBm) * 2427 MHz [4] (20.0 dBm) * 2432 MHz [5] (20.0 dBm) * 2437 MHz [6] (20.0 dBm) * 2442 MHz [7] (20.0 dBm) * 2447 MHz [8] (20.0 dBm) * 2452 MHz [9] (20.0 dBm) * 2457 MHz [10] (20.0 dBm) * 2462 MHz [11] (20.0 dBm) * 2467 MHz [12] (20.0 dBm) (no IR) * 2472 MHz [13] (20.0 dBm) (no IR) * 2484 MHz [14] (20.0 dBm) (no IR) valid interface combinations: * #{ managed, AP, mesh point } <= 8, total <= 8, #channels <= 1 HT Capability overrides: * MCS: ff ff ff ff ff ff ff ff ff ff * maximum A-MSDU length * supported channel width * short GI for 40 MHz * max A-MPDU length exponent * min MPDU start spacing
次『啟動』一下︰
root@LEDE:~# ifconfig wlan1 up root@LEDE:~# ifconfig br-lan Link encap:Ethernet HWaddr B8:27:EB:97:E5:3B inet addr:5.168.166.88 Bcast:5.168.166.255 Mask:255.255.255.0 inet6 addr: fe80::ba27:ebff:fe97:e53b/64 Scope:Link inet6 addr: fd42:80c5:b618::1/60 Scope:Global UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:69223 errors:0 dropped:0 overruns:0 frame:0 TX packets:69073 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:5622957 (5.3 MiB) TX bytes:6574254 (6.2 MiB) br-wan Link encap:Ethernet HWaddr B8:27:EB:C2:B0:6E inet addr:5.168.168.9 Bcast:5.168.168.255 Mask:255.255.255.0 inet6 addr: fe80::ba27:ebff:fec2:b06e/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:228657 errors:0 dropped:37876 overruns:0 frame:0 TX packets:185797 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:22025947 (21.0 MiB) TX bytes:54930799 (52.3 MiB) eth0 Link encap:Ethernet HWaddr B8:27:EB:C2:B0:6E UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:228670 errors:0 dropped:0 overruns:0 frame:0 TX packets:185797 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:22027433 (21.0 MiB) TX bytes:57158111 (54.5 MiB) lo Link encap:Local Loopback inet addr:127.0.0.1 Mask:255.0.0.0 inet6 addr: ::1/128 Scope:Host UP LOOPBACK RUNNING MTU:65536 Metric:1 RX packets:149 errors:0 dropped:0 overruns:0 frame:0 TX packets:149 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1 RX bytes:14907 (14.5 KiB) TX bytes:14907 (14.5 KiB) wlan0 Link encap:Ethernet HWaddr B8:27:EB:97:E5:3B inet6 addr: fe80::ba27:ebff:fe97:e53b/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:69223 errors:0 dropped:0 overruns:0 frame:0 TX packets:69469 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:5622957 (5.3 MiB) TX bytes:8306082 (7.9 MiB) wlan1 Link encap:Ethernet HWaddr E8:4E:06:4F:C5:5C UP BROADCAST MULTICAST MTU:1500 Metric:1 RX packets:0 errors:0 dropped:0 overruns:0 frame:0 TX packets:0 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:0 (0.0 B) TX bytes:0 (0.0 B) [75756.682037] ieee80211 phy1: rt2x00lib_request_firmware: Info - Loading firmware file 'rt2870.bin' [75756.690741] ieee80211 phy1: rt2x00lib_request_firmware: Info - Firmware detected - version: 0.36 [75756.951009] IPv6: ADDRCONF(NETDEV_UP): wlan1: link is not ready
再以
iw wlan1 scan
『測試』 OK 告終◎
可放煙火啦☆
cat /etc/config/wireless
config wifi-device ‘radio0’
option type ‘mac80211’
option channel ’11’
option hwmode ’11g’
option path ‘platform/soc/3f300000.mmc/mmc_host/mmc1/mmc1:0001/mmc1:0001:1’
option htmode ‘HT20’
option disabled ‘0’
config wifi-iface ‘default_radio0’
option device ‘radio0’
option network ‘lan’
option mode ‘ap’
option ssid ‘LEDE-RPI-3B’
option encryption ‘psk2+ccmp’
option key ‘12345678’
option wds ‘1’
config wifi-device ‘radio1’
option type ‘mac80211’
option hwmode ’11g’
option path ‘platform/soc/3f980000.usb/usb1/1-1/1-1.2/1-1.2:1.0’
option htmode ‘HT20’
option channel ‘1’
option country ‘TW’
config wifi-iface
option network ‘wwan’
option ssid ‘WiFi-2.4’
option encryption ‘psk2’
option device ‘radio1’
option mode ‘sta’
option bssid ‘4C:E6:76:C4:E3:EA’
option key ‘XXXXXXXXX’