freebsd / freebsd-wifi-build

freebsd-wifi-build
141 stars 59 forks source link

Hi cfg_save dd: no value specified for of #129

Closed wangqiangcc closed 6 years ago

wangqiangcc commented 6 years ago

Hi

When I run the following command to save the three problems found. 

1, running cfg_save command takes a long time, about 10 minutes 2, suggesting mistakes dd: no value specified for of 3, after the restart found that the contents of the amendment did not save

echo "ifconfig_rt0="inet 192.168.11.233 netmask 255.255.255.0"" >> /etc/rc.conf

echo "defaultrouter="192.168.11.254"" >> /etc/rc.conf

echo "nameserver 114.114.114.114" >> /etc/resolv.conf

echo "/etc/rc.conf" >> /etc/cfg/manifest

echo "/etc/resolv.conf" >> /etc/cfg/manifest

cfg_save -->Run for a long time, About 10 minutes or so.

*** Storing configuration files from /etc/cfg/manifest -> .. etc/cfg/manifest etc/master.passwd etc/group etc/cfg/rc.conf cpio: Can't lstat etc/dropbear/dropbear_ecdsa_host_key cpio: Can't lstat etc/openvpn.conf /etc/rc.conf /etc/resolv.conf 7 blocks dd: no value specified for of #

Thx! :)

mizhka commented 6 years ago

It means that your firmware doesn't support "cfg" partition of flash. It's device-specific and some of configurations may lack support of cfg partition. But it's possible to add it via geom's "flashmap" or "map"

wangqiangcc commented 6 years ago

Hi Is in /data/freebsd/head/src/sys/mips/conf/MT7628_FDT file add "options GEOM_MAP" options, recompile it ? Thx! :)

https://www.freebsd.org/cgi/man.cgi?geom(4)

mizhka commented 6 years ago

FDT is specific case. I suppose FDT provides flash layout. You can reduce firmware partition and add cfg partition after "firmware". cfg should be small, no more than 128Kb. I guess your FDT flash layout is https://github.com/freebsd/freebsd/blob/master/sys/gnu/dts/mips/MT7628.dts#L31

wangqiangcc commented 6 years ago

Hi

My SPI NOR FLASH size is 32M, I modified the file

/data/freebsd/head/src/sys/gnu/dts/mips/MT7628.dts And recompile freebsd-wifi, brush into the JS7628 board, I run the following command

ls /dev/flash/*

/dev/flash/spi0 /dev/flash/spi0s.firmware /dev/flash/spi0s.cfg /dev/flash/spi0s.u-boot /dev/flash/spi0s.factory /dev/flash/spi0s.u-boot-env

echo "defaultrouter="192.168.11.254"" >> /etc/rc.conf

echo "/etc/rc.conf" >> /etc/cfg/manifest

cfg_save

*** Storing configuration files from /etc/cfg/manifest -> .. dd: no value specified for of etc/cfg/manifest etc/master.passwd etc/group etc/cfg/rc.conf cpio: Can't lstat etc/dropbear/dropbear_ecdsa_host_key cpio: Can't lstat etc/openvpn.conf /etc/rc.conf 7 blocks

cat /etc/board.cfg

Configuration for: MT7628_FDT

CFG_PATH="" CFG_SIZE="" RECOVERY_PIN="" RECOVERY_PIN_ACTIVE="" #

Then restart and found /etc/rc.conf file is not saved. Thx :)

MT7628.dts modified:

&spi0 { status = "okay";

m25p80@0 {
    #address-cells = <1>;
    #size-cells = <1>;
    compatible = "jedec,spi-nor";
    reg = <0>;
    linux,modalias = "m25p80", "en25q64";
    spi-max-frequency = <10000000>;
    m25p,chunked-io = <32>;

    partition@0 {
        label = "u-boot";
        reg = <0x0 0x30000>;
        read-only;
    };

    partition@30000 {
        label = "u-boot-env";
        reg = <0x30000 0x10000>;
        read-only;
    };

    factory: partition@40000 {
        label = "factory";
        reg = <0x40000 0x10000>;
        read-only;
    };

    partition@50000 {
        label = "firmware";
        reg = <0x50000 0x7b0000>; //8MB flash

    };

    partition@800000 {
        label = "cfg";
        reg = <0x800000 0x1fb0000>; //23MB flash

    };
};

};

dmesg info

dmesg|more

KDB: debugger backends: ddb KDB: current backend: ddb Copyright (c) 1992-2017 The FreeBSD Project. Copyright (c) 1979, 1980, 1983, 1986, 1988, 1989, 1991, 1992, 1993, 1994 The Regents of the University of California. All rights reserved. FreeBSD is a registered trademark of The FreeBSD Foundation. FreeBSD 11.1-RELEASE #7 r328037M: Thu Jan 25 00:27:49 CST 2018 dnybz@dnybz:/data/freebsd/head/obj/mipsel_ap/mips.mipsel/data/freebsd/head/src/sys/MT7628_FDT mips gcc version 4.2.1 20070831 patched [FreeBSD] WARNING: WITNESS option enabled, expect reduced performance. MEMGUARD DEBUGGING ALLOCATOR INITIALIZED: MEMGUARD map base: 0xc0800000 MEMGUARD map size: 104860 KBytes Preloaded elf kernel "kernel" at 0x80c7fc50. real memory = 268435456 (262144K bytes) Physical memory chunk(s): 0x00d20000 - 0x0fb8cfff, 250007552 bytes (61037 pages) avail memory = 242425856 (231MB) ULE: setup cpu 0 random: entropy device external interface mem: null: <full device, null device, zero device> openfirm: nexus0: random: harvesting attach, 8 bytes (4 bits) from nexus0 ofwbus0: on nexus0 palmbus0: mem 0x10000000-0x101fffff on ofwbus0 simplebus0: mem 0x600-0x6ff irq 10 on palmbus0 random: harvesting attach, 8 bytes (4 bits) from simplebus0 random: harvesting attach, 8 bytes (4 bits) from palmbus0 random: harvesting attach, 8 bytes (4 bits) from ofwbus0 cpupic0: on ofwbus0 random: harvesting attach, 8 bytes (4 bits) from cpupic0 sysc0: mem 0-0xff on palmbus0 random: harvesting attach, 8 bytes (4 bits) from sysc0 pinctrl0: on ofwbus0 pinctrl0: GPIO mode start: 0x54054404 Processing 1 pin-config node(s) in pinctrl-0 for spi@b00 Processing 1 pin-config node(s) in pinctrl-0 for uartlite@c00 Processing 1 pin-config node(s) in pinctrl-0 for pinctrl pinctrl0: GPIO mode end : 0x54154404 random: harvesting attach, 8 bytes (4 bits) from pinctrl0 rstctrl0: on ofwbus0 random: harvesting attach, 8 bytes (4 bits) from rstctrl0 clkctrl0: on ofwbus0 random: harvesting attach, 8 bytes (4 bits) from clkctrl0 intc0: <MTK Interrupt Controller (v2)> mem 0x200-0x2ff irq 8 on palmbus0 random: harvesting attach, 8 bytes (4 bits) from intc0 gpio0: <MTK GPIO Controller (v2)> mem 0-0xff irq 17 on simplebus0 gpiobus0: on gpio0 random: harvesting attach, 8 bytes (4 bits) from gpiobus0 random: harvesting attach, 8 bytes (4 bits) from gpio0 gpio1: <MTK GPIO Controller (v2)> mem 0-0xff irq 18 on simplebus0 gpiobus1: on gpio1 random: harvesting attach, 8 bytes (4 bits) from gpiobus1 random: harvesting attach, 8 bytes (4 bits) from gpio1 gpio2: <MTK GPIO Controller (v2)> mem 0-0xff irq 19 on simplebus0 gpiobus2: on gpio2 random: harvesting attach, 8 bytes (4 bits) from gpiobus2 random: harvesting attach, 8 bytes (4 bits) from gpio2 palmbus0: watchdog@120 mem 0x120-0x12f irq 7 compat ralink,mt7628an-wdt (no driver attached) palmbus0: memc@300 mem 0x300-0x3ff irq 9 compat ralink,mt7620a-memc (no driver attached) gpioc0: on gpio0 random: harvesting attach, 8 bytes (4 bits) from gpioc0 gpioc1: on gpio1 random: harvesting attach, 8 bytes (4 bits) from gpioc1 gpioc2: on gpio2 random: harvesting attach, 8 bytes (4 bits) from gpioc2 palmbus0: i2c@900 mem 0x900-0x9ff disabled compat mediatek,mt7628-i2c (no driver attached) palmbus0: i2s@a00 mem 0xa00-0xaff irq 11 disabled compat ralink,mt7620a-i2s (no driver attached) spi0: <MTK SPI Controller (v2)> mem 0xb00-0xbff on palmbus0 spibus0: on spi0 mx25l0: at cs 0 mode 0 on spibus0 mx25l0: w25q256, sector 65536 bytes, 512 sectors random: harvesting attach, 8 bytes (4 bits) from mx25l0 random: harvesting attach, 8 bytes (4 bits) from spibus0 random: harvesting attach, 8 bytes (4 bits) from spi0 uart0: mem 0xc00-0xcff irq 12 on palmbus0 uart0: console (119047,n,8,1) uart0: fast interrupt uart0: PPS capture mode: DCDinvalid random: harvesting attach, 8 bytes (4 bits) from uart0 palmbus0: uart1@d00 mem 0xd00-0xdff irq 13 disabled compat ns16550a (no driver attached) palmbus0: uart2@e00 mem 0xe00-0xeff irq 14 disabled compat ns16550a (no driver attached) palmbus0: pwm@5000 mem 0x5000-0x5fff disabled compat mediatek,mt7628-pwm (no driver attached) palmbus0: pcm@2000 mem 0x2000-0x27ff irq 15 disabled compat ralink,mt7620a-pcm (no driver attached) palmbus0: gdma@2800 mem 0x2800-0x2fff irq 16 disabled compat ralink,mt7620a-gdma (no driver attached) usbphy0: mem 0x10120000-0x10123fff on ofwbus0 random: harvesting attach, 8 bytes (4 bits) from usbphy0 ofwbus0: sdhci@10130000 mem 0x10130000-0x10133fff irq 0 disabled compat ralink,mt7620-sdhci (no driver attached) ehci0: <MTK USB 2.0 Controller> mem 0x101c0000-0x101c0fff irq 1 on ofwbus0 usbus0: EHCI version 1.0 usbus0 on ehci0 ehci0: usbpf: Attached random: harvesting attach, 8 bytes (4 bits) from usbus0 random: harvesting attach, 8 bytes (4 bits) from ehci0 ohci0: mem 0x101c1000-0x101c1fff irq 2 on ofwbus0 usbus1 on ohci0 ohci0: usbpf: Attached random: harvesting attach, 8 bytes (4 bits) from usbus1 random: harvesting attach, 8 bytes (4 bits) from ohci0 rt0: mem 0x10100000-0x1010ffff irq 3 on ofwbus0 rt0: RT5350 Ethernet MAC (rev 0x00000000) rt0: use hardcoded 00:18:e7:d5:83:90 macaddr rt0: bpf attached rt0: Ethernet address: 00:18:e7:d5:83:90 random: harvesting attach, 8 bytes (4 bits) from rt0 mtkswitch0: mem 0x10110000-0x10117fff irq 4 on ofwbus0 miibus0: on mtkswitch0 ukphy0: <Generic IEEE 802.3u media interface> PHY 0 on miibus0 ukphy0: OUI 0x0017a5, model 0x0001, rev. 0 ukphy0: none, 10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX, auto random: harvesting attach, 8 bytes (4 bits) from ukphy0 random: harvesting attach, 8 bytes (4 bits) from miibus0 miibus1: on mtkswitch0 ukphy1: <Generic IEEE 802.3u media interface> PHY 1 on miibus1 ukphy1: OUI 0x0017a5, model 0x0001, rev. 0 ukphy1: none, 10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX, auto random: harvesting attach, 8 bytes (4 bits) from ukphy1 random: harvesting attach, 8 bytes (4 bits) from miibus1 miibus2: on mtkswitch0 ukphy2: <Generic IEEE 802.3u media interface> PHY 2 on miibus2 ukphy2: OUI 0x0017a5, model 0x0001, rev. 0 ukphy2: none, 10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX, auto random: harvesting attach, 8 bytes (4 bits) from ukphy2 random: harvesting attach, 8 bytes (4 bits) from miibus2 miibus3: on mtkswitch0 ukphy3: <Generic IEEE 802.3u media interface> PHY 3 on miibus3 ukphy3: OUI 0x0017a5, model 0x0001, rev. 0 ukphy3: none, 10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX, auto random: harvesting attach, 8 bytes (4 bits) from ukphy3 random: harvesting attach, 8 bytes (4 bits) from miibus3 miibus4: on mtkswitch0 ukphy4: <Generic IEEE 802.3u media interface> PHY 4 on miibus4 ukphy4: OUI 0x0017a5, model 0x0001, rev. 0 ukphy4: none, 10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX, auto random: harvesting attach, 8 bytes (4 bits) from ukphy4 random: harvesting attach, 8 bytes (4 bits) from miibus4 etherswitch0: on mtkswitch0 random: harvesting attach, 8 bytes (4 bits) from etherswitch0 mdio0: on mtkswitch0 random: harvesting attach, 8 bytes (4 bits) from mdio0 random: harvesting attach, 8 bytes (4 bits) from mtkswitch0 ofwbus0: pcie@10140000 mem 0x10140000-0x1014ffff irq 5 disabled type pci compat mediatek,mt7628-pci (no driver attached) ofwbus0: wmac@10300000 mem 0x10300000-0x103fffff irq 6 compat mediatek,mt7628-wmac (no driver attached) clock0: on nexus0 Timecounter "MIPS32" frequency 287500000 Hz quality 800 Event timer "MIPS32" frequency 287500000 Hz quality 800 random: harvesting attach, 8 bytes (4 bits) from clock0 Device configuration finished. Timecounters tick every 10.000 msec lo0: bpf attached tcp_init: net.inet.tcp.tcbhashsize auto tuned to 4096 mtkswitch0port0: link state changed to DOWN mtkswitch0port1: link state changed to DOWN mtkswitch0port2: link state changed to DOWN mtkswitch0port3: link state changed to DOWN mtkswitch0port4: link state changed to DOWN md0: Embedded image 8192000 bytes at 0x8042f144 usbus0: 480Mbps High Speed USB v2.0 usbus1: 12Mbps Full Speed USB v1.0 GEOM: new disk flash/spi0 ugen1.1: at usbus1 uhub0: <MediaTek OHCI root HUB, class 9/0, rev 1.00/1.00, addr 1> on usbus1 ugen0.1: at usbus0 uhub1: <MediaTek EHCI root HUB, class 9/0, rev 2.00/1.00, addr 1> on usbus0 MAP: No valid partition found at md0 flash/spi0: slice 00000000-0002ffff: u-boot (191KB) flash/spi0: slice 00030000-0003ffff: u-boot-env (63KB) flash/spi0: slice 00040000-0004ffff: factory (63KB) flash/spi0: slice 00050000-007fffff: firmware (7871KB) flash/spi0: slice 00800000-027affff: cfg (32447KB) MAP: No valid partition found at flash/spi0 MAP: No valid partition found at md0.uzip MAP: No valid partition found at flash/spi0s.u-boot MAP: No valid partition found at flash/spi0s.u-boot-env MAP: No valid partition found at flash/spi0s.factory MAP: No valid partition found at flash/spi0s.firmware MAP: No valid partition found at flash/spi0s.cfg taskqgroup_adjust failed cnt: 1 stride: 1 mp_ncpus: 1 smp_started: 0 taskqgroup_adjust failed cnt: 1 stride: 1 mp_ncpus: 1 smp_started: 0 WARNING: WITNESS option enabled, expect reduced performance. Trying to mount root from ufs:md0.uzip []... warning: no time-of-day clock registered, system time will not be set accurately start_init: trying /sbin/init uhub0: 1 port with 1 removable, self powered random: harvesting attach, 8 bytes (4 bits) from uhub0 uhub1: 1 port with 1 removable, self powered random: harvesting attach, 8 bytes (4 bits) from uhub1 MAP: No valid partition found at md1 ugen1.2: <vendor 0x05e3 USB2.0 Hub> at usbus1 uhub2 on uhub0 uhub2: <vendor 0x05e3 USB2.0 Hub, class 9/0, rev 2.00/85.36, addr 2> on usbus1 uhub2: 4 ports with 4 removable, self powered random: harvesting attach, 8 bytes (4 bits) from uhub2 mtkswitch0port0: link state changed to UP random: unblocking device. MAP: No valid partition found at md1 MAP: No valid partition found at md2 MAP: No valid partition found at md2 MAP: No valid partition found at md3 MAP: No valid partition found at md3 bridge0: bpf attached bridge0: Ethernet address: 2a:da:c4:2b:28:6b rt0: entering promiscuous mode rt0: promiscuous mode enabled bridge0: link state changed to UP

wangqiangcc commented 6 years ago

I add storage partition /data/freebsd/freebsd-wifi-build/build/cfg/ralink After X_MAKEFS_ENDIAN add the following

The configuration load/save script needs to know the

configuration partition name and location.

BIN_CFG_PARTITION="/dev/flash/spi0s.cfg" BIN_CFG_SIZE="33226752" And recompile the system, when running cfg_save, restart the board when I can not start :(

Can provide similar openwrt storage solutions? Thx! :)

cat /proc/mtd

dev: size erasesize name mtd0: 00030000 00010000 "u-boot" mtd1: 00010000 00010000 "u-boot-env" mtd2: 00010000 00010000 "factory" mtd3: 01fb0000 00010000 "firmware" mtd4: 00116107 00010000 "kernel" mtd5: 01e99ef9 00010000 "rootfs" mtd6: 01ae0000 00010000 "rootfs_data"