新唐ARM9 NU980 移植OpenWrt LEDE


2020-5-18 01:05:56 NUC980-OpenWrt LEDE源码 Git 地址-可以fork后开发

时间2019年07月2日20.10

内容初步准备

Openwrt 源码下载 feeds 更新 内核移植
openwrt 下载最好是安装 git 使用 git clone 比较方便
首先你需要有一个可以运行linux 系统的主机 系统可以使用虚拟
打开终端,安装好开发环境git gcc make autoconfig 等工具

  • git clone https://github.com/openwrt/openwrt.git
  • ./scripts/feeds update -a
  • ./scripts/feeds install -a

接下来添加 target 复制 AT91或者其他的BOARD 重命名为Nuvoton

内核修改需要在 include 的kernel-version.mk里增加 SHA256数值,并且需要自己先下载内核再计算指定 LINUX_VERSION和LINUX_KERNEL_HASH
这两个变量,这样才会 自动下载内核

内核的patch

参考这篇博文 使用 diff 生成 patch ,解压官方的内核 和BSP内核,
a为官方,b为修改后
https://blog.csdn.net/wind0419/article/details/8299673
diff -ruN a/ b/ > patch
再使用vim工具
删除包含diff -ruN的所有行
:g/diff -ruN/d
,由于没有发现如何隐藏命令 所以使用VIM删除

时间2020-3-5 20:51:48

NUC980移植openwrt简便方法

make menuconfig 后
使用官方4.4.201 最新内核
手动设置内核,设置OK后编译时,openwrt 会建立一个软连接指向 BSP linux 目录

在这里插入图片描述在这里插入图片描述需要在内核目录上级建立个一个文件夹 名称为image
否则内核编译过程会出错,因为make 脚本里会吧image拷贝到这个目录

2020-3-10 23:11:52 使用LEDE 内核版本4.4.194

比较官方内核生成patch 移植成功,可以网页更新UBIFS
启动log 不支持更新内核

Boot from SPI-NAND
DDR-OK
4-bit
finish SPI dowd

 SPL load main U-Boot from SPI NAND Flash! (Feb 20 2019 09:12:29)


U-Boot 2016.11-g8127c47 (Feb 20 2019 - 09:12:26 +0800)

CPU: NUC980
Board: NUC980
DRAM:  64 MiB
SF: Detected W25N01GV with page size 2 KiB, erase size 128 KiB, total 128 MiB
In:    serial
Out:   serial
Err:   serial
Net:   Net Initialization Skipped
No ethernet found.
Hit any key to stop autoboot:  0 
SF: Detected W25N01GV with page size 2 KiB, erase size 128 KiB, total 128 MiB
device 0 offset 0x200000, size 0x800000
SF: 8388608 bytes @ 0x200000 Read: OK
## Booting kernel from Legacy Image at 00007fc0 ...
   Image Name:   
   Image Type:   ARM Linux Kernel Image (uncompressed)
   Data Size:    6073280 Bytes = 5.8 MiB
   Load Address: 00008000
   Entry Point:  00008000
   Verifying Checksum ... OK
   XIP Kernel Image ... OK

Starting kernel ...

SF: Detected W25N01GV with page size 2 KiB, erase size 128 KiB, total 128 MiB
SF: Device[    0.000000] Booting Linux on physical CPU 0x0
[    0.000000] Linux version 4.4.194 (legend@legend) (gcc version 5.4.0 (LEDE GCC 5.4.0 unknown) ) #0 PREEMPT Tue Nov 19 05:51:15 2019
[    0.000000] CPU: ARM926EJ-S [41069265] revision 5 (ARMv5TEJ), cr=0005317f
[    0.000000] CPU: VIVT data cache, VIVT instruction cache
[    0.000000] Machine: NUC980
[    0.000000] Memory policy: Data cache writeback
[    0.000000] Built 1 zonelists in Zone order, mobility grouping on.  Total pages: 16256
[    0.000000] Kernel command line: noinitrd rootfstype=ubifs ubi.mtd=2 root=ubi0:rootfs console=ttyS0,115200n8 mem=64M init=/sbin/init rw
[    0.000000] PID hash table entries: 256 (order: -2, 1024 bytes)
[    0.000000] Dentry cache hash table entries: 8192 (order: 3, 32768 bytes)
[    0.000000] Inode-cache hash table entries: 4096 (order: 2, 16384 bytes)
[    0.000000] Memory: 58732K/65536K available (3966K kernel code, 282K rwdata, 1524K rodata, 156K init, 200K bss, 6804K reserved, 0K cma-reserved)
[    0.000000] Virtual kernel memory layout:
[    0.000000]     vector  : 0xffff0000 - 0xffff1000   (   4 kB)
[    0.000000]     fixmap  : 0xffc00000 - 0xfff00000   (3072 kB)
[    0.000000]     vmalloc : 0xc4800000 - 0xff800000   ( 944 MB)
[    0.000000]     lowmem  : 0xc0000000 - 0xc4000000   (  64 MB)
[    0.000000]     modules : 0xbf000000 - 0xc0000000   (  16 MB)
[    0.000000]       .text : 0xc0008000 - 0xc0564f04   (5492 kB)
[    0.000000]       .init : 0xc0565000 - 0xc058c000   ( 156 kB)
[    0.000000]       .data : 0xc058c000 - 0xc05d2bc0   ( 283 kB)
[    0.000000]        .bss : 0xc05d2bc0 - 0xc0604db4   ( 201 kB)
[    0.000000] SLUB: HWalign=32, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
[    0.000000] Preemptible hierarchical RCU implementation.
[    0.000000]  Build-time adjustment of leaf fanout to 32.
[    0.000000] NR_IRQS:545
[    0.000000] clocksource: nuc980-timer5: mask: 0xffffff max_cycles: 0xffffff, max_idle_ns: 62215505635 ns
[    0.000033] sched_clock: 24 bits at 120kHz, resolution 8333ns, wraps every 69905062489ns
[    0.000733] Console: colour dummy device 80x30
[    0.185666] console [ttyS0] enabled
[    0.189149] Calibrating delay loop... 148.88 BogoMIPS (lpj=744448)
[    0.262791] pid_max: default: 32768 minimum: 301
[    0.267649] Mount-cache hash table entries: 1024 (order: 0, 4096 bytes)
[    0.274333] Mountpoint-cache hash table entries: 1024 (order: 0, 4096 bytes)
[    0.283474] CPU: Testing write buffer coherency: ok
[    0.289449] Setting up static identity map for 0x8400 - 0x843c
[    0.321208] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 19112604462750000 ns
[    0.332016] futex hash table entries: 256 (order: -1, 3072 bytes)
[    0.338599] pinctrl core: initialized pinctrl subsystem
[    0.346024] NET: Registered protocol family 16
[    0.352858] DMA: preallocated 256 KiB pool for atomic coherent allocations
[    0.506799] SCSI subsystem initialized
[    0.516391] usbcore: registered new interface driver usbfs
[    0.524441] usbcore: registered new interface driver hub
[    0.531258] usbcore: registered new device driver usb
[    0.544266] clocksource: Switched to clocksource nuc980-timer5
[    0.632516] NET: Registered protocol family 2
[    0.640858] TCP established hash table entries: 1024 (order: 0, 4096 bytes)
[    0.648683] TCP bind hash table entries: 1024 (order: 0, 4096 bytes)
[    0.655508] TCP: Hash tables configured (established 1024 bind 1024)
[    0.662083] UDP hash table entries: 256 (order: 0, 4096 bytes)
[    0.668199] UDP-Lite hash table entries: 256 (order: 0, 4096 bytes)
[    0.675391] NET: Registered protocol family 1
[    0.680591] NetWinder Floating Point Emulator V0.97 (double precision)
[    0.693549] Crashlog allocated RAM at address 0x3f00000
[    0.775641] squashfs: version 4.0 (2009/01/31) Phillip Lougher
[    0.785049] jffs2: version 2.2 (NAND) (SUMMARY) (LZMA) (RTIME) (CMODE_PRIORITY) (c) 2001-2006 Red Hat, Inc.
[    0.869733] io scheduler noop registered (default)
[    0.875433] nuc980_gpio_probe - pdev = nuc980-gpio
[    0.884683] nuc980_dma_probe - pdev = nuc980-dma
[    0.910333] nuc980-dma nuc980-dma: NUC980 DMA ready
[    1.456849] nuc980-uart.0: ttyS0 at I/O 0x0 (irq = 36, base_baud = 750000) is a NUC980
[    1.467966] nuc980-uart.1: ttyS1 at I/O 0x0 (irq = 37, base_baud = 9375000) is a NUC980
[    1.478916] nuc980-uart.2: ttyS2 at I/O 0x0 (irq = 38, base_baud = 9375000) is a NUC980
[    1.565541] brd: module loaded
[    1.577591] RX nuc980_qspi0_probe: dma0chan0 module removed
[    1.583224] TX nuc980_qspi0_probe: dma0chan1 module removed
[    1.608991] libphy: nuc980_rmii0: probed
[    1.683433] libphy: nuc980_rmii1: probed
[    1.693058] PPP generic driver version 2.4.2
[    1.700133] ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
[    1.708549] nuc980-ehci nuc980-ehci: Nuvoton NUC980 EHCI Host Controller
[    1.715841] nuc980-ehci nuc980-ehci: new USB bus registered, assigned bus number 1
[    1.724016] nuc980-ehci nuc980-ehci: irq 23, io mem 0xb0015000
[    1.744474] nuc980-ehci nuc980-ehci: USB 2.0 started, EHCI 0.95
[    1.754058] hub 1-0:1.0: USB hub found
[    1.758691] hub 1-0:1.0: 2 ports detected
[    1.764983] ehci-platform: EHCI generic platform driver
[    1.771416] ohci_hcd: USB 1.1 'Open' Host Controller (OHCI) Driver
[    1.778608] usb_hcd_nuc980_probe, id = 0, name: nuc980-ohci.0, 0
[    1.785249] nuc980-ohci nuc980-ohci.0: Nuvoton NUC980 OHCI Host Controller
[    1.792216] nuc980-ohci nuc980-ohci.0: new USB bus registered, assigned bus number 2
[    1.800316] nuc980-ohci nuc980-ohci.0: irq 24, io mem 0xb0017000
[    1.870024] hub 2-0:1.0: USB hub found
[    1.874774] hub 2-0:1.0: 8 ports detected
[    1.881983] usb_hcd_nuc980_probe, id = 1, name: nuc980-ohci.1, 0
[    1.888791] usb_hcd_nuc980_probe, id = 2, name: nuc980-ohci.2, 0
[    1.895641] usb_hcd_nuc980_probe, id = 3, name: nuc980-ohci.3, 0
[    1.902158] usb_hcd_nuc980_probe, id = 4, name: nuc980-ohci.4, 0
[    1.909224] usb_hcd_nuc980_probe, id = 5, name: nuc980-ohci.5, 0
[    1.916283] usb_hcd_nuc980_probe, id = 6, name: nuc980-ohci.6, 0
[    1.922891] ohci-platform: OHCI generic platform driver
[    1.930449] usbcore: registered new interface driver usb-storage
[    1.938674] usbcore: registered new interface driver usbserial
[    1.945983] usbcore: registered new interface driver option
[    1.952699] usbserial: USB Serial support registered for GSM modem (1-port)
[    1.967174] do_sha - sha last has no data!
[    1.971258] alg: hash: Test 1 failed for nuc980-sha1
[    1.977574] 00000000: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
[    1.983974] 00000010: 00 00 00 00
[    1.988424] do_sha - sha last has no data!
[    1.992499] alg: hash: Test 1 failed for nuc980-sha224
[    1.997891] 00000000: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
[    2.004524] 00000010: 00 00 00 00 00 00 00 00 00 00 00 00
[    2.010608] do_sha - sha last has no data!
[    2.014974] alg: hash: Test 1 failed for nuc980-sha256
[    2.020083] 00000000: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
[    2.026716] 00000010: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
[    2.033841] do_sha - sha last has no data!
[    2.038224] alg: hash: Test 1 failed for nuc980-sha384
[    2.043333] 00000000: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
[    2.049958] 00000010: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
[    2.056616] 00000020: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
[    2.063733] do_sha - sha last has no data!
[    2.068074] alg: hash: Test 1 failed for nuc980-sha512
[    2.073183] 00000000: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
[    2.079816] 00000010: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
[    2.086483] 00000020: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
[    2.092883] 00000030: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
[    2.100149] alg: No test for hmac-sha1 (nuc980-hmac-sha1)
[    2.106383] alg: No test for hmac-sha224 (nuc980-hmac-sha224)
[    2.112724] alg: No test for hmac-sha256 (nuc980-hmac-sha256)
[    2.119299] alg: No test for hmac-sha384 (nuc980-hmac-sha384)
[    2.125908] alg: No test for hmac-sha512 (nuc980-hmac-sha512)
[    2.131708] NUC980 Crypto engine enabled.
[    2.154758] usbcore: registered new interface driver usbhid
[    2.160299] usbhid: USB HID core driver
[    2.176683] nand: device found, Manufacturer ID: 0xef, Chip ID: 0xaa
[    2.182999] nand: Winbond W25N01GV 1G 3.3V
[    2.187591] nand: 128 MiB, SLC, erase size: 128 KiB, page size: 2048, OOB size: 64
[    2.195374] nand: WARNING: spi0.0: the ECC used on your system is too weak compared to the one required by the NAND chip
[    2.206408] Scanning device for bad blocks
[    2.576099] Creating 3 MTD partitions on "nand0":
[    2.580791] 0x000000000000-0x000000200000 : "u-boot"
[    2.591858] 0x000000200000-0x000001600000 : "Kernel"
[    2.602983] 0x000001600000-0x000008000000 : "rootfs"
[    2.616008] mtd: device 2 (rootfs) set to be root filesystem
[    2.623099] mtdsplit: no squashfs found in "rootfs"
[    2.638041] NET: Registered protocol family 10
[    2.648124] NET: Registered protocol family 17
[    2.652849] bridge: automatic filtering via arp/ip/ip6tables has been deprecated. Update your scripts to load br_netfilter if you need this.
[    2.665999] 8021q: 802.1Q VLAN Support v1.8
[    2.670283] lib80211: common routines for IEEE802.11 drivers
[    2.687324] ubi0: attaching mtd2
[    3.957283] ubi0: scanning is finished
[    3.987283] ubi0: attached mtd2 (name "rootfs", size 106 MiB)
[    3.992991] ubi0: PEB size: 131072 bytes (128 KiB), LEB size: 126976 bytes
[    4.000108] ubi0: min./max. I/O unit sizes: 2048/2048, sub-page size 2048
[    4.007066] ubi0: VID header offset: 2048 (aligned 2048), data offset: 4096
[    4.013974] ubi0: good PEBs: 848, bad PEBs: 0, corrupted PEBs: 0
[    4.020374] ubi0: user volume: 1, internal volumes: 1, max. volumes count: 128
[    4.027808] ubi0: max/mean erase counter: 3/1, WL threshold: 4096, image sequence number: 957642553
[    4.037016] ubi0: available PEBs: 0, total reserved PEBs: 848, PEBs reserved for bad PEB handling: 20
[    4.046341] ubi0: background thread "ubi_bgt0d" started, PID 1103
[    4.086008] UBIFS (ubi0:0): background thread "ubifs_bgt0_0" started, PID 1105
[    4.277691] UBIFS (ubi0:0): UBIFS: mounted UBI device 0, volume 0, name "rootfs"
[    4.285216] UBIFS (ubi0:0): LEB size: 126976 bytes (124 KiB), min./max. I/O unit sizes: 2048 bytes/2048 bytes
[    4.295191] UBIFS (ubi0:0): FS size: 103231488 bytes (98 MiB, 813 LEBs), journal size 9023488 bytes (8 MiB, 72 LEBs)
[    4.305749] UBIFS (ubi0:0): reserved for root: 0 bytes (0 KiB)
[    4.311549] UBIFS (ubi0:0): media format: w4/r0 (latest is w4/r0), UUID 17CCEA80-C408-4362-BECF-EF1DC049714E, small LPT model
[    4.325241] VFS: Mounted root (ubifs filesystem) on device 0:12.
[    4.333041] Freeing unused kernel memory: 156K
[    4.854883] init: Console is alive
[    5.482049] kmodloader: loading kernel modules from /etc/modules-boot.d/*
[    5.596933] kmodloader: done loading kernel modules from /etc/modules-boot.d/*
[    5.620358] init: - preinit -
[    6.432324] random: jshn: uninitialized urandom read (4 bytes read, 59 bits of entropy available)
[    6.568058] random: jshn: uninitialized urandom read (4 bytes read, 60 bits of entropy available)
[    6.738008] random: jshn: uninitialized urandom read (4 bytes read, 60 bits of entropy available)
[    6.861383] random: jshn: uninitialized urandom read (4 bytes read, 60 bits of entropy available)
[    7.011583] random: jshn: uninitialized urandom read (4 bytes read, 60 bits of entropy available)
[    7.185324] nuc980-emac0 nuc980-emac0: eth0 is OPENED
[    7.191158] IPv6: ADDRCONF(NETDEV_UP): eth0: link is not ready
Press the [f] key and hit [enter] to enter failsafe mode
Press the [1], [2], [3] or [4] key and hit [enter] to select the debug level
[    8.604849] IPv6: ADDRCONF(NETDEV_CHANGE): eth0: link becomes ready
[   10.694108] mount_root: mounting /dev/root
- config restore -
[   10.913483] urandom-seed: Seed file not found (/etc/urandom.seed)
[   11.051883] procd: - early -
[   14.708499] procd: - ubus -
[   14.869366] random: ubusd: uninitialized urandom read (4 bytes read, 76 bits of entropy available)
[   14.914191] random: ubusd: uninitialized urandom read (4 bytes read, 76 bits of entropy available)
[   14.938116] random: ubusd: uninitialized urandom read (4 bytes read, 76 bits of entropy available)
[   14.953983] random: ubusd: uninitialized urandom read (4 bytes read, 76 bits of entropy available)
[   14.988108] random: ubusd: uninitialized urandom read (4 bytes read, 76 bits of entropy available)
[   15.008816] procd: - init -
Please press Enter to activate this console.
[   16.559324] kmodloader: loading kernel modules from /etc/modules.d/*
[   16.638424] ip6_tables: (C) 2000-2006 Netfilter Core Team
[   16.771191] usbcore: registered new interface driver cdc_acm
[   16.784558] cdc_acm: USB Abstract Control Model driver for USB modems and ISDN adapters
[   16.808574] usbcore: registered new interface driver cdc_wdm
[   16.846399] usbcore: registered new interface driver ch341
[   16.855183] usbserial: USB Serial support registered for ch341-uart
[   16.876924] Loading modules backported from Linux version wt-2017-01-31-0-ge882dff19e7f
[   16.894808] Backport generated by backports.git backports-20160324-13-g24da7d3c
[   16.917066] usbcore: registered new interface driver cp210x
[   16.932608] usbserial: USB Serial support registered for cp210x
[   16.975033] usbcore: registered new interface driver ftdi_sio
[   16.982616] usbserial: USB Serial support registered for FTDI USB Serial Device
[   17.010524] ip_tables: (C) 2000-2006 Netfilter Core Team
[   17.119399] nf_conntrack version 0.5.0 (920 buckets, 3680 max)
[   17.235333] usbcore: registered new interface driver pl2303
[   17.244558] usbserial: USB Serial support registered for pl2303
[   17.265316] NET: Registered protocol family 24
[   17.321291] usbcore: registered new interface driver r8152
[   17.444124] xt_time: kernel timezone is -0000
[   17.466249] usbcore: registered new interface driver cdc_ether
[   18.527216] usbcore: registered new interface driver mt7601u
[   18.601566] usbcore: registered new interface driver qmi_wwan
[   18.631216] usbcore: registered new interface driver rndis_host
[   18.683541] usbcore: registered new interface driver rtl8187
[   18.921691] usbcore: registered new interface driver rtl8192cu
[   18.934949] kmodloader: done loading kernel modules from /etc/modules.d/*
[   31.214466] random: nonblocking pool is initialized



BusyBox v1.25.1 () built-in shell (ash)

     _________
    /        /\      _    ___ ___  ___
   /  LE    /  \    | |  | __|   \| __|
  /    DE  /    \   | |__| _|| |) | _|
 /________/  LE  \  |____|___|___/|___|                      lede-project.org
 \        \   DE /
  \    LE  \    /  -----------------------------------------------------------
   \  DE    \  /    Reboot (17.01-SNAPSHOT, unknown)
    \________\/    -----------------------------------------------------------

root@LEDE:/# [   49.755208] nuc980-emac0 nuc980-emac0: eth0 is OPENED
[   49.774874] device eth0 entered promiscuous mode
[   49.800616] IPv6: ADDRCONF(NETDEV_UP): br-lan: link is not ready
[   49.924591] nuc980-emac1 nuc980-emac1: eth1 is OPENED
[   49.930424] IPv6: ADDRCONF(NETDEV_UP): eth1: link is not ready
[   53.645041] br-lan: port 1(eth0) entered forwarding state
[   53.650566] br-lan: port 1(eth0) entered forwarding state
[   53.713941] IPv6: ADDRCONF(NETDEV_CHANGE): br-lan: link becomes ready
[   55.644433] br-lan: port 1(eth0) entered forwarding state

固件通过 网页升级 log
固件通过 UBIFS 系统升级

root@LEDE:/# killall: telnetd: no process killed
killall: dropbear: no process killed
Sending TERM to remaining processes ... ubusd logd rpcd netifd odhcpd ntpd uhttpd 
Sending KILL to remaining processes ... 
Switching to ramdisk...
[  218.734091] UBIFS (ubi0:0): background thread "ubifs_bgt0_0" stops
[  218.829633] UBIFS (ubi0:0): un-mount UBI device 0
[  219.079649] ubi0: detaching mtd2
[  219.086333] ubi0: mtd2 is detached
ubiformat: mtd2 (nand), size 111149056 bytes (106.0 MiB), 848 eraseblocks of 131072 bytes (128.0 KiB), min. I/O size 2048 bytes
libscan: scanning eraseblock 847 -- 100 % complete  
ubiformat: 848 eraseblocks have valid erase counter, mean value is 0
ubiformat: flashing eraseblock 70 -- 100 % complete  
ubiformat: formatting erase[  233.011833] ubi0: attaching mtd2
ubiformat: formatting eraseblock 847 -- 100 % complete  
[  234.322449] ubi0: scanning is finished
[  234.395299] ubi0: volume 0 ("rootfs") re-sized from 69 to 824 LEBs
[  234.404216] ubi0: attached mtd2 (name "rootfs", size 106 MiB)
[  234.410524] ubi0: PEB size: 131072 bytes (128 KiB), LEB size: 126976 bytes
[  234.417608] ubi0: min./max. I/O unit sizes: 2048/2048, sub-page size 2048
[  234.424358] ubi0: VID header offset: 2048 (aligned 2048), data offset: 4096
[  234.431558] ubi0: good PEBs: 848, bad PEBs: 0, corrupted PEBs: 0
[  234.437791] ubi0: user volume: 1, internal volumes: 1, max. volumes count: 128
[  234.444974] ubi0: max/mean erase counter: 3/1, WL threshold: 4096, image sequence number: 1593348356
[  234.454258] ubi0: available PEBs: 0, total reserved PEBs: 848, PEBs reserved for bad PEB handling: 20
[  234.463666] ubi0: background thread "ubi_bgt0d" started, PID 4855
UBI device number 0, total 848 LEBs (107675648 bytes, 102.7 MiB), available 0 LEBs (0 bytes), LEB size 126976 bytes (124.0 KiB)
[  234.730424] UBIFS (ubi0:0): background thread "ubifs_bgt0_0" started, PID 4875
[  234.831033] UBIFS (ubi0:0): start fixing up free space
[  235.769383] UBIFS (ubi0:0): free space fixup complete
[  235.826691] UBIFS (ubi0:0): UBIFS: mounted UBI device 0, volume 0, name "rootfs"
[  235.834066] UBIFS (ubi0:0): LEB size: 126976 bytes (124 KiB), min./max. I/O unit sizes: 2048 bytes/2048 bytes
[  235.844108] UBIFS (ubi0:0): FS size: 103231488 bytes (98 MiB, 813 LEBs), journal size 9023488 bytes (8 MiB, 72 LEBs)
[  235.854674] UBIFS (ubi0:0): reserved for root: 0 bytes (0 KiB)
[  235.860574] UBIFS (ubi0:0): media format: w4/r0 (latest is w4/r0), UUID 17CCEA80-C408-4362-BECF-EF1DC049714E, small LPT model
[  235.971016] UBIFS (ubi0:0): un-mount UBI device 0
[  235.975966] UBIFS (ubi0:0): background thread "ubifs_bgt0_0" stops
sysupgrade successful
umount: can't unmount /dev: Resource busy
umount: can't unmount /tmp: Resource busy
[  236.192599] reboot: Restarting system

2020-3-14 19:48:45 LEDE-NUC980 release 0.1版本

固件更新内容2020-3-10 02:25:30
1.降低内核版本为4.4.194同步LEDE内核,采用打patch 的方式
2.修正QMI内核模块版本加载问题
3.修复eth0 默认无法DHCP问题
4.增加WEB更新固件
5.增加WIFI支持 USB WIFI RTL8192 RTL818X MT7601U
6.修改文件系统为UBIFS
7.内核配置开启eth1 关闭 pwm,sd
8.4G模块支持EC20 (QMI) ,NDIS(AIR720)
9.修改内核 SPI NAND MTD 分区名称
10.增加USB转串口驱动 CH341 CP210X FTDI USB-ACM

2020-3-14 19:54:15
release 0.1版本更内容
1.使用squash + ubi 文件系统
2.内核开启设备树支持使用cat 命令 合并设备树文件与内核
3.修正 设备树分区名称内核分区 : “kernel” ,ubi分区 “ubi”
4.target/linux/nuvoton/image/Makefile 修改
增加 lede-nuvoton-nuc980-ubi-squashfs-sysupgrade.tar 与
lede-nuvoton-nuc980-ubi-ubifs-sysupgrade.tar,并且测试OK,可以做到完美更新rootfs 与rootfs_date

分区表信息

root@LEDE:~# cat /proc/mtd 
dev:    size   erasesize  name
mtd0: 00200000 00020000 "u-boot"
mtd1: 01400000 00020000 "kernel"
mtd2: 06a00000 00020000 "ubi"
mtd3: 0081d000 0001f000 "rootfs"
mtd4: 05bab000 0001f000 "rootfs_data"
root@LEDE:~# 

5.增加lan口网卡led指示,与系统运行diag.sh 修改
6.增加默认root用户和密码,以及WIFI 默认配置

web升级 使用.tar升级device-tree kernel rootfs rootfs_data log

killall: telnetd: no process killed
killall: dropbear: no process killed
Sending TERM to remaining processes ... ubusd logd rpcd netifd odhcpd watchcat.sh sleep ntpd ztk_service.py dnsmasq 
Sending KILL to remaining processes ... 
Switching to ramdisk...
[  899.248508] UBIFS (ubi0:1): background thread "ubifs_bgt0_1" stops
[  899.378916] UBIFS (ubi0:1): un-mount UBI device 0
Unlocking kernel ...

Writing from <stdin> to kernel ...     
removing ubiblock0_0
[  906.196624] block ubiblock0_0: released
Volume ID 0, size 67 LEBs (8507392 bytes, 8.1 MiB), LEB size 126976 bytes (124.0 KiB), dynamic, name "rootfs", alignment 1
Set volume size to 96120832
Volume ID 1, size 757 LEBs (96120832 bytes, 91.7 MiB), LEB size 126976 bytes (124.0 KiB), dynamic, name "rootfs_data", alignment 1
sysupgrade successful
umount: can't unmount /dev: Resource busy
umount: can't unmount /tmp: Resource busy
UC980 IBR 20180813oot: Restarting system
Boot from SPI-NAND
DDR-OK
4-bit
finish SPI dowd

 SPL load main U-Boot from SPI NAND Flash! (Feb 20 2019 09:12:29)


U-Boot 2016.11-g8127c47 (Feb 20 2019 - 09:12:26 +0800)

CPU: NUC980
Board: NUC980
DRAM:  64 MiB
SF: Detected W25N01GV with page size 2 KiB, erase size 128 KiB, total 128 MiB
In:    serial
Out:   serial
Err:   serial
Net:   Net Initialization Skipped
No ethernet found.
Hit any key to stop autoboot:  0 
SF: Detected W25N01GV with page size 2 KiB, erase size 128 KiB, total 128 MiB
device 0 offset 0x200000, size 0x800000
SF: 8388608 bytes @ 0x200000 Read: OK
## Booting kernel from Legacy Image at 00007fc0 ...
   Image Name:   OpenWrt ARM 4.4.194
   Image Type:   ARM Linux Kernel Image (uncompressed)
   Data Size:    2774236 Bytes = 2.6 MiB
   Load Address: 00008000
   Entry Point:  00008000
   Verifying Checksum ... OK
   XIP Kernel Image ... OK

Starting kernel ...

SF: Detected W25N01GV with page size 2 KiB, erase size 128 KiB, total 128 MiB
SF: Device[    0.000000] Booting Linux on physical CPU 0x0
[    0.000000] Linux version 4.4.194 (legend@ubuntu) (gcc version 5.4.0 (LEDE GCC 5.4.0 unknown) ) #0 PREEMPT Tue Nov 19 05:51:15 2019
[    0.000000] CPU: ARM926EJ-S [41069265] revision 5 (ARMv5TEJ), cr=0005317f
[    0.000000] CPU: VIVT data cache, VIVT instruction cache
[    0.000000] Machine model: Nuvoton NUC980 IOT-GateWay V0.1
[    0.000000] Memory policy: Data cache writeback
[    0.000000] Built 1 zonelists in Zone order, mobility grouping on.  Total pages: 16256
[    0.000000] Kernel command line: noinitrd rootfstype=squashfs ubi.mtd=2 root=/dev/ubiblock0_0 console=ttyS0,115200n8 mem=64M init=/sbin/init
[    0.000000] PID hash table entries: 256 (order: -2, 1024 bytes)
[    0.000000] Dentry cache hash table entries: 8192 (order: 3, 32768 bytes)
[    0.000000] Inode-cache hash table entries: 4096 (order: 2, 16384 bytes)
[    0.000000] Memory: 58620K/65536K available (3950K kernel code, 282K rwdata, 1520K rodata, 168K init, 203K bss, 6916K reserved, 0K cma-reserved)
[    0.000000] Virtual kernel memory layout:
[    0.000000]     vector  : 0xffff0000 - 0xffff1000   (   4 kB)
[    0.000000]     fixmap  : 0xffc00000 - 0xfff00000   (3072 kB)
[    0.000000]     vmalloc : 0xc4800000 - 0xff800000   ( 944 MB)
[    0.000000]     lowmem  : 0xc0000000 - 0xc4000000   (  64 MB)
[    0.000000]     modules : 0xbf000000 - 0xc0000000   (  16 MB)
[    0.000000]       .text : 0xc0008000 - 0xc055ff04   (5472 kB)
[    0.000000]       .init : 0xc0560000 - 0xc058a000   ( 168 kB)
[    0.000000]       .data : 0xc058a000 - 0xc05d0a48   ( 283 kB)
[    0.000000]        .bss : 0xc05d0a48 - 0xc0603854   ( 204 kB)
[    0.000000] SLUB: HWalign=32, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
[    0.000000] Preemptible hierarchical RCU implementation.
[    0.000000]  Build-time adjustment of leaf fanout to 32.
[    0.000000] NR_IRQS:545
[    0.000000] clocksource: nuc980-timer5: mask: 0xffffff max_cycles: 0xffffff, max_idle_ns: 62215505635 ns
[    0.000024] sched_clock: 24 bits at 120kHz, resolution 8333ns, wraps every 69905062489ns
[    0.000733] Console: colour dummy device 80x30
[    0.188774] console [ttyS0] enabled
[    0.192308] Calibrating delay loop... 148.88 BogoMIPS (lpj=744448)
[    0.262774] pid_max: default: 32768 minimum: 301
[    0.267641] Mount-cache hash table entries: 1024 (order: 0, 4096 bytes)
[    0.274324] Mountpoint-cache hash table entries: 1024 (order: 0, 4096 bytes)
[    0.283491] CPU: Testing write buffer coherency: ok
[    0.289458] Setting up static identity map for 0x8400 - 0x843c
[    0.335816] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 19112604462750000 ns
[    0.346583] futex hash table entries: 256 (order: -1, 3072 bytes)
[    0.353399] pinctrl core: initialized pinctrl subsystem
[    0.360966] NET: Registered protocol family 16
[    0.367541] DMA: preallocated 256 KiB pool for atomic coherent allocations
[    0.380924] <DT> nuc980_dt_device_init +
[    0.419491] <DT> nuc980_dt_device_init -
[    0.426891] pinctrl-nuc980 apb:pinctrl@b0000000: initialized NUC980 pinctrl driver
[    0.547074] SCSI subsystem initialized
[    0.557199] usbcore: registered new interface driver usbfs
[    0.565174] usbcore: registered new interface driver hub
[    0.571933] usbcore: registered new device driver usb
[    0.585508] clocksource: Switched to clocksource nuc980-timer5
[    0.673591] NET: Registered protocol family 2
[    0.682349] TCP established hash table entries: 1024 (order: 0, 4096 bytes)
[    0.690208] TCP bind hash table entries: 1024 (order: 0, 4096 bytes)
[    0.697058] TCP: Hash tables configured (established 1024 bind 1024)
[    0.703641] UDP hash table entries: 256 (order: 0, 4096 bytes)
[    0.709758] UDP-Lite hash table entries: 256 (order: 0, 4096 bytes)
[    0.716949] NET: Registered protocol family 1
[    0.722166] NetWinder Floating Point Emulator V0.97 (double precision)
[    0.734641] Crashlog allocated RAM at address 0x3f00000
[    0.817233] squashfs: version 4.0 (2009/01/31) Phillip Lougher
[    0.894208] io scheduler noop registered (default)
[    0.901058] nuc980_gpio_probe - pdev = b0004000.gpio
[    0.908508] nuc980_dma_probe - pdev = b0008000.dma
[    0.934058] nuc980-dma b0008000.dma: NUC980 DMA ready
[    1.480516] b0070000.serial: ttyS0 at I/O 0xf0070000 (irq = 36, base_baud = 750000) is a NUC980
[    1.492383] b0071000.serial: ttyS1 at I/O 0xf0071000 (irq = 37, base_baud = 9375000) is a NUC980
[    1.503966] b0072000.serial: ttyS2 at I/O 0xf0072000 (irq = 38, base_baud = 9375000) is a NUC980
[    1.590599] brd: module loaded
[    1.599699] RX nuc980_qspi0_probe: dma0chan0 module removed
[    1.605333] TX nuc980_qspi0_probe: dma0chan1 module removed
[    1.631066] libphy: nuc980_rmii0: probed
[    1.640941] PPP generic driver version 2.4.2
[    1.648108] ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
[    1.655391] nuc980-ehci b0015000.usbh_ehci: Nuvoton NUC980 EHCI Host Controller
[    1.663391] nuc980-ehci b0015000.usbh_ehci: new USB bus registered, assigned bus number 1
[    1.672533] nuc980-ehci b0015000.usbh_ehci: irq 23, io mem 0xb0015000
[    1.695724] nuc980-ehci b0015000.usbh_ehci: USB 2.0 started, EHCI 0.95
[    1.704883] pinctrl-nuc980 apb:pinctrl@b0000000: pin PE10 already requested by b0015000.usbh_ehci; cannot claim for usb1
[    1.716233] pinctrl-nuc980 apb:pinctrl@b0000000: pin-74 (usb1) status -22
[    1.723016] pinctrl-nuc980 apb:pinctrl@b0000000: could not request pin 74 (PE10) from group usbh-ppwr-ovc  on device apb:pinctrl@b0000000
[    1.735683] usb usb1: Error applying setting, reverse things back
[    1.743083] hub 1-0:1.0: USB hub found
[    1.747574] hub 1-0:1.0: 2 ports detected
[    1.753591] ehci-platform: EHCI generic platform driver
[    1.760199] ohci_hcd: USB 1.1 'Open' Host Controller (OHCI) Driver
[    1.767574] usb_hcd_nuc980_probe, id = -1, name: b0017000.usbh_ohci, 0
[    1.774266] nuc980-ohci b0017000.usbh_ohci: Nuvoton NUC980 OHCI Host Controller
[    1.781991] nuc980-ohci b0017000.usbh_ohci: new USB bus registered, assigned bus number 2
[    1.790616] nuc980-ohci b0017000.usbh_ohci: irq 24, io mem 0xb0017000
[    1.861166] hub 2-0:1.0: USB hub found
[    1.865874] hub 2-0:1.0: 8 ports detected
[    1.873191] ohci-platform: OHCI generic platform driver
[    1.880766] usbcore: registered new interface driver usb-storage
[    1.888958] usbcore: registered new interface driver usbserial
[    1.896583] usbcore: registered new interface driver option
[    1.902741] usbserial: USB Serial support registered for GSM modem (1-port)
[    1.917466] do_sha - sha last has no data!
[    1.921541] alg: hash: Test 1 failed for nuc980-sha1
[    1.927058] 00000000: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
[    1.933458] 00000010: 00 00 00 00
[    1.937766] do_sha - sha last has no data!
[    1.941849] alg: hash: Test 1 failed for nuc980-sha224
[    1.947249] 00000000: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
[    1.953649] 00000010: 00 00 00 00 00 00 00 00 00 00 00 00
[    1.959958] do_sha - sha last has no data!
[    1.964033] alg: hash: Test 1 failed for nuc980-sha256
[    1.970233] 00000000: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
[    1.976891] 00000010: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
[    1.984041] do_sha - sha last has no data!
[    1.988424] alg: hash: Test 1 failed for nuc980-sha384
[    1.993533] 00000000: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
[    2.000174] 00000010: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
[    2.006841] 00000020: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
[    2.013966] do_sha - sha last has no data!
[    2.018308] alg: hash: Test 1 failed for nuc980-sha512
[    2.023416] 00000000: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
[    2.030049] 00000010: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
[    2.036708] 00000020: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
[    2.043108] 00000030: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
[    2.050383] alg: No test for hmac-sha1 (nuc980-hmac-sha1)
[    2.056624] alg: No test for hmac-sha224 (nuc980-hmac-sha224)
[    2.062966] alg: No test for hmac-sha256 (nuc980-hmac-sha256)
[    2.069558] alg: No test for hmac-sha384 (nuc980-hmac-sha384)
[    2.076191] alg: No test for hmac-sha512 (nuc980-hmac-sha512)
[    2.081999] NUC980 Crypto engine enabled.
[    2.104508] usbcore: registered new interface driver usbhid
[    2.111166] usbhid: USB HID core driver
[    2.127074] nand: device found, Manufacturer ID: 0xef, Chip ID: 0xaa
[    2.133391] nand: Winbond W25N01GV 1G 3.3V
[    2.137733] nand: 128 MiB, SLC, erase size: 128 KiB, page size: 2048, OOB size: 64
[    2.145283] nand: WARNING: spi0.0: the ECC used on your system is too weak compared to the one required by the NAND chip
[    2.156308] Scanning device for bad blocks
[    2.564216] 3 ofpart partitions found on MTD device nand0
[    2.569841] Creating 3 MTD partitions on "nand0":
[    2.574558] 0x000000000000-0x000000200000 : "u-boot"
[    2.586483] 0x000000200000-0x000001600000 : "kernel"
[    2.597641] 0x000001600000-0x000008000000 : "ubi"
[    2.619566] NET: Registered protocol family 10
[    2.629491] NET: Registered protocol family 17
[    2.634216] bridge: automatic filtering via arp/ip/ip6tables has been deprecated. Update your scripts to load br_netfilter if you need this.
[    2.647349] 8021q: 802.1Q VLAN Support v1.8
[    2.662516] ubi0: attaching mtd2
[    4.688033] ubi0: scanning is finished
[    4.729333] ubi0: attached mtd2 (name "ubi", size 106 MiB)
[    4.734791] ubi0: PEB size: 131072 bytes (128 KiB), LEB size: 126976 bytes
[    4.741899] ubi0: min./max. I/O unit sizes: 2048/2048, sub-page size 2048
[    4.748866] ubi0: VID header offset: 2048 (aligned 2048), data offset: 4096
[    4.756224] ubi0: good PEBs: 848, bad PEBs: 0, corrupted PEBs: 0
[    4.762191] ubi0: user volume: 2, internal volumes: 1, max. volumes count: 128
[    4.769633] ubi0: max/mean erase counter: 2/1, WL threshold: 4096, image sequence number: 1934896559
[    4.778941] ubi0: available PEBs: 0, total reserved PEBs: 848, PEBs reserved for bad PEB handling: 20
[    4.788266] ubi0: background thread "ubi_bgt0d" started, PID 1025
[    4.800399] mtd: device 3 (rootfs) set to be root filesystem
[    4.820933] block ubiblock0_0: created from ubi0:0(rootfs)
[    4.872591] VFS: Mounted root (squashfs filesystem) readonly on device 254:0.
[    4.881941] Freeing unused kernel memory: 168K
[    6.148666] init: Console is alive
[    7.824116] kmodloader: loading kernel modules from /etc/modules-boot.d/*
[    7.978833] kmodloader: done loading kernel modules from /etc/modules-boot.d/*
[    7.997291] init: - preinit -
[    9.422299] random: jshn: uninitialized urandom read (4 bytes read, 89 bits of entropy available)
[    9.619383] random: jshn: uninitialized urandom read (4 bytes read, 90 bits of entropy available)
[    9.759549] random: jshn: uninitialized urandom read (4 bytes read, 90 bits of entropy available)
[    9.882424] random: jshn: uninitialized urandom read (4 bytes read, 90 bits of entropy available)
[   10.011483] random: jshn: uninitialized urandom read (4 bytes read, 90 bits of entropy available)
[   10.144933] nuc980-emac0 b0012000.emac0: eth0 is OPENED
[   10.151266] IPv6: ADDRCONF(NETDEV_UP): eth0: link is not ready
[   10.223074] random: procd: uninitialized urandom read (4 bytes read, 90 bits of entropy available)
Press the [f] key and hit [enter] to enter failsafe mode
Press the [1], [2], [3] or [4] key and hit [enter] to select the debug level
[   11.846099] IPv6: ADDRCONF(NETDEV_CHANGE): eth0: link becomes ready
[   13.776016] UBIFS (ubi0:1): default file-system created
[   13.786808] UBIFS (ubi0:1): background thread "ubifs_bgt0_1" started, PID 1112
[   14.020558] UBIFS (ubi0:1): UBIFS: mounted UBI device 0, volume 1, name "rootfs_data"
[   14.028516] UBIFS (ubi0:1): LEB size: 126976 bytes (124 KiB), min./max. I/O unit sizes: 2048 bytes/2048 bytes
[   14.038616] UBIFS (ubi0:1): FS size: 94724096 bytes (90 MiB, 746 LEBs), journal size 4698112 bytes (4 MiB, 37 LEBs)
[   14.049108] UBIFS (ubi0:1): reserved for root: 4474052 bytes (4369 KiB)
[   14.055891] UBIFS (ubi0:1): media format: w4/r0 (latest is w4/r0), UUID AA9B0AA3-040F-4C79-B8FF-5182E8D79BBA, small LPT model
[   14.074683] mount_root: overlay filesystem has not been fully initialized yet
[   14.084566] mount_root: switching to ubifs overlay
[   14.122366] urandom-seed: Seed file not found (/etc/urandom.seed)
[   14.421258] procd: - early -
[   18.041216] procd: - ubus -
[   18.406308] random: ubusd: uninitialized urandom read (4 bytes read, 109 bits of entropy available)
[   18.766133] random: ubusd: uninitialized urandom read (4 bytes read, 109 bits of entropy available)
[   18.968599] random: ubusd: uninitialized urandom read (4 bytes read, 110 bits of entropy available)
[   18.987174] random: ubusd: uninitialized urandom read (4 bytes read, 110 bits of entropy available)
[   19.029966] procd: - init -
Please press Enter to activate this console.
[   21.317733] kmodloader: loading kernel modules from /etc/modules.d/*
[   21.561791] ip6_tables: (C) 2000-2006 Netfilter Core Team
[   21.691308] u32 classifier
[   21.693983]     input device check on
[   21.706249]     Actions configured
[   21.730291] Mirror/redirect action on
[   21.772158] nf_conntrack version 0.5.0 (918 buckets, 3672 max)
[   21.969424] usbcore: registered new interface driver cdc_acm
[   21.975049] cdc_acm: USB Abstract Control Model driver for USB modems and ISDN adapters
[   22.001449] usbcore: registered new interface driver cdc_wdm
[   22.027899] usbcore: registered new interface driver ch341
[   22.039391] usbserial: USB Serial support registered for ch341-uart
[   22.066674] Loading modules backported from Linux version wt-2017-01-31-0-ge882dff19e7f
[   22.074641] Backport generated by backports.git backports-20160324-13-g24da7d3c
[   22.107791] usbcore: registered new interface driver cp210x
[   22.116399] usbserial: USB Serial support registered for cp210x
[   22.147891] usbcore: registered new interface driver ftdi_sio
[   22.156358] usbserial: USB Serial support registered for FTDI USB Serial Device
[   22.196558] ip_tables: (C) 2000-2006 Netfilter Core Team
[   22.348074] usbcore: registered new interface driver pl2303
[   22.366258] usbserial: USB Serial support registered for pl2303
[   22.386458] NET: Registered protocol family 24
[   22.408041] usbcore: registered new interface driver r8152
[   22.647008] xt_time: kernel timezone is -0000
[   22.667908] usbcore: registered new interface driver cdc_ether
[   23.263791] usbcore: registered new interface driver mt7601u
[   23.346666] usbcore: registered new interface driver qmi_wwan
[   23.378033] usbcore: registered new interface driver rndis_host
[   23.417983] usbcore: registered new interface driver rtl8187
[   23.556483] usbcore: registered new interface driver rtl8192cu
[   23.562774] kmodloader: done loading kernel modules from /etc/modules.d/*
[   28.900349] random: nonblocking pool is initialized

LEDE login: root
Password: 


BusyBox v1.25.1 () built-in shell (ash)

     _________
    /        /\      _    ___ ___  ___
   /  LE    /  \    | |  | __|   \| __|
  /    DE  /    \   | |__| _|| |) | _|
 /________/  LE  \  |____|___|___/|___|                      lede-project.org
 \        \   DE /
  \    LE  \    /  -----------------------------------------------------------
   \  DE    \  /    Reboot (17.01-SNAPSHOT, unknown)
    \________\/    -----------------------------------------------------------

root@LEDE:~# 

root@LEDE:~# 
root@LEDE:~# [   61.916508] nuc980-emac0 b0012000.emac0: eth0 is OPENED
[   61.937616] device eth0 entered promiscuous mode
[   61.962066] IPv6: ADDRCONF(NETDEV_UP): br-lan: link is not ready
[   65.136274] br-lan: port 1(eth0) entered forwarding state
[   65.141808] br-lan: port 1(eth0) entered forwarding state
[   65.208291] IPv6: ADDRCONF(NETDEV_CHANGE): br-lan: link becomes ready
[   67.135683] br-lan: port 1(eth0) entered forwarding state

可以看出rootfs 为 squashfs rootfs_data 为 ubifs
这里移植可以参考这几个

Openwrt squafs文件系统及sysupgrade升级探究
OpenWrt升级脚本sysupgrade详解

使用ubifs作为根文件系统的openwrt如何在进行sysupgrade时保存旧的配置
Openwrt 15.05.1增加对MT7620a NAND flash的支持

OpenWrt LEDE 对NAND的支持还是蛮不错的,支持ubi,ubifs,squashfs,还可以更新内核
这里把移植中最重要的Makefile 贴出来

文件目录:
/openwrt-lede-17.01/target/linux/nuvoton/image

#
# Copyright (C) 2008-2011 OpenWrt.org
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#
include $(TOPDIR)/rules.mk
include $(INCLUDE_DIR)/image.mk

UBIFS_OPTS := -F -m 2048 -e 124KiB -c 848  -U
UBI_OPTS := -m 2048 -p 128KiB -s 2048

#UBIFS_OPTS = -F -m 2048 -e 124KiB -c 848  -U
#UBI_OPTS = -m 2048 -p 128KiB -s 2048

#DEVICE_nuc980_UBIFS_OPTS = -m 2048 -e 124KiB -c 848
#DEVICE_nuc980_UBI_OPTS = -m 2048 -p 128KiB -s 2048

#$(PROFILE)_UBI_OPTS :=  -m 2048 -e 124KiB -c 848
#$(PROFILE)_UBIFS_OPTS := -m 2048 -p 128KiB -s 2048

#echo DEVICE_nuc980_UBI_OPTS DEVICE_nuc980_UBIFS_OPTS

VMLINUX:=$(IMG_PREFIX)-vmlinux
UIMAGE:=$(IMG_PREFIX)-uImage

DEVICE_VARS += DTS MKUBIFS_OPTS

loadaddr-y := 0x00008000
loadaddr-$(CONFIG_TARGET_nuvoton_nuc970) := 0x00008000
loadaddr-$(CONFIG_TARGET_nuvoton_nuc980) := 0x00008000


KERNEL_LOADADDR := $(loadaddr-y)

#KERNEL_DTB = kernel-bin
#KERNEL_DTB = kernel-bin | patch-dtb | lzma

#define Device/Default
#  PROFILES = Default $$(DTS)
#  KERNEL_DEPENDS = $$(wildcard ../dts/$$(DTS).dts)
#  KERNEL := $(KERNEL_DTB) | uImage lzma
#endef

define Build/patch-dtb
	$(call Image/BuildDTB,../dts/$(DTS).dts,$@.dtb)
	$(STAGING_DIR_HOST)/bin/patch-dtb $@ $@.dtb
endef

define Image/Prepare
	cp $(LINUX_DIR)/arch/arm/boot/Image $(KDIR)/Image
	cp $(LINUX_DIR)/arch/arm/boot/zImage $(KDIR)/zImage
endef

define MkuImageDtb
	###MkuImageDtb###
	$(if $(wildcard $(KDIR)/zImage $(DTS_DIR)/$(2).dtb),$(shell cat $(KDIR)/zImage $(DTS_DIR)/$(2).dtb > $(KDIR)/zImage-$(1)))
	cat $(KDIR)/zImage $(DTS_DIR)/$(2).dtb > $(KDIR)/zImage-$(1)
	mkimage -A arm -T kernel -C none -a $(KERNEL_LOADADDR) -e $(KERNEL_LOADADDR) \
		-n "OpenWrt ARM $(LINUX_VERSION)" \
		-d $(KDIR)/zImage-$(1) $(BIN_DIR)/$(IMG_PREFIX)-$(1)-uImage
endef

define MkOftree
	cp -u $(KDIR)/zImage $(BIN_DIR)/$(IMG_PREFIX)-zImage
	cp $(DTS_DIR)/$(2).dtb $(BIN_DIR)/$(IMG_PREFIX)-$(1)-oftree.dtb
endef



#dd if=$(KDIR)/nuc980.uImage.align.128k; dd if=$(2) > $(KDIR)/$(output_name)
#cat $(1) $(2) > $(KDIR)/$(output_name)
#cat $(KDIR)/nuc980.uImage.align.128k $(2) > $(KDIR)/$(output_name)
#dd if=$(1) of=$(KDIR)/nuc980.uImage.align.128k bs=128k conv=sync
#$(call prepare_generic_squashfs,$(KDIR)/$(output_name))


#( \
#dd if=$(1) bs=128k conv=sync; \
#dd if=$(2) bs=128k conv=sync; \
#) > $(KDIR)/$(output_name)





#define Image/Build/squashfs
# $(call prepare_generic_squashfs,$(KDIR)/root.squashfs)
# ( \
# dd if=$(KDIR)/uImage bs=1024k conv=sync; \
# dd if=$(KDIR)/root.$(1) bs=64k conv=sync; \
# ) > $(BIN_DIR)/openwrt-$(BOARD)-$(1).img
# $(STAGING_DIR_HOST)/bin/mkyaffs2image-page2k $(STAGING_DIR_ROOT)/ $(BIN_DIR)/openwrt-$(BOARD)-yaffs2-128k.img
# endef


ifeq ($(SUBTARGET),nuc980)
include nuc980.mk
endif

# NUC980
Image/Build/Kernel/NUC980=$(call MkuImageDtb,nuc980-iot-gateway,nuc980-iot-gateway)

#define Image/Build/Kernel/Default
#	#$(call Image/Build/Kernel/NUC980)
#endef

define Image/BuildKernel
	mkimage -A arm -T kernel -C none -a $(KERNEL_LOADADDR) -e $(KERNEL_LOADADDR) \
		-d $(KDIR)/Image $(BIN_DIR)/$(IMG_PREFIX)-uImage
	if [ $(CONFIG_FLEXIBITY_ROOT) ]; then \
		$(INSTALL_BIN) $(BIN_DIR)/$(IMG_PREFIX)-uImage $(TARGET_DIR)/uImage ; \
	fi
#	-mkdir $(BIN_DIR)/dtbs
#	-$(CP) $(DTS_DIR)/*.dtb $(BIN_DIR)/dtbs/
	$(call Image/Build/Kernel/NUC980)
endef

#define Image/BuildKernel
#	$(CP) $(KDIR)/zImage $(BIN_DIR)/$(IMG_PREFIX)-zImage
# ifneq ($(CONFIG_TARGET_ROOTFS_INITRAMFS),)
#	$(CP) $(KDIR)/zImage-initramfs $(BIN_DIR)/$(IMG_PREFIX)-zImage-initramfs
# endif
#	-mkdir $(BIN_DIR)/dtbs
#	-$(CP) $(DTS_DIR)/*.dtb $(BIN_DIR)/dtbs/
#	-$(CP) $(DTS_DIR)/*.dtb $(BIN_DIR)/dtbs/
#
#endef

define Image/Build/ubi
#	-echo "Image/Build/ubi" should not be run
endef


#	(cd "$(KDIR_TMP)"; $(TAR) cvf \
#		"$(BIN_DIR)/sysupgrade-$(4).tar" sysupgrade-$(4) \
#			$(if $(SOURCE_DATE_EPOCH),--mtime="@$(SOURCE_DATE_EPOCH)") \
#	)
define Image/Build/SysupgradeCombined

	mkdir -p "$(KDIR_TMP)/sysupgrade-$(4)/"
	echo "BOARD=$(4)" > "$(KDIR_TMP)/sysupgrade-$(4)/CONTROL"

	$(CP) "$(1)" "$(KDIR_TMP)/sysupgrade-$(4)/kernel"
	$(CP) "$(2)" "$(KDIR_TMP)/sysupgrade-$(4)/root"

	(cd "$(KDIR_TMP)"; $(TAR) cvf \
		"$(BIN_DIR)/$(IMG_PREFIX)-$(3)-sysupgrade.tar" sysupgrade-$(4) \
			$(if $(SOURCE_DATE_EPOCH),--mtime="@$(SOURCE_DATE_EPOCH)") \
	)


endef

define MkImageSysupgrade
	####MkImageSysupgrade-$(3)####
	$(eval output_name=$(IMG_PREFIX)-sysupgrade.bin)
	
	( \
	dd if=$(1) bs=128k conv=sync; \
	dd if=$(2) bs=128k conv=sync; \
	) > $(KDIR)/$(output_name)

	$(call prepare_generic_squashfs,$(KDIR)/$(output_name))

	$(CP) $(KDIR)/$(output_name) $(BIN_DIR)/$(output_name)

	$(call Image/Build/SysupgradeCombined,$(1),$(2),$(3),NUC980-IOT-GateWay)
endef


#	$(CP) ./ubinize.cfg $(KDIR)
#	$(CP) ./ubinize-overlay.cfg $(KDIR)
#	$(call MkImageSysupgrade,$(BIN_DIR)/$(IMG_PREFIX)-nuc980-iot-gateway-uImage,$(KDIR)/root.ubi,ubi)
#	$(call MkImageSysupgrade,$(BIN_DIR)/$(IMG_PREFIX)-nuc980-iot-gateway-uImage,$(KDIR)/root.ubi,ubi)
#	$(call MkImageSysupgrade,$(BIN_DIR)/$(IMG_PREFIX)-nuc980-iot-gateway-uImage,$(KDIR)/root-overlay.ubi,ubi-overlay)

define Image/Build/ubifs

#	-echo "Image/Build/ubifs" $(IMG_PREFIX) 
	$(if $(wildcard ./ubinize.cfg),$(call Image/mkfs/ubifs/generate,))
	$(if $(wildcard ./ubinize-overlay.cfg),$(call Image/mkfs/ubifs/generate,-overlay))
	cp $(KDIR)/root.ubi $(BIN_DIR)/$(IMG_PREFIX)-root-ubi.img
	cp $(KDIR)/root-overlay.ubi $(BIN_DIR)/$(IMG_PREFIX)-root-overlay-ubi.img

	$(call MkImageSysupgrade,$(BIN_DIR)/$(IMG_PREFIX)-nuc980-iot-gateway-uImage,$(KDIR)/root.ubifs,ubi-ubifs)
	$(call MkImageSysupgrade,$(BIN_DIR)/$(IMG_PREFIX)-nuc980-iot-gateway-uImage,$(KDIR)/root.squashfs,ubi-squashfs)
endef

define Image/Build
#	-echo PROFILE:$(PROFILE)
	$(call Image/Build/$(1))
	cp $(KDIR)/root.$(1) $(BIN_DIR)/$(IMG_PREFIX)-root.$(1)
endef

#define BuildFirmware/nuc980/ubifs
#	$(call MkImageLzmaDtb,$(2),$(3),$(4))
#	dd if=$(KDIR)/vmlinux-$(2).uImage of=$(KDIR)/vmlinux-$(2).uImage.align.128k bs=128k conv=sync
#endef

#define BuildFirmware/nuc980/ubi
#	$(eval output_name=$(IMG_PREFIX)-$(2)-squashfs-sysupgrade.ubi)
#	( \
#	dd if=$(KDIR)/vmlinux-$(2).uImage.align.128k; \
#	dd if=$(KDIR)/root-overlay.ubi \
#	) > $(KDIR)/$(output_name)
#	$(CP) $(KDIR)/$(output_name) $(BIN_DIR)/$(output_name)
#endef

#Image/Build/Profile/nuc980=$(call BuildFirmware/nuc980/$(1),$(1),nuc980,DEMO)


$(eval $(call BuildImage))

有了这个makefile 如果读者想自己移植那基本就差不多了,工作量会减少一半。

  • 2
    点赞
  • 13
    收藏
    觉得还不错? 一键收藏
  • 13
    评论
JinXiu 0001是一个数据通信协议互转的设备,它支持RS232, USB, TCPIP, TCPUDP, I2C, SPI,CAN等协议的互转,同时支持用户通过自己控制GPIO以模拟特定的波形,用户不需要对板子编程,只需要通过JinXiu提供的软件配置设备的运行时参数即可,控制GPIO时也不需要对板子编程,只需要在按协议通过RS232/USB/TCPIP等对某个GPIO进行控制即可。主芯片: STM32F103RBT6,最新的ARM V7核,主频72兆。网卡芯片: RTL8019。 可以用GPIO采集工业控制的数据,模拟NAND flash控制器,Nor flash控制器,SD卡控制器等。RS232的速率是0-115200bit每秒,USB是USB1.1,理论速度12兆bit每秒,实测速度4兆bit每秒,TCPIP承载在以太网上,以太网芯片是RTL8019,理论速度10兆bit每秒,实测速度9兆bit每秒。 TCPIP功能可以用来做服务器,也可以用来做客户端,当作为服务器时,上电启动后等待远程客户端连接。当作为客户端时上电会尝试连接远程服务器,如果连接失败延迟1s后会继续连接,直到连接成功,如果发生异常或者远程服务器断开连接,软件将会自动尝试重新建立连接直到连接成功。 JinXiu0001自带软件看门狗和硬件看门狗,如果程序发生异常,将在5s内重新启动,如果软件5s内不喂狗硬件将会重新启动。 用户可以通过HwInforCtl.exe来配置设备的运行参数。HwInforCtl.exe是JinXiu公司发布的专门配置JinXiu0001的软件。设备有两种运行模式,一种为正常模式(也称协议转换模式),一种为工厂模式,正常模式用来做协议互转,工厂模式用来配置设备的参数,工厂模式下才能单独操作GPIO,上电前把GPIOB5拉底将会进入工厂模式,上电前把GPIOB5悬空或拉高将会进入正常模式。 设备带有安全启动密钥管理机制,每个设备都有不同的密钥,如果启动时密钥匹配失败,那么将不能使用协议互转功能,每个设备都有自己独立的密钥,即使用户把别的已经设定密钥成功的设备的闪存内容全部读出来烧到新的设备上,新设备的密钥匹配依然会失败,这也就防止了软件被盗版。对每个设备必须通过JinXiu的HwInforCtl.exe的进行一次启动密钥的生成,这样设备才能正常工作。 JinXiu0001支持串口升级软件的功能,JinXiu会不定期发布软件来修订以前设计的错误,客户可以向JinXiu索取最新版软件,更新软件不会丢失已经配置好的密钥,所以不需要对设备重新生成密钥,JinXiu提供帮客户定制板级软件和PC端软件的服务,但这要另外协商。 JinXiu0001的原理图和PCB是免费的,用户可以跟JinXiu公司免费索取然后以其作参考设计自己的设备,每一个设备上的每一套软件都需要license,用户在生成启动密钥之前需要向JinXiu获取license。当然如果用户买的是JinXiu的硬件设备,出厂前密钥都已经被配置好了,不需要重新生成密钥。 JinXiu0001的USB自带USB驱动,接上USB线到个人PC后,电脑会多出一个”JinXiu”标识的CDROM,选择从其中安装驱动即可。 合作电话: 13636321722 hailang

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 13
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值