您尚未登录。

#2 Re: 全志 SOC » 全志R40使用UMS烧写/备份镜像 » 2022-03-01 08:31:27

sniper 说:

请问你的uboot 是怎么配置的? 我想启用 ums 功能,但是编译会报错。
可以发一份你的 config给我吗?

u-boot的代码里面没有R40支持, 需要修改代码.

http://patchwork.ozlabs.org/project/uboot/patch/20210616023326.18135-1-qianfanguijin@163.com/

这是之前做的patch, 后来不用R40了, 也就没有更近. 另外, 也没有R40的手册, 很难去弄了.

#3 Re: 全志 SOC » 子午线V3s路由器试玩 » 2021-11-23 08:18:05

sy373466062 说:

这个研究也太迅猛了, 看了下log是OpenWRT系统?

这个倒是可以用于学习如何快速搭建产品模型。好简洁的PCB。

是openwrt, 之前没搞过这个, 正好好好学习下.

看到文件系统和内核uImage文件打包到一块了, 直接使用bootm启动, 还有这种骚操作.

#4 Re: 全志 SOC » 子午线V3s路由器试玩 » 2021-11-22 10:20:08

找了个usb micro贴片座子焊上, 找一条usb数据线, 把插头的塑料皮削薄点, 可以完美插入Lichee Zero中.
看了下板上有个标着flash的两个点, 万用表量了下, 是短接flash的2脚miso与gnd的. 短接可以进入BROM.

使用sunxi-fel可以读出spi flash的信息, 顺手将固件dump出来.

➜  qlnk4105 sudo sunxi-fel spiflash-info
Manufacturer: Winbond (EFh), model: 40h, size: 16777216 bytes.
➜  qlnk4105 sudo sunxi-fel spiflash-read 0 16777216 dump.bin
➜  qlnk4105 ls
dump.bin

使用gz压缩, 上传了一份:
dump.bin.gz

导出之后使用binwalk看下信息:

➜  qlnk4105 binwalk dump.bin

DECIMAL       HEXADECIMAL     DESCRIPTION
--------------------------------------------------------------------------------
281324        0x44AEC         device tree image (dtb)
302204        0x49C7C         SHA256 hash constants, little endian
344596        0x54214         CRC32 polynomial table, little endian
485312        0x767C0         device tree image (dtb)
1114112       0x110000        device tree image (dtb)
1310720       0x140000        uImage header, header size: 64 bytes, header CRC: 0x75A697B1, created: 2018-07-24 07:25:26, image size: 1654992 bytes, Data Address: 0x40008000, Entry Point: 0x40008000, data CRC: 0x8B67582D, OS: Linux, CPU: ARM, image type: Multi-File Image, compression type: lzma, image name: "ARM OpenWrt Linux-4.14.14"
1310800       0x140050        LZMA compressed data, properties: 0x6D, dictionary size: 8388608 bytes, uncompressed size: 7492928 bytes
2938080       0x2CD4E0        device tree image (dtb)
2951928       0x2D0AF8        device tree image (dtb)
2965776       0x2D4110        Squashfs filesystem, little endian, version 4.0, compression:xz, size: 6218380 bytes, 1695 inodes, blocksize: 262144 bytes, created: 2018-08-02 09:04:02
9240576       0x8D0000        JFFS2 filesystem, little endian

使用fdtdump搜搜dtb:

➜  qlnk4105 fdtdump -s dump.bin

**** fdtdump is a low-level debugging tool, not meant for general use.
**** If you want to decompile a dtb, you probably want
****     dtc -I dtb -O dts <filename>

dump.bin: found fdt at offset 0x767c0
/dts-v1/;
// magic:               0xd00dfeed
// totalsize:           0x1f24 (7972)
// off_dt_struct:       0x38
// off_dt_strings:      0x1c2c
// off_mem_rsvmap:      0x28
// version:             17
// last_comp_version:   16
// boot_cpuid_phys:     0x0
// size_dt_strings:     0x2f8
// size_dt_struct:      0x1bf4

/ {
    #address-cells = <0x00000001>;
    #size-cells = <0x00000001>;
    interrupt-parent = <0x00000001>;
    model = "Lichee Pi Zero";
    compatible = "licheepi,licheepi-zero", "allwinner,sun8i-v3s";
    cpus {
        #address-cells = <0x00000001>;
        #size-cells = <0x00000000>;
        cpu@0 {
            compatible = "arm,cortex-a7";
            device_type = "cpu";
            reg = <0x00000000>;
            clocks = <0x00000002 0x0000000e>;
        };
    };
    timer {
        compatible = "arm,armv7-timer";
        interrupts = <0x00000001 0x0000000d 0x00000f08 0x00000001 0x0000000e 0x00000f08 0x00000001 0x0000000b 0x00000f08 0x00000001 0x0000000a 0x00000f08>;
    };
    clocks {
        #address-cells = <0x00000001>;
        #size-cells = <0x00000001>;
        ranges;
        osc24M_clk {
            #clock-cells = <0x00000000>;
            compatible = "fixed-clock";
            clock-frequency = <0x016e3600>;
            clock-output-names = "osc24M";
            linux,phandle = <0x00000007>;
            phandle = <0x00000007>;
        };
        osc32k_clk {
            #clock-cells = <0x00000000>;
            compatible = "fixed-clock";
            clock-frequency = <0x00008000>;
            clock-output-names = "osc32k";
            linux,phandle = <0x00000008>;
            phandle = <0x00000008>;
        };
    };
    soc {
        compatible = "simple-bus";
        #address-cells = <0x00000001>;
        #size-cells = <0x00000001>;
        ranges;
        syscon@01c00000 {
            compatible = "allwinner,sun8i-h3-syscon", "syscon";
            reg = <0x01c00000 0x00000034>;
        };
        mmc@01c0f000 {
            compatible = "allwinner,sun7i-a20-mmc";
            reg = <0x01c0f000 0x00001000>;
            clocks = <0x00000002 0x00000016 0x00000002 0x0000002d 0x00000002 0x0000002f 0x00000002 0x0000002e>;
            clock-names = "ahb", "mmc", "output", "sample";
            resets = <0x00000002 0x00000007>;
            reset-names = "ahb";
            interrupts = <0x00000000 0x0000003c 0x00000004>;
            status = "okay";
            #address-cells = <0x00000001>;
            #size-cells = <0x00000000>;
            pinctrl-0 = <0x00000003>;
            pinctrl-names = "default";
            broken-cd;
            bus-width = <0x00000004>;
            vmmc-supply = <0x00000004>;
        };
        mmc@01c10000 {
            compatible = "allwinner,sun7i-a20-mmc";
            reg = <0x01c10000 0x00001000>;
            clocks = <0x00000002 0x00000017 0x00000002 0x00000030 0x00000002 0x00000032 0x00000002 0x00000031>;
            clock-names = "ahb", "mmc", "output", "sample";
            resets = <0x00000002 0x00000008>;
            reset-names = "ahb";
            interrupts = <0x00000000 0x0000003d 0x00000004>;
            status = "disabled";
            #address-cells = <0x00000001>;
            #size-cells = <0x00000000>;
        };
        mmc@01c11000 {
            compatible = "allwinner,sun7i-a20-mmc";
            reg = <0x01c11000 0x00001000>;
            clocks = <0x00000002 0x00000018 0x00000002 0x00000033 0x00000002 0x00000035 0x00000002 0x00000034>;
            clock-names = "ahb", "mmc", "output", "sample";
            resets = <0x00000002 0x00000009>;
            reset-names = "ahb";
            interrupts = <0x00000000 0x0000003e 0x00000004>;
            status = "disabled";
            #address-cells = <0x00000001>;
            #size-cells = <0x00000000>;
        };
        usb@01c19000 {
            compatible = "allwinner,sun8i-h3-musb";
            reg = <0x01c19000 0x00000400>;
            clocks = <0x00000002 0x0000001d>;
            resets = <0x00000002 0x00000011>;
            interrupts = <0x00000000 0x00000047 0x00000004>;
            interrupt-names = "mc";
            phys = <0x00000005 0x00000000>;
            phy-names = "usb";
            extcon = <0x00000005 0x00000000>;
            status = "okay";
            dr_mode = "otg";
        };
        phy@01c19400 {
            compatible = "allwinner,sun8i-v3s-usb-phy";
            reg = <0x01c19400 0x0000002c 0x01c1a800 0x00000004>;
            reg-names = "phy_ctrl", "pmu0";
            clocks = <0x00000002 0x00000038>;
            clock-names = "usb0_phy";
            resets = <0x00000002 0x00000000>;
            reset-names = "usb0_reset";
            status = "okay";
            #phy-cells = <0x00000001>;
            usb0_id_det-gpio = <0x00000006 0x00000005 0x00000006 0x00000000>;
            linux,phandle = <0x00000005>;
            phandle = <0x00000005>;
        };
        clock@01c20000 {
            compatible = "allwinner,sun8i-v3s-ccu";
            reg = <0x01c20000 0x00000400>;
            clocks = <0x00000007 0x00000008>;
            clock-names = "hosc", "losc";
            #clock-cells = <0x00000001>;
            #reset-cells = <0x00000001>;
            linux,phandle = <0x00000002>;
            phandle = <0x00000002>;
        };
        rtc@01c20400 {
            compatible = "allwinner,sun6i-a31-rtc";
            reg = <0x01c20400 0x00000054>;
            interrupts = <0x00000000 0x00000028 0x00000004 0x00000000 0x00000029 0x00000004>;
        };
        pinctrl@01c20800 {
            compatible = "allwinner,sun8i-v3s-pinctrl";
            reg = <0x01c20800 0x00000400>;
            interrupts = <0x00000000 0x0000000f 0x00000004 0x00000000 0x00000011 0x00000004>;
            clocks = <0x00000002 0x00000025 0x00000007 0x00000008>;
            clock-names = "apb", "hosc", "losc";
            gpio-controller;
            #gpio-cells = <0x00000003>;
            interrupt-controller;
            #interrupt-cells = <0x00000003>;
            linux,phandle = <0x00000006>;
            phandle = <0x00000006>;
            emac0@0 {
                allwinner,pins = "PD0", "PD1", "PD2", "PD3", "PD4", "PD5", "PD7", "PD8", "PD9", "PD10", "PD12", "PD13", "PD15", "PD16", "PD17";
                allwinner,function = "emac";
                allwinner,drive = <0x00000003>;
                allwinner,pull = <0x00000000>;
            };
            uart0@0 {
                pins = "PB8", "PB9";
                function = "uart0";
                bias-pull-up;
                linux,phandle = <0x00000009>;
                phandle = <0x00000009>;
            };
            mmc0@0 {
                pins = "PF0", "PF1", "PF2", "PF3", "PF4", "PF5";
                function = "mmc0";
                drive-strength = <0x0000001e>;
                bias-pull-up;
                linux,phandle = <0x00000003>;
                phandle = <0x00000003>;
            };
            spi0 {
                pins = "PC0", "PC1", "PC2", "PC3";
                function = "spi0";
                linux,phandle = <0x0000000a>;
                phandle = <0x0000000a>;
            };
            ahci_pwr_pin@0 {
                allwinner,pins = "PB8";
                allwinner,function = "gpio_out";
                allwinner,drive = <0x00000000>;
                allwinner,pull = <0x00000000>;
                linux,phandle = <0x0000000c>;
                phandle = <0x0000000c>;
            };
            usb0_vbus_pin@0 {
                allwinner,pins = "PB9";
                allwinner,function = "gpio_out";
                allwinner,drive = <0x00000000>;
                allwinner,pull = <0x00000000>;
                linux,phandle = <0x0000000d>;
                phandle = <0x0000000d>;
            };
            usb1_vbus_pin@0 {
                allwinner,pins = "PH6";
                allwinner,function = "gpio_out";
                allwinner,drive = <0x00000000>;
                allwinner,pull = <0x00000000>;
                linux,phandle = <0x0000000e>;
                phandle = <0x0000000e>;
            };
            usb2_vbus_pin@0 {
                allwinner,pins = "PH3";
                allwinner,function = "gpio_out";
                allwinner,drive = <0x00000000>;
                allwinner,pull = <0x00000000>;
                linux,phandle = <0x0000000f>;
                phandle = <0x0000000f>;
            };
        };
        timer@01c20c00 {
            compatible = "allwinner,sun4i-a10-timer";
            reg = <0x01c20c00 0x000000a0>;
            interrupts = <0x00000000 0x00000012 0x00000004 0x00000000 0x00000013 0x00000004>;
            clocks = <0x00000007>;
        };
        watchdog@01c20ca0 {
            compatible = "allwinner,sun6i-a31-wdt";
            reg = <0x01c20ca0 0x00000020>;
            interrupts = <0x00000000 0x00000019 0x00000004>;
        };
        serial@01c28000 {
            compatible = "snps,dw-apb-uart";
            reg = <0x01c28000 0x00000400>;
            interrupts = <0x00000000 0x00000000 0x00000004>;
            reg-shift = <0x00000002>;
            reg-io-width = <0x00000004>;
            clocks = <0x00000002 0x00000028>;
            resets = <0x00000002 0x00000031>;
            status = "okay";
            pinctrl-0 = <0x00000009>;
            pinctrl-names = "default";
        };
        serial@01c28400 {
            compatible = "snps,dw-apb-uart";
            reg = <0x01c28400 0x00000400>;
            interrupts = <0x00000000 0x00000001 0x00000004>;
            reg-shift = <0x00000002>;
            reg-io-width = <0x00000004>;
            clocks = <0x00000002 0x00000029>;
            resets = <0x00000002 0x00000032>;
            status = "disabled";
        };
        serial@01c28800 {
            compatible = "snps,dw-apb-uart";
            reg = <0x01c28800 0x00000400>;
            interrupts = <0x00000000 0x00000002 0x00000004>;
            reg-shift = <0x00000002>;
            reg-io-width = <0x00000004>;
            clocks = <0x00000002 0x0000002a>;
            resets = <0x00000002 0x00000033>;
            status = "disabled";
        };
        spi@1c68000 {
            compatible = "allwinner,sun8i-h3-spi";
            reg = <0x01c68000 0x00001000>;
            interrupts = <0x00000000 0x00000041 0x00000004>;
            clocks = <0x00000002 0x0000001c 0x00000002 0x00000037>;
            clock-names = "ahb", "mod";
            pinctrl-names = "default";
            pinctrl-0 = <0x0000000a>;
            resets = <0x00000002 0x0000000f>;
            status = "okay";
            #address-cells = <0x00000001>;
            #size-cells = <0x00000000>;
        };
        ethernet@1c30000 {
            compatible = "allwinner,sun8i-h3-emac";
            reg = <0x01c30000 0x00000104 0x01c00030 0x00000004>;
            reg-names = "emac", "syscon";
            interrupts = <0x00000000 0x00000052 0x00000004>;
            resets = <0x00000002 0x0000000c 0x00000002 0x00000027>;
            reset-names = "ahb", "ephy";
            clocks = <0x00000002 0x0000001a 0x00000002 0x0000002b>;
            clock-names = "ahb", "ephy";
            #address-cells = <0x00000001>;
            #size-cells = <0x00000000>;
            status = "okay";
            phy = <0x0000000b>;
            phy-mode = "mii";
            allwinner,use-internal-phy;
            allwinner,leds-active-low;
            ethernet-phy@0 {
                reg = <0x00000001>;
                linux,phandle = <0x0000000b>;
                phandle = <0x0000000b>;
            };
        };
        interrupt-controller@01c81000 {
            compatible = "arm,cortex-a7-gic", "arm,cortex-a15-gic";
            reg = <0x01c81000 0x00001000 0x01c82000 0x00001000 0x01c84000 0x00002000 0x01c86000 0x00002000>;
            interrupt-controller;
            #interrupt-cells = <0x00000003>;
            interrupts = <0x00000001 0x00000009 0x00000f04>;
            linux,phandle = <0x00000001>;
            phandle = <0x00000001>;
        };
    };
    ahci-5v {
        compatible = "regulator-fixed";
        pinctrl-names = "default";
        pinctrl-0 = <0x0000000c>;
        regulator-name = "ahci-5v";
        regulator-min-microvolt = <0x004c4b40>;
        regulator-max-microvolt = <0x004c4b40>;
        regulator-boot-on;
        enable-active-high;
        gpio = <0x00000006 0x00000001 0x00000008 0x00000000>;
        status = "disabled";
    };
    usb0-vbus {
        compatible = "regulator-fixed";
        pinctrl-names = "default";
        pinctrl-0 = <0x0000000d>;
        regulator-name = "usb0-vbus";
        regulator-min-microvolt = <0x004c4b40>;
        regulator-max-microvolt = <0x004c4b40>;
        enable-active-high;
        gpio = <0x00000006 0x00000001 0x00000009 0x00000000>;
        status = "disabled";
    };
    usb1-vbus {
        compatible = "regulator-fixed";
        pinctrl-names = "default";
        pinctrl-0 = <0x0000000e>;
        regulator-name = "usb1-vbus";
        regulator-min-microvolt = <0x004c4b40>;
        regulator-max-microvolt = <0x004c4b40>;
        regulator-boot-on;
        enable-active-high;
        gpio = <0x00000006 0x00000007 0x00000006 0x00000000>;
        status = "disabled";
    };
    usb2-vbus {
        compatible = "regulator-fixed";
        pinctrl-names = "default";
        pinctrl-0 = <0x0000000f>;
        regulator-name = "usb2-vbus";
        regulator-min-microvolt = <0x004c4b40>;
        regulator-max-microvolt = <0x004c4b40>;
        regulator-boot-on;
        enable-active-high;
        gpio = <0x00000006 0x00000007 0x00000003 0x00000000>;
        status = "disabled";
    };
    vcc3v0 {
        compatible = "regulator-fixed";
        regulator-name = "vcc3v0";
        regulator-min-microvolt = <0x002dc6c0>;
        regulator-max-microvolt = <0x002dc6c0>;
    };
    vcc3v3 {
        compatible = "regulator-fixed";
        regulator-name = "vcc3v3";
        regulator-min-microvolt = <0x00325aa0>;
        regulator-max-microvolt = <0x00325aa0>;
        linux,phandle = <0x00000004>;
        phandle = <0x00000004>;
    };
    vcc5v0 {
        compatible = "regulator-fixed";
        regulator-name = "vcc5v0";
        regulator-min-microvolt = <0x004c4b40>;
        regulator-max-microvolt = <0x004c4b40>;
    };
    binman {
        filename = "u-boot-sunxi-with-spl.bin";
        pad-byte = <0x000000ff>;
        blob {
            filename = "spl/sunxi-spl.bin";
        };
        u-boot-img {
            pos = <0x00008000>;
        };
    };
    aliases {
        serial0 = "/soc/serial@01c28000";
        ethernet0 = "/soc/ethernet@1c30000";
        spi0 = "/soc/spi@1c68000";
    };
    chosen {
        stdout-path = "serial0:115200n8";
    };
};

看了下这个dtb应该是u-boot的dtb, 不是linux的, 根据binwalk的信息, 跳过u-boot部分重新扫描:

➜  qlnk4105 dd if=dump.bin of=1.dtb bs=1114112 skip=1
14+1 records in
14+1 records out
15663104 bytes (16 MB, 15 MiB) copied, 0.0180448 s, 868 MB/s
➜  qlnk4105 fdtdump -s 1.dtb

**** fdtdump is a low-level debugging tool, not meant for general use.
**** If you want to decompile a dtb, you probably want
****     dtc -I dtb -O dts <filename>

1.dtb: found fdt at offset 0
/dts-v1/;
// magic:               0xd00dfeed
// totalsize:           0x2e6e (11886)
// off_dt_struct:       0x38
// off_dt_strings:      0x2adc
// off_mem_rsvmap:      0x28
// version:             17
// last_comp_version:   16
// boot_cpuid_phys:     0x0
// size_dt_strings:     0x392
// size_dt_struct:      0x2aa4

/ {
    #address-cells = <0x00000001>;
    #size-cells = <0x00000001>;
    interrupt-parent = <0x00000001>;
    model = "Lichee Pi Zero";
    compatible = "licheepi,licheepi-zero", "allwinner,sun8i-v3s";
    chosen {
        #address-cells = <0x00000001>;
        #size-cells = <0x00000001>;
        ranges;
        stdout-path = "serial0:115200n8";
        framebuffer@0 {
            compatible = "allwinner,simple-framebuffer", "simple-framebuffer";
            allwinner,pipeline = "de0-lcd0";
            clocks = <0x00000002 0x00000021 0x00000003 0x00000000 0x00000003 0x00000006 0x00000002 0x00000040>;
            status = "disabled";
        };
    };
    cpus {
        #address-cells = <0x00000001>;
        #size-cells = <0x00000000>;
        cpu@0 {
            compatible = "arm,cortex-a7";
            device_type = "cpu";
            reg = <0x00000000>;
            clocks = <0x00000002 0x0000000e>;
        };
    };
    display-engine {
        compatible = "allwinner,sun8i-v3s-display-engine";
        allwinner,pipelines = <0x00000004>;
        status = "disabled";
    };
    timer {
        compatible = "arm,armv7-timer";
        interrupts = <0x00000001 0x0000000d 0x00000f08 0x00000001 0x0000000e 0x00000f08 0x00000001 0x0000000b 0x00000f08 0x00000001 0x0000000a 0x00000f08>;
    };
    clocks {
        #address-cells = <0x00000001>;
        #size-cells = <0x00000001>;
        ranges;
        osc24M_clk {
            #clock-cells = <0x00000000>;
            compatible = "fixed-clock";
            clock-frequency = <0x016e3600>;
            clock-output-names = "osc24M";
            linux,phandle = <0x0000000c>;
            phandle = <0x0000000c>;
        };
        osc32k_clk {
            #clock-cells = <0x00000000>;
            compatible = "fixed-clock";
            clock-frequency = <0x00008000>;
            clock-output-names = "osc32k";
            linux,phandle = <0x0000000d>;
            phandle = <0x0000000d>;
        };
    };
    soc {
        compatible = "simple-bus";
        #address-cells = <0x00000001>;
        #size-cells = <0x00000001>;
        ranges;
        clock@1000000 {
            compatible = "allwinner,sun8i-v3s-de2-clk";
            reg = <0x01000000 0x00100000>;
            clocks = <0x00000002 0x0000003f 0x00000002 0x00000023>;
            clock-names = "mod", "bus";
            resets = <0x00000002 0x00000022>;
            #clock-cells = <0x00000001>;
            #reset-cells = <0x00000001>;
            linux,phandle = <0x00000003>;
            phandle = <0x00000003>;
        };
        mixer@1100000 {
            compatible = "allwinner,sun8i-v3s-de2-mixer";
            reg = <0x01100000 0x00100000>;
            clocks = <0x00000003 0x00000000 0x00000003 0x00000006>;
            clock-names = "bus", "mod";
            resets = <0x00000003 0x00000000>;
            assigned-clocks = <0x00000003 0x00000006>;
            assigned-clock-rates = <0x08f0d180>;
            linux,phandle = <0x00000004>;
            phandle = <0x00000004>;
            ports {
                #address-cells = <0x00000001>;
                #size-cells = <0x00000000>;
                port@1 {
                    #address-cells = <0x00000001>;
                    #size-cells = <0x00000000>;
                    reg = <0x00000001>;
                    endpoint@0 {
                        reg = <0x00000000>;
                        remote-endpoint = <0x00000005>;
                        linux,phandle = <0x00000006>;
                        phandle = <0x00000006>;
                    };
                };
            };
        };
        syscon@1c00000 {
            compatible = "allwinner,sun8i-v3s-system-controller", "syscon";
            reg = <0x01c00000 0x00001000>;
            linux,phandle = <0x00000012>;
            phandle = <0x00000012>;
        };
        lcd-controller@1c0c000 {
            compatible = "allwinner,sun8i-v3s-tcon";
            reg = <0x01c0c000 0x00001000>;
            interrupts = <0x00000000 0x00000056 0x00000004>;
            clocks = <0x00000002 0x00000021 0x00000002 0x00000040>;
            clock-names = "ahb", "tcon-ch0";
            clock-output-names = "tcon-pixel-clock";
            resets = <0x00000002 0x0000001b>;
            reset-names = "lcd";
            status = "disabled";
            ports {
                #address-cells = <0x00000001>;
                #size-cells = <0x00000000>;
                port@0 {
                    #address-cells = <0x00000001>;
                    #size-cells = <0x00000000>;
                    reg = <0x00000000>;
                    endpoint@0 {
                        reg = <0x00000000>;
                        remote-endpoint = <0x00000006>;
                        linux,phandle = <0x00000005>;
                        phandle = <0x00000005>;
                    };
                };
                port@1 {
                    #address-cells = <0x00000001>;
                    #size-cells = <0x00000000>;
                    reg = <0x00000001>;
                };
            };
        };
        dma-controller@01c02000 {
            compatible = "allwinner,sun8i-v3s-dma";
            reg = <0x01c02000 0x00001000>;
            interrupts = <0x00000000 0x00000032 0x00000004>;
            clocks = <0x00000002 0x00000015>;
            resets = <0x00000002 0x00000006>;
            #dma-cells = <0x00000001>;
            linux,phandle = <0x0000000e>;
            phandle = <0x0000000e>;
        };
        mmc@01c0f000 {
            compatible = "allwinner,sun7i-a20-mmc";
            reg = <0x01c0f000 0x00001000>;
            clocks = <0x00000002 0x00000016 0x00000002 0x0000002d 0x00000002 0x0000002f 0x00000002 0x0000002e>;
            clock-names = "ahb", "mmc", "output", "sample";
            resets = <0x00000002 0x00000007>;
            reset-names = "ahb";
            interrupts = <0x00000000 0x0000003c 0x00000004>;
            status = "okay";
            #address-cells = <0x00000001>;
            #size-cells = <0x00000000>;
            pinctrl-0 = <0x00000007>;
            pinctrl-names = "default";
            broken-cd;
            bus-width = <0x00000004>;
            vmmc-supply = <0x00000008>;
        };
        mmc@01c10000 {
            compatible = "allwinner,sun7i-a20-mmc";
            reg = <0x01c10000 0x00001000>;
            clocks = <0x00000002 0x00000017 0x00000002 0x00000030 0x00000002 0x00000032 0x00000002 0x00000031>;
            clock-names = "ahb", "mmc", "output", "sample";
            resets = <0x00000002 0x00000008>;
            reset-names = "ahb";
            interrupts = <0x00000000 0x0000003d 0x00000004>;
            pinctrl-names = "default";
            pinctrl-0 = <0x00000009>;
            status = "disabled";
            #address-cells = <0x00000001>;
            #size-cells = <0x00000000>;
        };
        mmc@01c11000 {
            compatible = "allwinner,sun7i-a20-mmc";
            reg = <0x01c11000 0x00001000>;
            clocks = <0x00000002 0x00000018 0x00000002 0x00000033 0x00000002 0x00000035 0x00000002 0x00000034>;
            clock-names = "ahb", "mmc", "output", "sample";
            resets = <0x00000002 0x00000009>;
            reset-names = "ahb";
            interrupts = <0x00000000 0x0000003e 0x00000004>;
            status = "disabled";
            #address-cells = <0x00000001>;
            #size-cells = <0x00000000>;
        };
        usb@01c19000 {
            compatible = "allwinner,sun8i-h3-musb";
            reg = <0x01c19000 0x00000400>;
            clocks = <0x00000002 0x0000001d>;
            resets = <0x00000002 0x00000011>;
            interrupts = <0x00000000 0x00000047 0x00000004>;
            interrupt-names = "mc";
            phys = <0x0000000a 0x00000000>;
            phy-names = "usb";
            extcon = <0x0000000a 0x00000000>;
            status = "okay";
            dr_mode = "otg";
        };
        phy@01c19400 {
            compatible = "allwinner,sun8i-v3s-usb-phy";
            reg = <0x01c19400 0x0000002c 0x01c1a800 0x00000004>;
            reg-names = "phy_ctrl", "pmu0";
            clocks = <0x00000002 0x00000038>;
            clock-names = "usb0_phy";
            resets = <0x00000002 0x00000000>;
            reset-names = "usb0_reset";
            status = "okay";
            #phy-cells = <0x00000001>;
            usb0_id_det-gpio = <0x0000000b 0x00000005 0x00000006 0x00000000>;
            linux,phandle = <0x0000000a>;
            phandle = <0x0000000a>;
        };
        usb@01c1a000 {
            compatible = "allwinner,sun8i-v3s-ehci", "generic-ehci";
            reg = <0x01c1a000 0x00000100>;
            interrupts = <0x00000000 0x00000048 0x00000004>;
            clocks = <0x00000002 0x0000001e 0x00000002 0x0000001f>;
            resets = <0x00000002 0x00000012 0x00000002 0x00000016>;
            status = "okay";
        };
        usb@01c1a400 {
            compatible = "allwinner,sun8i-v3s-ohci", "generic-ohci";
            reg = <0x01c1a400 0x00000100>;
            interrupts = <0x00000000 0x00000049 0x00000004>;
            clocks = <0x00000002 0x0000001e 0x00000002 0x0000001f 0x00000002 0x00000039>;
            resets = <0x00000002 0x00000012 0x00000002 0x00000016>;
            status = "okay";
        };
        clock@01c20000 {
            compatible = "allwinner,sun8i-v3s-ccu";
            reg = <0x01c20000 0x00000400>;
            clocks = <0x0000000c 0x0000000d>;
            clock-names = "hosc", "losc";
            #clock-cells = <0x00000001>;
            #reset-cells = <0x00000001>;
            linux,phandle = <0x00000002>;
            phandle = <0x00000002>;
        };
        rtc@01c20400 {
            compatible = "allwinner,sun6i-a31-rtc";
            reg = <0x01c20400 0x00000054>;
            interrupts = <0x00000000 0x00000028 0x00000004 0x00000000 0x00000029 0x00000004>;
        };
        pinctrl@01c20800 {
            compatible = "allwinner,sun8i-v3s-pinctrl";
            reg = <0x01c20800 0x00000400>;
            interrupts = <0x00000000 0x0000000f 0x00000004 0x00000000 0x00000011 0x00000004>;
            clocks = <0x00000002 0x00000025 0x0000000c 0x0000000d>;
            clock-names = "apb", "hosc", "losc";
            gpio-controller;
            #gpio-cells = <0x00000003>;
            interrupt-controller;
            #interrupt-cells = <0x00000003>;
            linux,phandle = <0x0000000b>;
            phandle = <0x0000000b>;
            i2c0 {
                pins = "PB6", "PB7";
                function = "i2c0";
                linux,phandle = <0x00000011>;
                phandle = <0x00000011>;
            };
            pwm0 {
                pins = "PB4";
                function = "pwm0";
            };
            uart0@0 {
                pins = "PB8", "PB9";
                function = "uart0";
                linux,phandle = <0x00000010>;
                phandle = <0x00000010>;
            };
            lcd-rgb666-pe {
                pins = "PE0", "PE1", "PE2", "PE3", "PE4", "PE5", "PE6", "PE7", "PE8", "PE9", "PE10", "PE11", "PE12", "PE13", "PE14", "PE15", "PE16", "PE17", "PE18", "PE19", "PE23", "PE24";
                function = "lcd";
            };
            mmc0@0 {
                pins = "PF0", "PF1", "PF2", "PF3", "PF4", "PF5";
                function = "mmc0";
                drive-strength = <0x0000001e>;
                bias-pull-up;
                linux,phandle = <0x00000007>;
                phandle = <0x00000007>;
            };
            mmc1 {
                pins = "PG0", "PG1", "PG2", "PG3", "PG4", "PG5";
                function = "mmc1";
                drive-strength = <0x0000001e>;
                bias-pull-up;
                linux,phandle = <0x00000009>;
                phandle = <0x00000009>;
            };
            spi0 {
                pins = "PC0", "PC1", "PC2", "PC3";
                function = "spi0";
                linux,phandle = <0x00000014>;
                phandle = <0x00000014>;
            };
        };
        timer@01c20c00 {
            compatible = "allwinner,sun4i-a10-timer";
            reg = <0x01c20c00 0x000000a0>;
            interrupts = <0x00000000 0x00000012 0x00000004 0x00000000 0x00000013 0x00000004>;
            clocks = <0x0000000c>;
        };
        watchdog@01c20ca0 {
            compatible = "allwinner,sun6i-a31-wdt";
            reg = <0x01c20ca0 0x00000020>;
            interrupts = <0x00000000 0x00000019 0x00000004>;
        };
        pwm@1c21400 {
            compatible = "allwinner,sun8i-v3s-pwm", "allwinner,sun7i-a20-pwm";
            reg = <0x01c21400 0x00000400>;
            clocks = <0x0000000c>;
            #pwm-cells = <0x00000003>;
            status = "disabled";
        };
        lradc@1c22800 {
            compatible = "allwinner,sun4i-a10-lradc-keys";
            reg = <0x01c22800 0x00000400>;
            interrupts = <0x00000000 0x0000001e 0x00000004>;
            status = "disabled";
        };
        codec@01c22c00 {
            #sound-dai-cells = <0x00000000>;
            compatible = "allwinner,sun8i-v3s-codec";
            reg = <0x01c22c00 0x00000400>;
            interrupts = <0x00000000 0x0000001d 0x00000004>;
            clocks = <0x00000002 0x00000024 0x00000002 0x00000046>;
            clock-names = "apb", "codec";
            resets = <0x00000002 0x00000028>;
            dmas = <0x0000000e 0x0000000f 0x0000000e 0x0000000f>;
            dma-names = "rx", "tx";
            allwinner,codec-analog-controls = <0x0000000f>;
            status = "disabled";
        };
        codec-analog@01c23000 {
            compatible = "allwinner,sun8i-v3s-codec-analog";
            reg = <0x01c23000 0x00000004>;
            linux,phandle = <0x0000000f>;
            phandle = <0x0000000f>;
        };
        serial@01c28000 {
            compatible = "snps,dw-apb-uart";
            reg = <0x01c28000 0x00000400>;
            interrupts = <0x00000000 0x00000000 0x00000004>;
            reg-shift = <0x00000002>;
            reg-io-width = <0x00000004>;
            clocks = <0x00000002 0x00000028>;
            resets = <0x00000002 0x00000031>;
            status = "okay";
            pinctrl-0 = <0x00000010>;
            pinctrl-names = "default";
        };
        serial@01c28400 {
            compatible = "snps,dw-apb-uart";
            reg = <0x01c28400 0x00000400>;
            interrupts = <0x00000000 0x00000001 0x00000004>;
            reg-shift = <0x00000002>;
            reg-io-width = <0x00000004>;
            clocks = <0x00000002 0x00000029>;
            resets = <0x00000002 0x00000032>;
            status = "disabled";
        };
        serial@01c28800 {
            compatible = "snps,dw-apb-uart";
            reg = <0x01c28800 0x00000400>;
            interrupts = <0x00000000 0x00000002 0x00000004>;
            reg-shift = <0x00000002>;
            reg-io-width = <0x00000004>;
            clocks = <0x00000002 0x0000002a>;
            resets = <0x00000002 0x00000033>;
            status = "disabled";
        };
        i2c@01c2ac00 {
            compatible = "allwinner,sun6i-a31-i2c";
            reg = <0x01c2ac00 0x00000400>;
            interrupts = <0x00000000 0x00000006 0x00000004>;
            clocks = <0x00000002 0x00000026>;
            resets = <0x00000002 0x0000002e>;
            pinctrl-names = "default";
            pinctrl-0 = <0x00000011>;
            status = "okay";
            #address-cells = <0x00000001>;
            #size-cells = <0x00000000>;
            ns2009@48 {
                compatible = "nsiway,ns2009";
                reg = <0x00000048>;
            };
        };
        i2c@01c2b000 {
            compatible = "allwinner,sun6i-a31-i2c";
            reg = <0x01c2b000 0x00000400>;
            interrupts = <0x00000000 0x00000007 0x00000004>;
            clocks = <0x00000002 0x00000027>;
            resets = <0x00000002 0x0000002f>;
            status = "disabled";
            #address-cells = <0x00000001>;
            #size-cells = <0x00000000>;
        };
        ethernet@1c30000 {
            compatible = "allwinner,sun8i-v3s-emac";
            syscon = <0x00000012>;
            reg = <0x01c30000 0x00010000>;
            interrupts = <0x00000000 0x00000052 0x00000004>;
            interrupt-names = "macirq";
            resets = <0x00000002 0x0000000c>;
            reset-names = "stmmaceth";
            clocks = <0x00000002 0x0000001a>;
            clock-names = "stmmaceth";
            phy-handle = <0x00000013>;
            phy-mode = "mii";
            #address-cells = <0x00000001>;
            #size-cells = <0x00000000>;
            status = "disabled";
            mdio {
                #address-cells = <0x00000001>;
                #size-cells = <0x00000000>;
                ethernet-phy@1 {
                    compatible = "ethernet-phy-ieee802.3-c22";
                    reg = <0x00000001>;
                    clocks = <0x00000002 0x0000002b>;
                    resets = <0x00000002 0x00000027>;
                    phy-is-integrated;
                    linux,phandle = <0x00000013>;
                    phandle = <0x00000013>;
                };
            };
        };
        spi@1c68000 {
            compatible = "allwinner,sun8i-h3-spi";
            reg = <0x01c68000 0x00001000>;
            interrupts = <0x00000000 0x00000041 0x00000004>;
            clocks = <0x00000002 0x0000001c 0x00000002 0x00000037>;
            clock-names = "ahb", "mod";
            pinctrl-names = "default";
            pinctrl-0 = <0x00000014>;
            resets = <0x00000002 0x0000000f>;
            status = "okay";
            #address-cells = <0x00000001>;
            #size-cells = <0x00000000>;
            mx25l25635e@0 {
                compatible = "jedec,spi-nor";
                reg = <0x00000000>;
                spi-max-frequency = <0x02faf080>;
                #address-cells = <0x00000001>;
                #size-cells = <0x00000001>;
                m25p,fast-read;
                m25p,chunked-io = <0x00000020>;
                partition@0 {
                    label = "u-boot";
                    reg = <0x00000000 0x00100000>;
                    read-only;
                };
                partition@100000 {
                    label = "u-boot-env";
                    reg = <0x00100000 0x00010000>;
                };
                partition@110000 {
                    label = "dtb";
                    reg = <0x00110000 0x00010000>;
                    read-only;
                };
                partition@120000 {
                    label = "factory";
                    reg = <0x01220000 0x00010000>;
                    read-only;
                };
                partition@130000 {
                    label = "misc";
                    reg = <0x00130000 0x00010000>;
                    read-only;
                };
                partition@140000 {
                    label = "firmware";
                    reg = <0x00140000 0x00ec0000>;
                };
            };
        };
        interrupt-controller@01c81000 {
            compatible = "arm,cortex-a7-gic", "arm,cortex-a15-gic";
            reg = <0x01c81000 0x00001000 0x01c82000 0x00001000 0x01c84000 0x00002000 0x01c86000 0x00002000>;
            interrupt-controller;
            #interrupt-cells = <0x00000003>;
            interrupts = <0x00000001 0x00000009 0x00000f04>;
            linux,phandle = <0x00000001>;
            phandle = <0x00000001>;
        };
    };
    ahci-5v {
        compatible = "regulator-fixed";
        regulator-name = "ahci-5v";
        regulator-min-microvolt = <0x004c4b40>;
        regulator-max-microvolt = <0x004c4b40>;
        regulator-boot-on;
        enable-active-high;
        gpio = <0x0000000b 0x00000001 0x00000008 0x00000000>;
        status = "disabled";
    };
    usb0-vbus {
        compatible = "regulator-fixed";
        regulator-name = "usb0-vbus";
        regulator-min-microvolt = <0x004c4b40>;
        regulator-max-microvolt = <0x004c4b40>;
        enable-active-high;
        gpio = <0x0000000b 0x00000001 0x00000009 0x00000000>;
        status = "disabled";
    };
    usb1-vbus {
        compatible = "regulator-fixed";
        regulator-name = "usb1-vbus";
        regulator-min-microvolt = <0x004c4b40>;
        regulator-max-microvolt = <0x004c4b40>;
        regulator-boot-on;
        enable-active-high;
        gpio = <0x0000000b 0x00000007 0x00000006 0x00000000>;
        status = "disabled";
    };
    usb2-vbus {
        compatible = "regulator-fixed";
        regulator-name = "usb2-vbus";
        regulator-min-microvolt = <0x004c4b40>;
        regulator-max-microvolt = <0x004c4b40>;
        regulator-boot-on;
        enable-active-high;
        gpio = <0x0000000b 0x00000007 0x00000003 0x00000000>;
        status = "disabled";
    };
    vcc3v0 {
        compatible = "regulator-fixed";
        regulator-name = "vcc3v0";
        regulator-min-microvolt = <0x002dc6c0>;
        regulator-max-microvolt = <0x002dc6c0>;
    };
    vcc3v3 {
        compatible = "regulator-fixed";
        regulator-name = "vcc3v3";
        regulator-min-microvolt = <0x00325aa0>;
        regulator-max-microvolt = <0x00325aa0>;
        linux,phandle = <0x00000008>;
        phandle = <0x00000008>;
    };
    vcc5v0 {
        compatible = "regulator-fixed";
        regulator-name = "vcc5v0";
        regulator-min-microvolt = <0x004c4b40>;
        regulator-max-microvolt = <0x004c4b40>;
    };
    aliases {
        serial0 = "/soc/serial@01c28000";
    };
    leds {
        compatible = "gpio-leds";
        blue_led {
            label = "licheepi:blue:usr";
            gpios = <0x0000000b 0x00000006 0x00000001 0x00000001>;
        };
        green_led {
            label = "licheepi:green:usr";
            gpios = <0x0000000b 0x00000006 0x00000000 0x00000001>;
            default-state = "on";
        };
        red_led {
            label = "licheepi:red:usr";
            gpios = <0x0000000b 0x00000006 0x00000002 0x00000001>;
        };
    };
};

#5 Re: 全志 SOC » 子午线V3s路由器试玩 » 2021-11-22 09:56:43

jordonwu 说:

看外观是一样的啊 smile

官网上有4107和4106, 这个是4105, 在官网上没有. 差不多的东西.

这个外壳可以在淘宝上买到, 十块以内一个.

#6 全志 SOC » 子午线V3s路由器试玩 » 2021-11-22 08:43:22

qianfan
回复: 26

晕哥最近搞了个活动:

V3s(荔枝派核心板) + 以太网 +  AP6398(2.4/5G)双模路由器,本站(bbs.aw-ol.com)满100分免费赠送一台

https://bbs.aw-ol.com/topic/580

与晕哥搞了个关系拿到了一台, 想着先拆壳看看log信息啥的之后在备份固件做个分析, 没想到root账号没有密码, 直接敲回车就能登录. 先发一个开机的log:

U-Boot SPL 2017.01-rc2-g8851dbc-dirty (Feb 08 2018 - 09:49:31)
DRAM: 64 MiB
Trying to boot from sunxi SPI

U-Boot 2017.01-rc2-g8851dbc-dirty (Feb 08 2018 - 09:49:31 +0800) Allwinner Technology

CPU:   Allwinner V3s (SUN8I 1681)
Model: Lichee Pi Zero
DRAM:  64 MiB
MMC:   SUNXI SD/MMC: 0
SF: Detected w25q128bv with page size 256 Bytes, erase size 4 KiB, total 16 MiB
In:    serial@01c28000
Out:   serial@01c28000
Err:   serial@01c28000


U-Boot 2017.01-rc2-g8851dbc-dirty (Feb 08 2018 - 09:49:31 +0800) Allwinner Technology

CPU:   Allwinner V3s (SUN8I 1681)
Model: Lichee Pi Zero
DRAM:  64 MiB
MMC:   SUNXI SD/MMC: 0
SF: Detected w25q128bv with page size 256 Bytes, erase size 4 KiB, total 16 MiB
In:    serial@01c28000
Out:   serial@01c28000
Err:   serial@01c28000
Net:   phy interface0
eth0: ethernet@1c30000
starting USB...
No controllers found

Please choose the operation:
   4: Boot to normal cli.
   9: Load Boot Loader code then write to Flash via TFTP.                     0
SF: Detected w25q128bv with page size 256 Bytes, erase size 4 KiB, total 16 MiB
device 0 offset 0x140000, size 0x300000
SF: 3145728 bytes @ 0x140000 Read: OK
## Booting kernel from Legacy Image at 41000000 ...
   Image Name:   ARM OpenWrt Linux-4.14.14
   Image Type:   ARM Linux Multi-File Image (lzma compressed)
   Data Size:    1654992 Bytes = 1.6 MiB
   Load Address: 40008000
   Entry Point:  40008000
   Contents:
      Image 0: 1627278 Bytes = 1.6 MiB
      Image 1: 13848 Bytes = 13.5 KiB
      Image 2: 13848 Bytes = 13.5 KiB
   Verifying Checksum ... OK
## Flattened Device Tree from multi component Image at 41000000
   Booting using the fdt at 0x41190af8
   of_flat_tree at 0x41190af8 size 0x00003618
   Uncompressing Multi-File Image ... Decomp 40008000 and 41000050,len 1627278 and 8388608
LZMA: Image address............... 0x41000050
LZMA: Properties address.......... 0x41000050
LZMA: Uncompressed size address... 0x41000055
LZMA: Compressed data address..... 0x4100005d
LZMA: Destination address......... 0x40008000
OK
using: FDT 13848
   Loading Device Tree to 42df9000, end 42dff617 ... OK
## Transferring control to Linux (at address 40008000)...

Starting kernel ...

[    0.000000] Booting Linux on physical CPU 0x0
[    0.000000] Linux version 4.14.14 (Master of Quallink.cn@Quallink.cn) (gcc version 5.4.0 (LEDE GCC 5.4.0 unknown)) #0 SMP Tue Jul 24 07:25:26 2018
[    0.000000] CPU: ARMv7 Processor [410fc075] revision 5 (ARMv7), cr=10c5387d
[    0.000000] CPU: div instructions available: patching division code
[    0.000000] CPU: PIPT / VIPT nonaliasing data cache, VIPT aliasing instruction cache
[    0.000000] OF: fdt: Machine model: QLNK4105
[    0.000000] Memory policy: Data cache writealloc
[    0.000000] random: fast init done
[    0.000000] percpu: Embedded 14 pages/cpu @c3f5f000 s28544 r8192 d20608 u57344
[    0.000000] Built 1 zonelists, mobility grouping on.  Total pages: 16256
[    0.000000] Kernel command line: console=ttyS0,115200 earlyprintk panic=5 rootwait  rootfstype=squashfs,jffs2
[    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: 58256K/65536K available (3347K kernel code, 181K rwdata, 988K rodata, 1024K init, 227K bss, 7280K reserved, 0K cma-reserved, 0K highmem)
[    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]     pkmap   : 0xbfe00000 - 0xc0000000   (   2 MB)
[    0.000000]     modules : 0xbf000000 - 0xbfe00000   (  14 MB)
[    0.000000]       .text : 0xc0008000 - 0xc0444c08   (4340 kB)
[    0.000000]       .init : 0xc0600000 - 0xc0700000   (1024 kB)
[    0.000000]       .data : 0xc0700000 - 0xc072d540   ( 182 kB)
[    0.000000]        .bss : 0xc072d540 - 0xc07663b4   ( 228 kB)
[    0.000000] SLUB: HWalign=64, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
[    0.000000] Hierarchical RCU implementation.
[    0.000000]  RCU restricting CPUs from NR_CPUS=8 to nr_cpu_ids=1.
[    0.000000] RCU: Adjusting geometry for rcu_fanout_leaf=16, nr_cpu_ids=1
[    0.000000] NR_IRQS: 16, nr_irqs: 16, preallocated irqs: 16
[    0.000000] arch_timer: cp15 timer(s) running at 24.00MHz (virt).
[    0.000000] clocksource: arch_sys_counter: mask: 0xffffffffffffff max_cycles: 0x588fe9dc0, max_idle_ns: 440795202592 ns
[    0.000007] sched_clock: 56 bits at 24MHz, resolution 41ns, wraps every 4398046511097ns
[    0.000019] Switching to timer-based delay loop, resolution 41ns
[    0.000217] clocksource: timer: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 79635851949 ns
[    0.000344] Calibrating delay loop (skipped), value calculated using timer frequency.. 48.00 BogoMIPS (lpj=240000)
[    0.000361] pid_max: default: 32768 minimum: 301
[    0.000532] Mount-cache hash table entries: 1024 (order: 0, 4096 bytes)
[    0.000547] Mountpoint-cache hash table entries: 1024 (order: 0, 4096 bytes)
[    0.001099] CPU: Testing write buffer coherency: ok
[    0.001486] /cpus/cpu@0 missing clock-frequency property
[    0.001510] CPU0: thread -1, cpu 0, socket 0, mpidr 80000000
[    0.001922] Setting up static identity map for 0x40100000 - 0x40100060
[    0.002090] Hierarchical SRCU implementation.
[    0.002598] smp: Bringing up secondary CPUs ...
[    0.002612] smp: Brought up 1 node, 1 CPU
[    0.002621] SMP: Total of 1 processors activated (48.00 BogoMIPS).
[    0.002628] CPU: All CPU(s) started in SVC mode.
[    0.006374] VFP support v0.3: implementor 41 architecture 2 part 30 variant 7 rev 5
[    0.006653] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 19112604462750000 ns
[    0.006681] futex hash table entries: 256 (order: 2, 16384 bytes)
[    0.006876] pinctrl core: initialized pinctrl subsystem
[    0.007820] NET: Registered protocol family 16
[    0.008215] DMA: preallocated 256 KiB pool for atomic coherent allocations
[    0.032355] clocksource: Switched to clocksource arch_sys_counter
[    0.033440] NET: Registered protocol family 2
[    0.034124] TCP established hash table entries: 1024 (order: 0, 4096 bytes)
[    0.034156] TCP bind hash table entries: 1024 (order: 1, 8192 bytes)
[    0.034179] TCP: Hash tables configured (established 1024 bind 1024)
[    0.034311] UDP hash table entries: 256 (order: 1, 8192 bytes)
[    0.034359] UDP-Lite hash table entries: 256 (order: 1, 8192 bytes)
[    0.034576] NET: Registered protocol family 1
[    0.036626] No memory allocated for crashlog
[    0.038445] workingset: timestamp_bits=30 max_order=14 bucket_order=0
[    0.042323] squashfs: version 4.0 (2009/01/31) Phillip Lougher
[    0.042536] jffs2: version 2.2 (NAND) (SUMMARY) (LZMA) (RTIME) (CMODE_PRIORITY) (c) 2001-2006 Red Hat, Inc.
[    0.054210] io scheduler noop registered
[    0.054230] io scheduler deadline registered (default)
[    0.054898] sun4i-usb-phy 1c19400.phy: Couldn't request ID GPIO
[    0.058475] sun8i-v3s-pinctrl 1c20800.pinctrl: initialized sunXi PIO driver
[    0.061838] Serial: 8250/16550 driver, 8 ports, IRQ sharing disabled
[    0.063656] console [ttyS0] disabled
[    0.083899] 1c28000.serial: ttyS0 at MMIO 0x1c28000 (irq = 34, base_baud = 1500000) is a U6_16550A
[    0.558671] console [ttyS0] enabled
[    0.577327] m25p80 spi0.0: w25q128 (16384 Kbytes)
[    0.582096] 6 ofpart partitions found on MTD device spi0.0
[    0.587626] Creating 6 MTD partitions on "spi0.0":
[    0.592447] 0x000000000000-0x000000100000 : "u-boot"
[    0.598289] 0x000000100000-0x000000110000 : "u-boot-env"
[    0.604395] 0x000000110000-0x000000120000 : "dtb"
[    0.609760] 0x000000120000-0x000000130000 : "factory"
[    0.615592] 0x000000130000-0x000000140000 : "misc"
[    0.621060] 0x000000140000-0x000001000000 : "firmware"
[    0.655634] 2 uimage-fw partitions found on MTD device firmware
[    0.661581] 0x000000140000-0x0000002d4110 : "kernel"
[    0.667450] 0x0000002d4110-0x000001000000 : "rootfs"
[    0.673169] mtd: device 7 (rootfs) set to be root filesystem
[    0.679936] 1 squashfs-split partitions found on MTD device rootfs
[    0.686235] 0x0000008d0000-0x000001000000 : "rootfs_data"
[    0.693039] libphy: Fixed MDIO Bus: probed
[    0.698302] Read mac from flash cc:4b:73:4f:d5:8a
[    0.703727] dwmac-sun8i 1c30000.ethernet: PTP uses main clock
[    0.709528] dwmac-sun8i 1c30000.ethernet: No regulator found
[    0.715321] dwmac-sun8i 1c30000.ethernet: Will use internal PHY
[    0.721317] Sync mac address to ethernet
[    0.725399] dwmac-sun8i 1c30000.ethernet: Current syscon value is not the default 148000 (expect 38000)
[    0.735181] dwmac-sun8i 1c30000.ethernet: Chain mode enabled
[    0.740845] dwmac-sun8i 1c30000.ethernet: No HW DMA feature register supported
[    0.748177] dwmac-sun8i 1c30000.ethernet: Normal descriptors
[    0.753857] dwmac-sun8i 1c30000.ethernet: RX Checksum Offload Engine supported
[    0.761072] dwmac-sun8i 1c30000.ethernet: COE Type 2
[    0.766043] dwmac-sun8i 1c30000.ethernet: TX Checksum insertion supported
[    0.773027] libphy: stmmac: probed
[    0.779685] sunxi-wdt 1c20ca0.watchdog: Watchdog enabled (timeout=16 sec, nowayout=0)
[    0.842271] sunxi-mmc 1c0f000.mmc: base:0xc48aa000 irq:23
[    0.902254] sunxi-mmc 1c10000.mmc: base:0xc48ae000 irq:24
[    0.909041] NET: Registered protocol family 17
[    0.913699] bridge: filtering via arp/ip/ip6tables is no longer available by default. Update your scripts to load br_netfilter if you need this.
[    0.926679] 8021q: 802.1Q VLAN Support v1.8
[    0.930943] Registering SWP/SWPB emulation handler
[    0.945456] hctosys: unable to open rtc device (rtc0)
[    0.950920] vcc3v0: disabling
[    0.953997] vcc5v0: disabling
[    0.961460] VFS: Mounted root (squashfs filesystem) readonly on device 31:7.
[    0.970921] Freeing unused kernel memory: 1024K
[    1.062638] random: crng init done
[    1.371124] init: Console is alive
[    1.375031] init: - watchdog -
[    2.206732] usbcore: registered new interface driver usbfs
[    2.212457] usbcore: registered new interface driver hub
[    2.217884] usbcore: registered new device driver usb
[    2.228731] ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
[    2.240253] SCSI subsystem initialized
[    2.247986] ehci-platform: EHCI generic platform driver
[    2.253777] ehci-platform 1c1a000.usb: EHCI Host Controller
[    2.259450] ehci-platform 1c1a000.usb: new USB bus registered, assigned bus number 1
[    2.267417] ehci-platform 1c1a000.usb: irq 26, io mem 0x01c1a000
[    2.302304] ehci-platform 1c1a000.usb: USB 2.0 started, EHCI 1.00
[    2.309411] hub 1-0:1.0: USB hub found
[    2.313655] hub 1-0:1.0: 1 port detected
[    2.320115] ohci_hcd: USB 1.1 'Open' Host Controller (OHCI) Driver
[    2.327906] ohci-platform: OHCI generic platform driver
[    2.333663] ohci-platform 1c1a400.usb: Generic Platform OHCI controller
[    2.340321] ohci-platform 1c1a400.usb: new USB bus registered, assigned bus number 2
[    2.348297] ohci-platform 1c1a400.usb: irq 27, io mem 0x01c1a400
[    2.427284] hub 2-0:1.0: USB hub found
[    2.431376] hub 2-0:1.0: 1 port detected
[    2.442064] usbcore: registered new interface driver usb-storage
[    2.449677] Error: Driver 'gpio-keys-polled' is already registered, aborting...
[    2.469209] init: - preinit -
[    2.992758] Generic PHY stmmac-0:01: attached PHY driver [Generic PHY] (mii_bus:phy_addr=stmmac-0:01, irq=POLL)
[    3.004826] dwmac-sun8i 1c30000.ethernet eth0: No MAC Management Counters available
[    3.012571] dwmac-sun8i 1c30000.ethernet eth0: PTP not supported by HW
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
[    5.266313] jffs2: notice: (516) jffs2_build_xattr_subsystem: complete building xattr subsystem, 3 of xdatum (2 unchecked, 1 orphan) and 6 of xref (4 dead, 0 orphan) found.
[    5.283939] mount_root: switching to jffs2 overlay
[    5.293166] overlayfs: upper fs does not support tmpfile.
[    5.304155] urandom-seed: Seeding with /etc/urandom.seed
[    5.385867] procd: - early -
[    5.388883] procd: - watchdog -
[    6.015076] procd: - ubus -
[    6.173229] procd: - init -
Please press Enter to activate this console.
[    6.420269] usb_phy_generic usb_phy_generic.0.auto: usb_phy_generic.0.auto supply vcc not found, using dummy regulator
[    6.431738] musb-hdrc musb-hdrc.1.auto: MUSB HDRC host driver
[    6.437576] musb-hdrc musb-hdrc.1.auto: new USB bus registered, assigned bus number 3
[    6.450951] hub 3-0:1.0: USB hub found
[    6.462700] hub 3-0:1.0: 1 port detected
[    6.488877] Bridge firewalling registered
[    6.502035] usbcore: registered new interface driver cdc_wdm
[    6.523336] Loading modules backported from Linux version wt-2017-11-01-0-gfe248fc2c180
[    6.531346] Backport generated by backports.git v4.14-rc2-1-31-g86cf0e5d
[    6.558713] Error: Driver 'gpio-keys-polled' is already registered, aborting...
[    6.585970] nf_conntrack version 0.5.0 (1024 buckets, 4096 max)
[    6.689625] Netfilter messages via NETLINK v0.30.
[    6.709565] usbcore: registered new interface driver r8152
[    6.751468] usbcore: registered new interface driver usbserial
[    6.757577] usbcore: registered new interface driver usbserial_generic
[    6.764220] usbserial: USB Serial support registered for generic
[    6.838118] xt_time: kernel timezone is -0000
[    6.880884] Ebtables v2.0 registered
[    6.887227] Error: Driver 'gpio-keys-polled' is already registered, aborting...
[    6.898288] ip_tables: (C) 2000-2006 Netfilter Core Team
[    6.931653] PPP generic driver version 2.4.2
[    6.939553] NET: Registered protocol family 24
[    6.947830] usbcore: registered new interface driver qmi_wwan
[    7.046384] dhd_module_init: in Dongle Host Driver, version 1.579.77.41.6 (r)
[    7.053673] ======== dhd_wlan_init_plat_data ========
[    7.058769] dhd_wlan_init_gpio: oob_irq=43, oob_irq_flags=0x414
[    7.064717] ======== dhd_wlan_init_plat_data ========
[    7.069780] dhd_wlan_init_gpio: oob_irq=42, oob_irq_flags=0x414
[    7.075711] dhd_wifi_platform_load: Enter
[    7.079753] Power-up adapter 'DHD adapter 0'
[    7.084154] wifi_platform_set_power = 1
[    7.087987] ======== PULL WL_REG_ON(136) HIGH! ========
[    7.612241] wifi_platform_bus_enumerate device present 1
[    7.837412] mmc1: queuing unknown CIS tuple 0x80 (2 bytes)
[    7.844454] mmc1: queuing unknown CIS tuple 0x80 (3 bytes)
[    7.851449] mmc1: queuing unknown CIS tuple 0x80 (3 bytes)
[    7.859677] mmc1: queuing unknown CIS tuple 0x80 (7 bytes)
[    7.868456] mmc1: queuing unknown CIS tuple 0x81 (9 bytes)
[    7.925793] mmc1: new high speed SDIO card at address 0001
[    7.949656] Power-up adapter 'DHD adapter 1'
[    7.955738] wifi_platform_set_power = 1
[    7.959587] ======== PULL WL_REG_ON(140) HIGH! ========
[    8.482236] wifi_platform_bus_enumerate device present 1
[    8.503827] bcmsdh_register: register client driver
[    8.509626] bcmsdh_sdmmc: bcmsdh_sdmmc_probe Enter c28ad800 and bf4eeb20 ven 02d0, device 4359, func 1
[    8.519712] bcmsdh_sdmmc: bcmsdh_sdmmc_probe Enter c28ad600 and bf4eeb20 ven 02d0, device 4359, func 2
[    8.529113] found adapter info 'DHD adapter 0' and c2897080
[    8.534707] func c28ad600 ,adp c2897080,bus num (host idx)=1, slot num (rca)=1
[    8.542061] sdioh_attach: set sd_f2_blocksize 256
[    8.546973] sdioh_attach: sd clock rate = 0
[    8.551346] dhdsdio_probe : no mutex held. set lock
[    8.556385] F1 signature read @0x18000000=0x17294359
[    8.563866] F1 signature OK, socitype:0x1 chip:0x4359 rev:0x9 pkg:0x2
[    8.570782] DHD: dongle ram size is set to 917504(orig 917504) at 0x160000
[    8.577788] dhd_conf_set_chiprev: chip=0x4359, chiprev=9
[    8.583135] Finale to /lib/firmware/brcm/fw_bcm4359c0_ag.bin
[    8.588868] Final interface wlan0
[    8.592797] CFG80211-ERROR) wl_setup_wiphy :
[    8.592805] Registering Vendor80211
[    8.612456] wl_escan_attach: Enter c31ef800 and c2a880a4
[    8.618008] wl_escan_init: Enter c2b00000
[    8.632505] wl_create_event_handler(): thread:dhd_escan0:354 started
[    8.638960] tsk Enter, tsk = 0xc2b40148
[    8.643024] dhd_init_logstrs_array: Failed to open the file /tmp/logstrs.bin
[    8.655201] dhd_attach(): thread:dhd_dog0:357 started
[    8.665740] dhd_attach(): thread:dhd_dpc0:359 started
[    8.699836] dhd_attach(): thread:dhd_rxf0:35a started
[    8.705024] dhd_deferred_work_init: work queue initialized
[    8.710619] dhd_bus_set_default_min_res_mask: Unhandled chip id
[    8.716883] sdioh_cis_read: func_cis_ptr[0]=0x10ac
[    8.735792] Dongle Host Driver, version 1.579.77.41.6 (r)
[    8.741991] wl_ext_iapsta_attach_netdev: bssidx=0
[    8.746824] Register interface [wlan0]  MAC: cc:4b:73:4f:d5:8a and fw 1
[    8.746824]
[    8.754939] dhdsdio_probe : the lock is released.
[    8.759820] dhd_module_init: Exit err=0
[    8.805670] Error: Driver 'gpio-keys-polled' is already registered, aborting...
[    8.834352] usbcore: registered new interface driver option
[    8.840037] usbserial: USB Serial support registered for GSM modem (1-port)
[    8.868258] Error: Driver 'gpio-keys-polled' is already registered, aborting...
[   13.316963] Generic PHY stmmac-0:01: attached PHY driver [Generic PHY] (mii_bus:phy_addr=stmmac-0:01, irq=POLL)
[   13.329071] dwmac-sun8i 1c30000.ethernet eth0: No MAC Management Counters available
[   13.336850] dwmac-sun8i 1c30000.ethernet eth0: PTP not supported by HW
[   13.417385] br-lan: port 1(eth0) entered blocking state
[   13.422770] br-lan: port 1(eth0) entered disabled state
[   13.428332] device eth0 entered promiscuous mode
[   13.701221] dhd_open: Enter c31ef800
[   13.705027] Finale to /lib/firmware/brcm/fw_bcm4359c0_ag.bin
[   13.743940] dhd_os_open_image: /lib/firmware/brcm/config_4359c0_ag.txt (18 bytes) open success
[   13.782493] dhd_conf_read_sdio_params: dhd_slpauto = 0
[   13.787657] dhd_conf_read_pm_params: PM = 0
[   13.791863] Final fw_path=/lib/firmware/brcm/fw_bcm4359c0_ag.bin
[   13.797983] Final nv_path=/lib/firmware/brcm/nvrma_4359c0_ag.txt
[   13.804010] Final clm_path=/lib/firmware/brcm/clm.blob
[   13.809141] Final conf_path=/lib/firmware/brcm/config_4359c0_ag.txt
[   13.929787] dhd_os_open_image: /lib/firmware/brcm/fw_bcm4359c0_ag.bin (516576 bytes) open success
[   14.651808] dhd_os_open_image: /lib/firmware/brcm/nvrma_4359c0_ag.txt (5802 bytes) open success
[   14.672960] NVRAM version: AP6398SR3_NVRAM_V1.0_20171106.txt
[   14.688193] dhdsdio_write_vars: Download, Upload and compare of NVRAM succeeded.
[   14.859365] dhd_bus_init: enable 0x06, ready 0x06 (waited 0us)
[   14.869022] si_get_pmu_reg_addr: addrRET: 18000670
[   14.879995] bcmsdh_oob_intr_register: HW_OOB irq=43 flags=0x414
[   14.895533] dhd_sync_with_dongle: Enter
[   14.899774] sdpcm_shared address 0x001A568C
[   14.905972] sdpcm_shared address 0x001A568C
[   14.910489] dhd_preinit_ioctls: Set tcpack_sup_mode 1
[   14.915668] dhd_deepsleep: all off ON
[   15.132492] dhd_enable_packet_filter: enter, value = 0
[   15.159728] dhd_apply_default_clm: Ignore clm file /lib/firmware/brcm/clm.blob
[   15.187876] dhd_preinit_ioctls APSTA for P2P failed ret= -5
[   15.210927] Firmware up: op_mode=0x0405, MAC=cc:4b:73:4f:d5:8a
[   15.230844] dhdcdc_set_ioctl: SET PM to 2
[   15.279642] dhd_preinit_ioctls Set scancache failed -23
[   15.335494]   Driver: 1.579.77.41.6 (r)
[   15.335494]   Firmware: wl0: Jul 28 2018 19:45:19 version 9.87.51.11 (r) FWID 01-cd33d333
[   15.335494]   CLM: 9.7.5
[   15.350213] dhd_txglom_enable: enable 0
[   15.354106] dhd_conf_set_txglom_params: txglom_mode=multi-desc, use_rxchain=0
[   15.361233] dhd_conf_set_txglom_params: txglomsize=0, deferred_tx_len=0
[   15.367862] dhd_conf_set_txglom_params: tx_in_rx=1, txinrx_thres=128, dhd_txminmax=-1
[   15.375696] dhd_conf_set_txglom_params: tx_max_offset=0, txctl_tmo_fix=300
[   15.382582] dhd_conf_get_disable_proptx: fw_proptx=0, disable_proptx=1
[   15.496772] dhd_preinit_ioctls: SensorHub diabled 0
[   15.508116] dhd_preinit_ioctls failed to set ShubHub disable
[   15.534160] dhd_ndo_get_version: failed, retcode = -23
[   15.556628] failed to set WNM capabilities
[   15.581462] dhd_conf_set_country: set country CN, revision 38
[   15.595296] Country code: CN (CN/38)
[   15.614036] dhdcdc_set_ioctl: SET PM to 0
[   15.636048] Time taken for FW download and F2 ready is: 1740 msec
[   15.732042] dhd_open: Exit ret=0
[   16.732143] dhd_set_monitor: if 0 val 1851876211,cur   (null)
[   16.803874] dhd_set_monitor: if 0 val 979594359,cur c250a800
[   16.809545] dhd_set_monitor: Mismatched params, return
[   17.014108] dhdcdc_set_ioctl: SET PM to 0
[   17.324127] dhd_set_monitor: if 0 val 3,cur c250a800
[   17.329106] dhd_set_monitor: Mismatched params, return
[   17.531523] CFG80211-ERROR) wl_cfg80211_event :
[   17.531539] ignore event 54, not interested
[   17.541152] CFG80211-ERROR) wl_cfg80211_post_ifcreate :
[   17.541171] mac_ptr:c313cb9e name:(null) role:1 nl80211_iftype:3 00:00:00:00:00:00
[   17.561107] CFG80211-ERROR) wl_cfg80211_post_ifcreate :
[   17.561120] Applying updated mac address to firmware
[   17.571560] wl_ext_iapsta_attach_netdev: bssidx=1
[   17.589309] Register interface [wl0.2]  MAC: cc:4b:73:4f:d5:8a and fw 1
[   17.589309]
[   17.607208] Post ifcreate ops done. Returning
[   18.605153] dhd_set_mac_addr_handler: MACID is overwritten
[   18.647363] wl_notify_connect_status_ap: ** AP/GO Link up event **
[   19.056563] br-lan: port 2(wl0.2) entered blocking state
[   19.061970] br-lan: port 2(wl0.2) entered disabled state
[   19.067772] device wl0.2 entered promiscuous mode
[   19.072614] br-lan: port 2(wl0.2) entered blocking state
[   19.077927] br-lan: port 2(wl0.2) entered forwarding state
[   19.085870] CFG80211-ERROR) wl_cfg80211_scan :
[   19.085891] Enter c29001a0 and c2900bc0 dev c31ef800
[   19.095568] CFG80211-ERROR) __wl_cfg80211_scan :
[   19.095578] Enter wiphy (c29001a0) cfg c2900bc0 NDEV c31ef800
[   19.134304] wl_run_escan: LEGACY_SCAN sync ID: 0, bssidx: 0
[   19.661776] br-lan: port 1(eth0) entered disabled state
[   20.678499] Generic PHY stmmac-0:01: attached PHY driver [Generic PHY] (mii_bus:phy_addr=stmmac-0:01, irq=POLL)
[   20.690624] dwmac-sun8i 1c30000.ethernet eth0: No MAC Management Counters available
[   20.698425] dwmac-sun8i 1c30000.ethernet eth0: PTP not supported by HW
[   67.446545] device mon0 entered promiscuous mode
[   79.938882] CFG80211-ERROR) wl_cfg80211_scan :
[   79.938905] Enter c29001a0 and c2900bc0 dev c31ef800
[   79.948510] CFG80211-ERROR) __wl_cfg80211_scan :
[   79.948518] Enter wiphy (c29001a0) cfg c2900bc0 NDEV c31ef800
[   79.962863] wl_run_escan: LEGACY_SCAN sync ID: 1, bssidx: 0
[  140.769157] CFG80211-ERROR) wl_cfg80211_scan :
[  140.769180] Enter c29001a0 and c2900bc0 dev c31ef800
[  140.778833] CFG80211-ERROR) __wl_cfg80211_scan :
[  140.778841] Enter wiphy (c29001a0) cfg c2900bc0 NDEV c31ef800
[  140.804472] wl_run_escan: LEGACY_SCAN sync ID: 2, bssidx: 0
[  201.611547] CFG80211-ERROR) wl_cfg80211_scan :
[  201.611570] Enter c29001a0 and c2900bc0 dev c31ef800
[  201.621190] CFG80211-ERROR) __wl_cfg80211_scan :
[  201.621198] Enter wiphy (c29001a0) cfg c2900bc0 NDEV c31ef800
[  201.635312] wl_run_escan: LEGACY_SCAN sync ID: 3, bssidx: 0
[  262.440293] CFG80211-ERROR) wl_cfg80211_scan :
[  262.440315] Enter c29001a0 and c2900bc0 dev c31ef800
[  262.449935] CFG80211-ERROR) __wl_cfg80211_scan :
[  262.449943] Enter wiphy (c29001a0) cfg c2900bc0 NDEV c31ef800
[  262.463833] wl_run_escan: LEGACY_SCAN sync ID: 4, bssidx: 0
[  323.278796] CFG80211-ERROR) wl_cfg80211_scan :
[  323.278817] Enter c29001a0 and c2900bc0 dev c31ef800
[  323.288422] CFG80211-ERROR) __wl_cfg80211_scan :
[  323.288431] Enter wiphy (c29001a0) cfg c2900bc0 NDEV c31ef800
[  323.302411] wl_run_escan: LEGACY_SCAN sync ID: 5, bssidx: 0
[  384.112576] CFG80211-ERROR) wl_cfg80211_scan :
[  384.112598] Enter c29001a0 and c2900bc0 dev c31ef800
[  384.122155] CFG80211-ERROR) __wl_cfg80211_scan :
[  384.122162] Enter wiphy (c29001a0) cfg c2900bc0 NDEV c31ef800
[  384.155264] wl_run_escan: LEGACY_SCAN sync ID: 6, bssidx: 0

uci: Entry not found


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

 -----------------------------------------------------
        QMontor CLI Mode
 -----------------------------------------------------
root@Dev-CC4B734FD58A:/#

从 log里面看到型号, 在官方网址中搜到了一个相似的产品: http://quallink.cn/qlnk4107.html

#7 Re: 技术人生/软件使用技巧/破解经验/技术吐槽/灌水 » AM335x-BeagleBoneBlack别样玩法 » 2021-11-16 16:39:02

qianfan 说:

我用jlink v10死活连不上. 不知道什么地方有问题

经过我多天的折腾, 终于能够连上了. 测试发现cti jtag的15脚必须和jlink的15脚连接, 否则不能识别.

未连接15脚的log:

$ JLinkExe
SEGGER J-Link Commander V6.92 (Compiled Dec 18 2020 14:11:06)
DLL version V6.92, compiled Dec 18 2020 14:10:53

Connecting to J-Link via USB...O.K.
Firmware: J-Link V11 compiled Dec 11 2020 15:39:51
Hardware version: V11.00
S/N: xxxxxxxx
License(s): GDB, JFlash, FlashDL, RDI, FlashBP
VTref=3.348V


Type "connect" to establish a target connection, '?' for help
J-Link>connect
Please specify device / core. <Default>: AM3359
Type '?' for selection dialog
Device>
Please specify target interface:
  J) JTAG (Default)
  S) SWD
  T) cJTAG
TIF>
Device position in JTAG chain (IRPre,DRPre) <Default>: -1,-1 => Auto-detect
JTAGConf>
Specify target interface speed [kHz]. <Default>: 4000 kHz
Speed>4000
Device "AM3359" selected.


Connecting to target via JTAG
InitTarget() start
TotalIRLen = ?, IRPrint = 0x..FFFFFFFFFFFFFFC1A4C40001
TotalIRLen = ?, IRPrint = 0x..FFFFFFFFFFFFFFC1A4C40001
AM335x connect: Can not find ICE-Pick (IRLen mismatch)
TotalIRLen = ?, IRPrint = 0x..FFFFFFFFFFFFFFC1A4C40001
TotalIRLen = ?, IRPrint = 0x..FFFFFFFFFFFFFFC1A4C40001
TotalIRLen = ?, IRPrint = 0x..FFFFFFFFFFFFFFC1A4C40001
TotalIRLen = ?, IRPrint = 0x..FFFFFFFFFFFFFFC1A4C40001
TotalIRLen = ?, IRPrint = 0x..FFFFFFFFFFFFFFC1A4C40001
AM335x connect: Can not find Cortex-A8 (IDCODE mismatch).
InitTarget() end
InitTarget() start
TotalIRLen = ?, IRPrint = 0x..FFFFFFFFFFFFFFC1A4C40001
TotalIRLen = ?, IRPrint = 0x..FFFFFFFFFFFFFFC1A4C40001
AM335x connect: Can not find ICE-Pick (IRLen mismatch)
TotalIRLen = ?, IRPrint = 0x..FFFFFFFFFFFFFFC1A4C40001
AM335x (connect):Can not find ICE-Pick (IDCODE mismatch). Expected 0x0B00002F, found: 0x00000000
InitTarget() end

****** Error: Failed to measure TotalIRLen.

InitTarget() start
TotalIRLen = ?, IRPrint = 0x..FFFFFFFFFFFFFFC1A4C40001
TotalIRLen = ?, IRPrint = 0x..FFFFFFFFFFFFFFC1A4C40001
AM335x connect: Can not find ICE-Pick (IRLen mismatch)
TotalIRLen = ?, IRPrint = 0x..FFFFFFFFFFFFFFC1A4C40001
AM335x (connect):Can not find ICE-Pick (IDCODE mismatch). Expected 0x0B00002F, found: 0x00000000
InitTarget() end
InitTarget() start
TotalIRLen = ?, IRPrint = 0x..FFFFFFFFFFFFFFC1A4C40001
TotalIRLen = ?, IRPrint = 0x..FFFFFFFFFFFFFFC1A4C40001
AM335x connect: Can not find ICE-Pick (IRLen mismatch)
TotalIRLen = ?, IRPrint = 0x..FFFFFFFFFFFFFFC1A4C40001
AM335x (connect):Can not find ICE-Pick (IDCODE mismatch). Expected 0x0B00002F, found: 0x00000000
InitTarget() end

****** Error: Failed to measure TotalIRLen.

Cannot connect to target.
J-Link>q

连接15脚之后的log:

$ JLinkExe
SEGGER J-Link Commander V6.92 (Compiled Dec 18 2020 14:11:06)
DLL version V6.92, compiled Dec 18 2020 14:10:53

Connecting to J-Link via USB...O.K.
Firmware: J-Link V11 compiled Dec 11 2020 15:39:51
Hardware version: V11.00
S/N: xxxxxxxx
License(s): GDB, JFlash, FlashDL, RDI, FlashBP
VTref=3.348V


Type "connect" to establish a target connection, '?' for help
J-Link>connect
Please specify device / core. <Default>: AM3359
Type '?' for selection dialog
Device>
Please specify target interface:
  J) JTAG (Default)
  S) SWD
  T) cJTAG
TIF>
Device position in JTAG chain (IRPre,DRPre) <Default>: -1,-1 => Auto-detect
JTAGConf>
Specify target interface speed [kHz]. <Default>: 4000 kHz
Speed>
Device "AM3359" selected.


Connecting to target via JTAG
InitTarget() start
TotalIRLen = 6, IRPrint = 0x01
TotalIRLen = 6, IRPrint = 0x01
JTAG chain detection found 1 devices:
 #0 Id: 0x2B94402F, IRLen: 06, TI ICEPick
AM335x reset: Core did not halt after reset. Halting core manually...
InitTarget() end
TotalIRLen = 10, IRPrint = 0x0011
JTAG chain detection found 2 devices:
 #0 Id: 0x3BA00477, IRLen: 04, CoreSight JTAG-DP
 #1 Id: 0x2B94402F, IRLen: 06, TI ICEPick
DPv0 detected
AP map detection skipped. Manually configured AP map found.
AP[0]: AHB-AP (IDR: Not set)
AP[1]: APB-AP (IDR: Not set)
AP[2]: JTAG-AP (IDR: Not set)
Iterating through AP map to find APB-AP to use
AP[0]: Skipped. Not an APB-AP
AP[1]: APB-AP found
Found Cortex-A8 r3p2
6 code breakpoints, 2 data breakpoints
Debug architecture ARMv7.0
Data endian: little
Main ID register: 0x413FC082
I-Cache L1: 32 KB, 128 Sets, 64 Bytes/Line, 4-Way
D-Cache L1: 32 KB, 128 Sets, 64 Bytes/Line, 4-Way
Unified-Cache L2: 256 KB, 512 Sets, 64 Bytes/Line, 8-Way
System control register:
  Instruction endian: little
  Level-1 instruction cache disabled
  Level-1 data cache disabled
  MMU disabled
  Branch prediction enabled
Memory zones:
  Zone: Default Description: Default access mode
  Zone: AHB-AP (AP0) Description: DMA like acc. in AP0 addr. space
  Zone: APB-AP (AP1) Description: DMA like acc. in AP1 addr. space
Cortex-A8 identified.
J-Link>

#9 Re: 全志 SOC » Debian 9.9 (stretch) 文件系统制作 » 2021-11-04 10:51:06

qemu-debootstrap是一个debootstrap的辅助脚本, 可以简化操作. 拷贝了几条关键内容:

eval run debootstrap --arch "$deb_arch" --foreign $opts $args
mkdir -p "$target/usr/bin"
cp $(which "qemu-$qemu_arch-static") "$target/usr/bin"
run chroot "$target" /debootstrap/debootstrap --second-stage

看了下标准安装的strech占用ram很小:

 free -m
              total        used        free      shared  buff/cache   available
Mem:            233          15         189           1          27         207
Swap:             0           0           0

#10 Re: 全志 SOC » licheepi zero :如何制作成img格式的烧录文件 » 2021-10-22 10:46:10

主线烧录可以在u-boot下搞一个fastboot, 通过fastboot烧写. 或者用ums, 主机通过dd烧写.

像nxp的imx6那样, 整个uuu. 不过uuu搞得有点难受, 用起来费劲.

#11 Re: 全志 SOC » sunxi-fel直接启动u-boot fastboot » 2021-09-16 14:32:07

cube 说:
qianfan 说:
memory 说:

有点意思,这个 0x44000000  地址是怎么算出来的?

随便填个有效地址就行了

随便填怎么关联呢?

看上面贴出的sunxi-tools的代码, sunxi-tools会将这个地址, 也就是44000000放到spl的header中(fel_scripts_address), 等开机之后从spl header里面取到的.

#12 Re: 全志 SOC » sunxi-fel直接启动u-boot fastboot » 2021-09-16 12:01:11

memory 说:

有点意思,这个 0x44000000  地址是怎么算出来的?

随便填个有效地址就行了

#13 全志 SOC » sunxi-fel直接启动u-boot fastboot » 2021-09-16 10:37:25

qianfan
回复: 6

分享一个使用sunxi-fel直接启动u-boot的fastboot的方法.

sunxi-fel使用uboot命令下载u-boot-sunxi-with-spl.bin之后可以直接运行u-boot, 如果需要配置uboot工作在其他模式, 比如ums或者fastboot等, 需要手动在u-boot的控制台上输入指令, 麻烦的很, 不利于自动化运行. 下面介绍一个简单的方法.

$ cat fastboot.env
#=uEnv
bootdelay=0
bootcmd=fastboot usb 0
$ sudo sunxi-fel uboot u-boot-sunxi-with-spl.bin write 0x44000000 fastboot.env
$ fastboot version
version: 0.4
finished. total time: 0.001s

----------------------------------------

从代码上分析下该方式的实现:

1. sunxi-tools

使用sunxi-fel write固件的时候, 函数内部会对固件类型进行判断, 目前支持两种特殊的固件, 一是u-boot env, 以字符串"#=uEnv"开头. 另一个是u-boot scripts, 由mkimage生成的. 如果是这两种格式之一, 会将write的地址存放在spl header的fel_script_address中, 长度存放在fel_uEnv_length. u-boot scripts脚本的话, fel_uEnv_length为0.

/* private helper function, gets used for "write*" and "multi*" transfers */
static unsigned int file_upload(feldev_handle *dev, size_t count,
				size_t argc, char **argv, progress_cb_t callback)
{
	if (argc < count * 2)
		pr_fatal("error: too few arguments for uploading %zu files\n",
			 count);

	/* get all file sizes, keeping track of total bytes */
	size_t size = 0;
	unsigned int i;
	for (i = 0; i < count; i++)
		size += file_size(argv[i * 2 + 1]);

	progress_start(callback, size); /* set total size and progress callback */

	/* now transfer each file in turn */
	for (i = 0; i < count; i++) {
		void *buf = load_file(argv[i * 2 + 1], &size);
		if (size > 0) {
			uint32_t offset = strtoul(argv[i * 2], NULL, 0);
			aw_write_buffer(dev, buf, offset, size, callback != NULL);

			/* If we transferred a script, try to inform U-Boot about its address. */
			if (get_image_type(buf, size) == IH_TYPE_SCRIPT)
				pass_fel_information(dev, offset, 0);
			if (is_uEnv(buf, size)) /* uEnv-style data */
				pass_fel_information(dev, offset, size);
		}
		free(buf);
	}

	return i; /* return number of files that were processed */
}

2. u-boot的实现

u-boot relocated之后, 在初始化的后半部分调用misc_init_r, 其中执行parse_spl_header, 会对spl_header中sunxi-tools传递的信息进行处理.

/*
 * Check the SPL header for the "sunxi" variant. If found: parse values
 * that might have been passed by the loader ("fel" utility), and update
 * the environment accordingly.
 */
static void parse_spl_header(const uint32_t spl_addr)
{
	struct boot_file_head *spl = get_spl_header(SPL_ENV_HEADER_VERSION);

	if (spl == INVALID_SPL_HEADER)
		return;

	if (!spl->fel_script_address)
		return;

	if (spl->fel_uEnv_length != 0) {
		/*
		 * data is expected in uEnv.txt compatible format, so "env
		 * import -t" the string(s) at fel_script_address right away.
		 */
		himport_r(&env_htab, (char *)(uintptr_t)spl->fel_script_address,
			  spl->fel_uEnv_length, '\n', H_NOCLEAR, 0, 0, NULL);
		return;
	}
	/* otherwise assume .scr format (mkimage-type script) */
	env_set_hex("fel_scriptaddr", spl->fel_script_address);
}

这种实现方式真是因吹斯汀.

#22 Re: 技术人生/软件使用技巧/破解经验/技术吐槽/灌水 » ext文件系统扩展: resize2fs。 开机自动给ext文件系统扩容。 » 2021-07-08 11:25:24

哇酷小二 说:

嗯,学到了,第一次开机运行这个脚本就可以了。

写个脚本做个判断, 开机运行下:

TryResizeRootfs () {
   local rootsize=$(df -m | grep '^/dev/root' | awk '{print $2}')
   if [ ${rootsize} -lt 200 ] ; then
      resize2fs /dev/root
      sync
   fi
}

#23 技术人生/软件使用技巧/破解经验/技术吐槽/灌水 » ext文件系统扩展: resize2fs。 开机自动给ext文件系统扩容。 » 2021-07-08 10:34:06

qianfan
回复: 8

使用emmc做存储, 一般将rootfs单独划分一个分区, 将其他的数据区划定另一个分区.

使用buildroot制作根文件系统的时候, 设置BR2_TARGET_ROOTFS_EXT2_SIZE的大小将直接影响生成的sdcard.img的大小. 通常情况下, 可以将BR2_TARGET_ROOTFS_EXT2_SIZE设置成为一个比较小的值, 仅能够容纳buildroot生成的程序. 在分区表中划定一个大的分区, 之后在系统启动之后由程序进行自动调整.

例如:

将BR2_TARGET_ROOTFS_EXT2_SIZE设置成60M, 但是划定300M的分区.

image boot.vfat {
	vfat {
		files = {
			"kernel/kernel.bin",
			"kernel/kernel2.bin"
		}
	}
	size = 32M
}

image sdcard.img {
	hdimage {
	}

	partition u-boot {
		in-partition-table = "no"
		image = "u-boot/u-boot-with-ddr-emmc-header.bin"
		offset = 512 # u-boot with emmc header start at 512 and size is 512K
		size = 523776
	}

	partition kernel-factory {
		in-partition-table = "no"
		image = "kernel/kernel.bin"
		offset = 2M
		size = 14M
	}

	partition boot {
		partition-type = 0xC
		bootable = "true"
		image = "boot.vfat"
		offset = 16M
	}

	partition rootfs {
		partition-type = 0x83
		image = "buildroot/rootfs.ext2"
		size = 300M
	}

	partition data {
		partition-type = 0x83
		size = 3G
	}
}

开机之后使用resize2fs扩展大小:

# df -h
Filesystem                Size      Used Available Use% Mounted on
/dev/root                58.1M     20.9M     34.2M  38% /
devtmpfs                 29.3M         0     29.3M   0% /dev
tmpfs                    29.4M         0     29.4M   0% /dev/shm
tmpfs                    29.4M     16.0K     29.4M   0% /tmp
tmpfs                    29.4M     20.0K     29.4M   0% /run
/dev/mmcblk0p3            3.0G     44.0K      2.8G   0% /data
# resize2fs /dev/root
resize2fs 1.44.1 (24-Mar-2018)
Filesystem at /dev/root EXT4-fs (mmcblk0p2): resizing filesystem from 61440 to 307200 blocks
is mounted on /; on-line resizing required
old_desc_blocks = 1, new_desc_blocks = 2
EXT4-fs (mmcblk0p2): resized filesystem to 307200
The filesystem on /dev/root is now 307200 (1k) blocks long.

# df -h
Filesystem                Size      Used Available Use% Mounted on
/dev/root               291.0M     21.6M    256.9M   8% /
devtmpfs                 29.3M         0     29.3M   0% /dev
tmpfs                    29.4M         0     29.4M   0% /dev/shm
tmpfs                    29.4M     16.0K     29.4M   0% /tmp
tmpfs                    29.4M     20.0K     29.4M   0% /run
/dev/mmcblk0p3            3.0G     44.0K      2.8G   0% /data

#24 技术人生/软件使用技巧/破解经验/技术吐槽/灌水 » emmc设置伪SLC模式 » 2021-07-02 09:52:24

qianfan
回复: 1

最近拿到一个板子, 上面搭载了8G的emmc (IS21ES08G), 但是从开机信息上面看到, 程序只能用到3.6G. 本着折腾的精神, 特意研究下这个东西.

从u-boot的控制台下使用mmc info查看下emmc的基本信息:

=> mmc info
Device: NUC970 eMMC
Manufacturer ID: 9d
OEM: 101
Name: IS008
Tran Speed: 26000000
Rd Block Len: 512
MMC version 5.0
High Capacity: Yes
Capacity: 3.6 GiB
Bus Width: 4-bit
Erase Group Size: 512 KiB
HC WP Group Size: 8 MiB
User Capacity: 3.6 GiB ENH WRREL
User Enhanced Start: 0 Bytes
User Enhanced Size: 3.6 GiB
Boot Capacity: 4 MiB ENH
RPMB Capacity: 4 MiB ENH

从mmc info中可以看到信息一栏: User Capacity: 3.6 GiB ENH WRREL, 注意这个地方的ENH. 查阅emmc的手册, 看到这这样的描述:

Supports Enhanced Mode where the device can be configured as pseudo-SLC (pSLC) for higher
read/write performance, endurance, and reliability.

但是手册中也没有明确指出使用pSLC模式下, 性能和擦写次数会有多大变化. 切换的方式是写ECSD寄存器: 兼容JEDEC标准.

The Extended CSD register defines the Device properties and selected modes. It is 512 bytes long. The most significant
320 bytes are the Properties segment, which defines the Device capabilities and cannot be modified by the host. The
lower 192 bytes are the Modes segment, which defines the configuration the Device is working in. These modes can
be changed by the host by means of the SWITCH command. For details, refer to section 7.4 of the JEDEC Standard
Specification No.JESD84-B50.

emmc的规范中描述了emmc的分区, 我们能够操作的分区是User Data Area. 可以从这里面划定出一块区域设置为ENH模式, 也就是设置为pSLC, 区域的大小必须是WPG size的倍数. WPG的大小在mmc info中已经列出来了, 为8M. 需要注意的是, 这个分区的设置是OTP的, 一旦设置一次之后就不能够更改, 因此设置的时候关于地址和大小一定要慎重.

emmc_partition.jpg

使用mmc hwpartition划定分区

正好我们有用emmc的产品, 找出一个来做下试验. 阅读下u-boot中关于hwpartition的代码:

	"mmc hwpartition <USER> <GP> <MODE> - does hardware partitioning\n"
	"  arguments (sizes in 512-byte blocks):\n"
	"   USER - <user> <enh> <start> <cnt> <wrrel> <{on|off}>\n"
	"	: sets user data area attributes\n"
	"   GP - <{gp1|gp2|gp3|gp4}> <cnt> <enh> <wrrel> <{on|off}>\n"
	"	: general purpose partition\n"
	"   MODE - <{check|set|complete}>\n"
	"	: mode, complete set partitioning completed\n"
	"  WARNING: Partitioning is a write-once setting once it is set to complete.\n"
	"  Power cycling is required to initialize partitions after set to complete.\n"

参数中cnt是以扇区)512字节)为单位计算的, 我从mmc info中读出mmc的容量是7.3G, 不是一个整数. 看代码中会计算并判断这个cnt是不是在有效范围内, 因此可以先随便填一个比较大的数字, u-boot会提示最大可用的WPG个数.

=> mmc hwpartition user enh 0 15269888 wrrel on
Partition configuration:
        User Enhanced Start: 0 Bytes
        User Enhanced Size: 7.3 GiB
        User partition write reliability: on
        No GP1 partition
        No GP2 partition
        No GP3 partition
        No GP4 partition
Total enhanced size exceeds maximum (932 > 466)
Failed!

前面也提到WPG的大小是8M, user data共有466个WPG, 因此可以设置的容量是8M * 466 = 3909091328字节, 换算成扇区是7634944.

=> mmc hwpartition user enh 0 7634944 wrrel on complete
Partition configuration:
        User Enhanced Start: 0 Bytes
        User Enhanced Size: 3.6 GiB
        User partition write reliability: on
        No GP1 partition
        No GP2 partition
        No GP3 partition
        No GP4 partition
Partitioning successful, power-cycle to make effective

设置完之后, 对emmc重新上电, 使用mmc info读取出来的容量就是3.6G了, 整个user data区域已经全部设置成pSLC模式.

=> mmc info
Device: NUC970 eMMC
Manufacturer ID: 9d
OEM: 101
Name: IS008
Tran Speed: 26000000
Rd Block Len: 512
MMC version 5.0
High Capacity: Yes
Capacity: 3.6 GiB
Bus Width: 4-bit
Erase Group Size: 512 KiB
HC WP Group Size: 8 MiB
User Capacity: 3.6 GiB ENH WRREL
User Enhanced Start: 0 Bytes
User Enhanced Size: 3.6 GiB
Boot Capacity: 4 MiB ENH
RPMB Capacity: 4 MiB ENH

#25 技术人生/软件使用技巧/破解经验/技术吐槽/灌水 » 如何向开源社区奉献代码 » 2021-06-30 14:58:31

qianfan
回复: 4

从事嵌入式工作, 日常就是与u-boot, linux这些开源代码打交道, 将自己的代码提交到主线, 将是一件快乐而又能提升逼格的事情.
有些比较新的代码会使用github进行bug追踪, pr合并, 这些直接在github提交Pull Request就好了, 比较简单, 就不在赘述.
本文重点介绍如何使用mail list的方式提交自己的代码, 以u-boot为例介绍.

一: 新建分支, 实现功能

当需要实现一个feature或者修改一个bug, 我们需要从master上面切换一个分支:

$ git checkout -b allwinner-r40-usb-otg-v2

之后在当前分支上对主线代码进行修改, 不要将所有的修改都提交到一个commit上面, 而是应该将修改拆分成几个独立的commit, 这样也便于审核和维护. 在commit之前需要配置git的邮箱等信息:

$ git config --global user.name name
$ git config --global user.email xxx@xxx.com

配置完成之后, 可以使用git config --list检查下是否已经设置成功.

开源的代码对commit都有一个约定俗成的三段式写法, 第一段简要写明当前commit修改的主要内容. 第二段可以详细的描述下为什么这么做等等原因. 第三段签上自己Signed-off-by. 下面是u-boot代码中的一个例子:

    arm: mvebu: turris_mox: add support for board rescue mode

    Add necessary config options and board code to support board factory
    reset / rescue mode on Turris MOX.

    In order to also support invoking rescue mode from U-Boot console,
    without having to press the factory reset button, put the rescue command
    into `bootcmd_rescue` default environment variable. When factory reset
    button is pressed, invoke rescue mode via distroboot by setting
    `boot_targets` to `rescue`.

    Rescue boot from console can be invoked by running
      run bootcmd_rescue

    Signed-off-by: Marek Behún <marek.behun@nic.cz>
    Reviewed-by: Pali Rohár <pali@kernel.org>
    Reviewed-by: Stefan Roese <sr@denx.de>

当然, 每次commit都写一个Signed-off-by很费劲, 因此git有选项可以配置一个commit的模板文件, 在每次commit的时候自动填充一些信息:

➜  u-boot git:(allwinner-r40-usb-otg-v2) git config --list | grep commit.template
commit.template=/home/qianfan/.git-commit-template.txt
➜  u-boot git:(allwinner-r40-usb-otg-v2) cat ~/.git-commit-template.txt

Signed-off-by: qianfan Zhao <qianfanguijin@163.com>

➜  u-boot git:(allwinner-r40-usb-otg-v2)
二: 生成, 检查patch

新建一个outgoing文件夹, 将当前的修改输出到patch文件中.

➜  u-boot git:(allwinner-r40-usb-otg-v2) git format-patch master -o outgoing
outgoing/0001-phy-sun4i-usb-Fix-sun8i_r40_cfg.patch
outgoing/0002-dts-bpi-m2u-Enable-USB_OTG-by-default.patch
outgoing/0003-sunxi-defconfig-bpi-m2u-Enable-usb-gadget-and-ums-by.patch

u-boot的源码中有checkpatch.pl程序, 可以对patch的格式进行检查, 在提交之前一定要检查下patch:

➜  u-boot git:(allwinner-r40-usb-otg-v2) ./scripts/checkpatch.pl outgoing/*.patch
---------------------------------------------------
outgoing/0001-phy-sun4i-usb-Fix-sun8i_r40_cfg.patch
---------------------------------------------------
total: 0 errors, 0 warnings, 0 checks, 8 lines checked

outgoing/0001-phy-sun4i-usb-Fix-sun8i_r40_cfg.patch has no obvious style problems and is ready for submission.
---------------------------------------------------------
outgoing/0002-dts-bpi-m2u-Enable-USB_OTG-by-default.patch
---------------------------------------------------------
total: 0 errors, 0 warnings, 0 checks, 31 lines checked

outgoing/0002-dts-bpi-m2u-Enable-USB_OTG-by-default.patch has no obvious style problems and is ready for submission.
------------------------------------------------------------------------
outgoing/0003-sunxi-defconfig-bpi-m2u-Enable-usb-gadget-and-ums-by.patch
------------------------------------------------------------------------
total: 0 errors, 0 warnings, 0 checks, 16 lines checked

outgoing/0003-sunxi-defconfig-bpi-m2u-Enable-usb-gadget-and-ums-by.patch has no obvious style problems and is ready for submission.

NOTE: Ignored message types: COMPLEX_MACRO CONSIDER_KSTRTO ENOSYS MINMAX MULTISTATEMENT_MACRO_USE_DO_WHILE NETWORKING_BLOCK_COMMENT_STYLE PREFER_ETHER_ADDR_COPY USLEEP_RANGE
三: 发送patch

对u-boot而言, 需要将patch发送到maling list:  u-boot@lists.denx.de, 同时需要通知相关的维护者. 有时候, 我们也不知道谁是这份代码的维护者, 也不知道应该通知谁. 还好, 有工具可以获取某些patch的维护者:

➜  u-boot git:(allwinner-r40-usb-otg-v2) ./scripts/get_maintainer.pl outgoing/*.patch
Chen-Yu Tsai <wens@csie.org> (maintainer:BANANAPI M2 ULTRA BOARD)
Jagan Teki <jagan@amarulasolutions.com> (maintainer:ARM SUNXI)
Andre Przywara <andre.przywara@arm.com> (maintainer:ARM SUNXI,commit_signer:4/3=100%)
Ivan Uvarov <i.uvarov@cognitivepilot.com> (commit_signer:2/3=67%,authored:2/3=67%,added_lines:688/702=98%,removed_lines:62/62=100%)
qianfan Zhao <qianfanguijin@163.com> (commit_signer:1/3=33%,authored:1/3=33%)
u-boot@lists.denx.de (open list)

按照mailing list的要求, 发送的patch不能有乱七八糟的格式, 就是纯文本, 所以不能用添加附件的方式来发送. 为此, 开源社区的大佬们做了一个git send-email的程序. 如果未安装的话, 可以使用apt安装.

# apt install git-email

安装之后, 需要配置邮箱smtp地址, 账号, 密码等. 下面是我使用的网易邮箱的配置. sendemail.smtppass是邮箱密码的明文.

sendemail.smtpserver=smtp.163.com
sendemail.smtpuser=xxx@xxx.com
sendemail.smtppass=your_email_passwd
sendemail.from=xxx@xxx.com
sendemail.smtpencryption=tls

配置好账号信息之后, 就可以使用send-email发送patch了. 可以将上面得到的维护者的邮箱全部填上:

➜  u-boot git:(allwinner-r40-usb-otg-v2) git send-email outgoing/*.patch -to u-boot@lists.denx.de -cc wens@csie.org -cc jagan@amarulasolutions.com -cc andre.przywara@arm.com -cc marex@denx.de --smtp-debug

待发送完成之后, 可以在patchwork上面找到这个提交: http://patchwork.ozlabs.org/project/uboot/patch/20210616023326.18135-1-qianfanguijin@163.com/

四: 审核意见

当patch发送出去之后, 一般而言并不能直接合并入master, 主线代码维护者会对patch进行审核, 并回复. 回复的信息会发送到邮箱中. 后续可以在使用邮件进行沟通. 邮箱客户端推荐使用Mozilla Thunderbird.

对审核的建议作出修改, 需要使用git rebase回退到某一个commit修改, 全部修改完成之后, 生成patch, 重复send-email的工作即可.

#26 技术人生/软件使用技巧/破解经验/技术吐槽/灌水 » fdtdump从固件中dump dts » 2021-06-22 14:30:07

qianfan
回复: 0

使用各种各样的方式提取固件之后, 需要拿到dts的代码, 这样就可以确定大部分硬件引脚. 通常情况下, 我们可以使用binwalk去探测dtb的位置:

DECIMAL       HEXADECIMAL     DESCRIPTION
--------------------------------------------------------------------------------
0             0x0             uImage header, header size: 64 bytes, header CRC: 0x9DA54DAA, created: 2021-06-03 02:48:41, image size: 2299135 bytes, Data Address: 0x8000, Entry Point: 0x8000, data CRC: 0xE7E35DF9, OS: Linux, CPU: ARM, image type: OS Kernel Image, compression type: none, image name: "4-20210603-g34fa3a"
64            0x40            Linux kernel ARM boot executable zImage (little-endian)
2188          0x88C           device tree image (dtb)
18092         0x46AC          gzip compressed data, maximum compression, from Unix, last modified: 1970-01-01 00:00:00 (null date)
2272376       0x22AC78        device tree image (dtb)
2278001       0x22C271        VxWorks symbol table, big endian, first entry: [type: function, code address: 0x100, symbol address: 0x200]

但是binwalk对dtb的提取只是简单的比对magic d00dfeed, 这种比较方法会造成误判, 比如上面列出了2个dtb. 但只有最有一个是正确的.

这时候可以使用fdtdump直接一步到位:
(fdtdump的-s参数可以从固件中搜索dtb, 之后dump)

$ fdtdump -s uImage_with_dtb_cct4g.bin

**** fdtdump is a low-level debugging tool, not meant for general use.
**** If you want to decompile a dtb, you probably want
****     dtc -I dtb -O dts <filename>

uImage_with_dtb_cct4g.bin: found fdt at offset 0x22ac78
/dts-v1/;
// magic:               0xd00dfeed
// totalsize:           0x68c7 (26823)
// off_dt_struct:       0x38
// off_dt_strings:      0x663c
// off_mem_rsvmap:      0x28
// version:             17
// last_comp_version:   16
// boot_cpuid_phys:     0x0
// size_dt_strings:     0x28b
// size_dt_struct:      0x6604

/ {
    #address-cells = <0x00000001>;
    #size-cells = <0x00000001>;

另外fdtdump的-d选项可以输出调试信息, 对理解dtb的结构大有帮助.

/dts-v1/;
// magic:		0xd00dfeed
// totalsize:		0x68cb (26827)
// off_dt_struct:	0x38
// off_dt_strings:	0x6640
// off_mem_rsvmap:	0x28
// version:		17
// last_comp_version:	16
// boot_cpuid_phys:	0x0
// size_dt_strings:	0x28b
// size_dt_struct:	0x6608

// 0038: tag: 0x00000001 (FDT_BEGIN_NODE)
/ {
// 0040: tag: 0x00000003 (FDT_PROP)
// 6640: string: #address-cells
// 004c: value
    #address-cells = <0x00000001>;
// 0050: tag: 0x00000003 (FDT_PROP)
// 664f: string: #size-cells
// 005c: value
    #size-cells = <0x00000001>;
// 0060: tag: 0x00000003 (FDT_PROP)
// 665b: string: model

从ftddump的源码中反推dtb的结构:

整个dtb分为三部分:
1. dtb的文件头, 用于标记dtb的基本信息
2. 若干node组成的dtb结构体, 每个node包含三部分, FDT_BEGIN_NODE + FDT_PROP + ... + FDT_PROP + FDT_END_NODE.
    每一个FDT_PROP是一个key-value的结构, key是必须存在的, 为字符串格式, value是一个变长字段, 可以省略, 格式是字符串或数字.
    value也可以是多个相同类型的组合.
    例如:
           只保存一个value的key, value的格式是数字:
           #address-cells = <0x00000001>;
           #size-cells = <0x00000001>;

           value的格式是字符串:
           bootargs = "console=ttyS0,115200";

           value为空:
           interrupt-controller;

           value是多个字符串:
           compatible = "nuvoton,nuc972", "nuvoton,nuc970";
    FDT_PROP的key的内容存放在第三部分文字池中, FDT_PROP结构中存放的是一个指针地址. value部分以数组的形式存储在FDT_PROP的最后.
3. 文字池, 存储所有FDT_PROP的key字段.

dtb的第二部分的起始地址存放在fdt_header->off_dt_struct, 第三部分存放在off_dt_strings;

struct fdt_header {
	fdt32_t magic;			 /* magic word FDT_MAGIC */
	fdt32_t totalsize;		 /* total size of DT block */
	fdt32_t off_dt_struct;		 /* offset to structure */
	fdt32_t off_dt_strings;		 /* offset to strings */
	fdt32_t off_mem_rsvmap;		 /* offset to memory reserve map */
	fdt32_t version;		 /* format version */
	fdt32_t last_comp_version;	 /* last compatible version */

	/* version 2 fields below */
	fdt32_t boot_cpuid_phys;	 /* Which physical CPU id we're
					    booting on */
	/* version 3 fields below */
	fdt32_t size_dt_strings;	 /* size of the strings block */

	/* version 17 fields below */
	fdt32_t size_dt_struct;		 /* size of the structure block */
};

dump_blob用于dump整个dtb, 首先打印header的基本信息:

	printf("/dts-v1/;\n");
	printf("// magic:\t\t0x%"PRIx32"\n", fdt32_to_cpu(bph->magic));
	printf("// totalsize:\t\t0x%"PRIx32" (%"PRIu32")\n",
	       totalsize, totalsize);
	printf("// off_dt_struct:\t0x%"PRIx32"\n", off_dt);
	printf("// off_dt_strings:\t0x%"PRIx32"\n", off_str);
	printf("// off_mem_rsvmap:\t0x%"PRIx32"\n", off_mem_rsvmap);
	printf("// version:\t\t%"PRIu32"\n", version);
	printf("// last_comp_version:\t%"PRIu32"\n",
	       fdt32_to_cpu(bph->last_comp_version));

之后遍历整个dtb, 按照BEGIN_NODE, PROP, END_NODE的格式, 打印所有NODE.

	p = p_struct;
	while ((tag = fdt32_to_cpu(GET_CELL(p))) != FDT_END) {

		dumpf("%04"PRIxPTR": tag: 0x%08"PRIx32" (%s)\n",
		        (uintptr_t)p - blob_off - 4, tag, tagname(tag));

		if (tag == FDT_BEGIN_NODE) {
			s = p;
			p = PALIGN(p + strlen(s) + 1, 4);

			if (*s == '\0')
				s = "/";

			printf("%*s%s {\n", depth * shift, "", s);

			depth++;
			continue;
		}

		if (tag == FDT_END_NODE) {
			depth--;

			printf("%*s};\n", depth * shift, "");
			continue;
		}

		if (tag == FDT_NOP) {
			printf("%*s// [NOP]\n", depth * shift, "");
			continue;
		}

		if (tag != FDT_PROP) {
			fprintf(stderr, "%*s ** Unknown tag 0x%08"PRIx32"\n", depth * shift, "", tag);
			break;
		}
		sz = fdt32_to_cpu(GET_CELL(p));
		s = p_strings + fdt32_to_cpu(GET_CELL(p));
		if (version < 16 && sz >= 8)
			p = PALIGN(p, 8);
		t = p;

		p = PALIGN(p + sz, 4);

		dumpf("%04"PRIxPTR": string: %s\n", (uintptr_t)s - blob_off, s);
		dumpf("%04"PRIxPTR": value\n", (uintptr_t)t - blob_off);
		printf("%*s%s", depth * shift, "", s);
		utilfdt_print_data(t, sz);
		printf(";\n");
	}

每一个NODE都有一个string表示名字, 这个名字字段是紧跟FDT_BEGIN_NODE tag存放的:

// 39dc: tag: 0x00000001 (FDT_BEGIN_NODE)
        serial@b8000000 {
// 39f0: tag: 0x00000003 (FDT_PROP)
// 6661: string: compatible
// 39fc: value
            compatible = "nuvoton,nuc970-uart";

每个node是由多个prop组成的, prop的key字段以指针的形式存放, 内容存在在dtb的最后一部分文字池中.

tag: FDT_PROP
len: 该prop的value的长度.
nameoff: 该prop的key字符串在文字池中的地址.
data: 使用数组(而非指针)存放的value字段.

代码中使用s = p_strings + fdt32_to_cpu(GET_CELL(p));获取key的实际地址.

struct fdt_property {
	fdt32_t tag;
	fdt32_t len;
	fdt32_t nameoff;
	char data[0];
};

value部分是字符串或者数字的组合, 如果所有字符是可打印的, 认为是字符串, 如果是4的倍数, 认为数字. (单字节的还没见过)

void utilfdt_print_data(const char *data, int len)
{
	int i;
	const char *s;

	/* no data, don't print */
	if (len == 0)
		return;

	if (util_is_printable_string(data, len)) {
		printf(" = ");

		s = data;
		do {
			printf("\"%s\"", s);
			s += strlen(s) + 1;
			if (s < data + len)     /* 考虑多个string的组合: compatible = "nuvoton,nuc972", "nuvoton,nuc970"; */
				printf(", ");
		} while (s < data + len);

	} else if ((len % 4) == 0) {
		const fdt32_t *cell = (const fdt32_t *)data;

		printf(" = <");
		for (i = 0, len /= 4; i < len; i++)
			printf("0x%08" PRIx32 "%s", fdt32_to_cpu(cell[i]),
			       i < (len - 1) ? " " : "");
		printf(">");
	} else {
		const unsigned char *p = (const unsigned char *)data;
		printf(" = [");
		for (i = 0; i < len; i++)
			printf("%02x%s", *p++, i < len - 1 ? " " : "");
		printf("]");
	}
}

#27 全志 SOC » 全志R40使用UMS烧写/备份镜像 » 2021-06-16 17:02:15

qianfan
回复: 2

全志的BSP使用的内核比较老, 在我的二手笔记本上面编译整个镜像特别慢, 但是好处是能够使用usb直接烧写EMMC. 如果使用Linux主线内核, 没有凤凰刷机工具的支持, 很难直接将镜像烧写至EMMC中, 搜索目前网上的开源板卡, 类似bananapi等板子, 都需要使用TF卡做媒介去烧写. 对于我这种懒人, 这种方式太麻烦了.并且不是所有的板子都存在TF卡接口.

sunxi-tools提供的sunxi-fel工具能够直接启动u-boot, 并且u-boot支持ums命令, 能够使用usb模拟storage, 使用这种方式能够直接在电脑上通过usb读写EMMC, 简直是解决这个问题的完美方案. 但是目前u-boot, linux的主线代码中usb部分并不支持R40这颗芯片, 反反复复改动多次之后, 修改了一份能够支持usb的u-boot, 已经提交patch到u-boot的mail list中了, 等待回复. 这里上传一个编译好的固件.u-boot-sunxi-with-spl.zip, 可以使用sunxi-fel运行u-boot镜像:

(我在window上面使用cygwin运行sunxi-fel, 因为在linux下, 总担心dd的时候, 把系统的磁盘给刷了, 所以编译了一份sunxi-fel在window上面用, 另外window上面可以使用Win32DiskImager等工具刷物理磁盘)

➜  ~ sunxi-fel uboot ./u-boot-sunxi-with-spl.bin

sunxi-fel启动u-boot之后, 在bpi的串口上可以看到u-boot的启动信息, 按任意按键可以进入u-boot的控制台, 使用mmc list查看可用的mmc媒介:
(在bpi板子上面, TF卡是mmc 0, emmc是mmc 1)

U-Boot SPL 2021.07-rc4-19023-gf87fd00f01 (Jun 16 2021 - 09:36:39 +0800)
DRAM: 2048 MiB
Trying to boot from FEL


U-Boot 2021.07-rc4-19023-gf87fd00f01 (Jun 16 2021 - 09:36:39 +0800) Allwinner Technology

CPU:   Allwinner R40 (SUN8I 1701)
Model: Banana Pi BPI-M2-Ultra
I2C:   ready
DRAM:  2 GiB
MMC:   mmc@1c0f000: 0, mmc@1c10000: 2, mmc@1c11000: 1
Loading Environment from FAT... Unable to use mmc 1:1... In:    serial@1c28000
Out:   serial@1c28000
Err:   serial@1c28000
Allwinner mUSB OTG (Peripheral)
Net:   phy interface8
eth0: ethernet@1c50000, eth1: usb_ether
starting USB...
Bus usb@1c19000: USB EHCI 1.00
Bus usb@1c19400: USB OHCI 1.0
Bus usb@1c1c000: USB EHCI 1.00
Bus usb@1c1c400: USB OHCI 1.0
scanning bus usb@1c19000 for devices... 1 USB Device(s) found
scanning bus usb@1c19400 for devices... 1 USB Device(s) found
scanning bus usb@1c1c000 for devices... 1 USB Device(s) found
scanning bus usb@1c1c400 for devices... 1 USB Device(s) found
       scanning usb for storage devices... 0 Storage Device(s) found
Hit any key to stop autoboot:  0
=>  mmc list
mmc@1c0f000: 0
mmc@1c10000: 2
mmc@1c11000: 1 (eMMC)
=>

使用ums命令可以启动usb storage程序:

=> ums 0 mmc 1
UMS: LUN 0, dev mmc 1, hwpart 0, sector 0x0, count 0xe90000
\musb-hdrc: peripheral reset irq lost!
\

该命令运行之后, 在window下面可以识别出一个可移动设备, 这时候就可以使用Win32DiskImager刷镜像了. 我使用的板子是bananapi M2U, 从https://mirrors.bfsu.edu.cn/armbian-releases/bananapim2ultra/archive/选择一个最新的armbian镜像, 解压之后1.3G, 刷整个镜像大约在3分钟左右, 速度可以到7MB每秒, 这个烧写速度和全志的凤凰工具差不了太多.

刷完镜像之后, 对板子重新上电, armbian就可以愉快启动了. (armbian的内核启动没有开启log, 需要耐心等待一会)

U-Boot SPL 2021.04-armbian (May 06 2021 - 16:44:35 +0000)
DRAM: 2048 MiB
Trying to boot from MMC2


U-Boot 2021.04-armbian (May 06 2021 - 16:44:35 +0000) Allwinner Technology

CPU:   Allwinner R40 (SUN8I 1701)
Model: Banana Pi BPI-M2-Ultra
I2C:   ready
DRAM:  2 GiB
MMC:   mmc@1c0f000: 0, mmc@1c10000: 2, mmc@1c11000: 1
Loading Environment from FAT... Unable to use mmc 1:1... In:    serial@1c28000
Out:   serial@1c28000
Err:   serial@1c28000
Net:   phy interface7
eth0: ethernet@1c50000
starting USB...
Bus usb@1c19000: ehci_generic usb@1c19000: failed to get usb phy
Port not available.
Bus usb@1c19400: ohci_generic usb@1c19400: failed to get usb phy
Port not available.
Bus usb@1c1c000: ehci_generic usb@1c1c000: failed to get usb phy
Port not available.
Bus usb@1c1c400: ohci_generic usb@1c1c400: failed to get usb phy
Port not available.
Autoboot in 1 seconds, press <Space> to stop
switch to partitions #0, OK
mmc1(part 0) is current device
Scanning mmc 1:1...
Found U-Boot script /boot/boot.scr
3967 bytes read in 1 ms (3.8 MiB/s)
## Executing script at 43100000
U-boot loaded from eMMC or secondary SD
MMC: no card present
Boot script loaded from mmc
203 bytes read in 1 ms (198.2 KiB/s)
9931681 bytes read in 494 ms (19.2 MiB/s)
7973464 bytes read in 396 ms (19.2 MiB/s)
Found mainline kernel configuration
34090 bytes read in 5 ms (6.5 MiB/s)
Failed to load '/boot/dtb/overlay/sun8i-r40-fixup.scr'
## Loading init Ramdisk from Legacy Image at 43300000 ...
   Image Name:   uInitrd
   Image Type:   ARM Linux RAMDisk Image (gzip compressed)
   Data Size:    9931617 Bytes = 9.5 MiB
   Load Address: 00000000
   Entry Point:  00000000
   Verifying Checksum ... OK
## Flattened Device Tree blob at 43000000
   Booting using the fdt blob at 0x43000000
   Loading Ramdisk to 49687000, end 49fffb61 ... OK
   Loading Device Tree to 49616000, end 49686fff ... OK

Starting kernel ...


bananapim2ultra login: root (automatic login)

Last login: Fri May  7 18:09:37 UTC 2021 on tty1
 ____  ____  _   __  __ ____  _   _
| __ )|  _ \(_) |  \/  |___ \| | | |
|  _ \| |_) | | | |\/| | __) | | | |
| |_) |  __/| | | |  | |/ __/| |_| |
|____/|_|   |_| |_|  |_|_____|\___/

Welcome to Armbian 21.05.1 Buster with Linux 5.10.34-sunxi

No end-user support: community creations

System load:   43%              Up time:       0 min
Memory usage:  6% of 1.97G      IP:
CPU temp:      48°C             Usage of /:    17% of 7.0G
RX today:      n/a

New to Armbian? Documentation: https://docs.armbian.com Support: https://forum.armbian.com

New root password: *******
Repeat password: *******

Choose default system command shell:

1) bash
2) zsh

有时候, 捡垃圾的时候需要备份镜像, 或者破解root密码, 这时候可以使用ums搭配win32diskimager来备份整个磁盘, 另外可以在linux环境下挂载目标板的文件系统, 读取shadow文件, 并交给专业的破解工具跑字典:

➜  u-boot-r40 git:(allwinner-r40-usb-otg) ls /dev/sd*
/dev/sda  /dev/sda1  /dev/sda2  /dev/sdb  /dev/sdb1
➜  u-boot-r40 git:(allwinner-r40-usb-otg) sudo mount /dev/sdb1 /tmp/sdb
➜  u-boot-r40 git:(allwinner-r40-usb-otg) cd /tmp/sdb
➜  sdb ls
bin  boot  dev  etc  home  lib  lost+found  media  mnt  opt  proc  root  run  sbin  selinux  srv  sys  tmp  usr  var
➜  sdb cat etc/shadow
cat: etc/shadow: Permission denied
➜  sdb sudo cat etc/shadow
root:$6$kKnH/usEh6bKkLfS$0XAZmPD.uBmlEQnGwl69rXnTPAVGqgaLORdQaEpcRrtMVMPHpFTPswnXjn0mSeqzgpeLVTclyLibGZYhfqyPX1:18754:0:99999:7:::
daemon:*:18752:0:99999:7:::
bin:*:18752:0:99999:7:::
sys:*:18752:0:99999:7:::
sync:*:18752:0:99999:7:::
games:*:18752:0:99999:7:::
man:*:18752:0:99999:7:::
lp:*:18752:0:99999:7:::
mail:*:18752:0:99999:7:::
news:*:18752:0:99999:7:::
uucp:*:18752:0:99999:7:::
proxy:*:18752:0:99999:7:::
www-data:*:18752:0:99999:7:::
backup:*:18752:0:99999:7:::
list:*:18752:0:99999:7:::
irc:*:18752:0:99999:7:::
gnats:*:18752:0:99999:7:::
nobody:*:18752:0:99999:7:::
_apt:*:18752:0:99999:7:::
systemd-timesync:*:18752:0:99999:7:::
systemd-network:*:18752:0:99999:7:::
systemd-resolve:*:18752:0:99999:7:::
messagebus:*:18752:0:99999:7:::
vnstat:*:18752:0:99999:7:::
_chrony:*:18752:0:99999:7:::
avahi-autoipd:*:18752:0:99999:7:::
sshd:*:18752:0:99999:7:::
systemd-coredump:!!:18754::::::
qianfan:$6$x6S1dlRjgmA2O9ov$rI946/qO6uhy6rTzAd7LiuaVRnwgDBcEWCnkVwZShTI8/uSbAJ2RTSSZG962rm.KK7v2yafwb7Hs7wumv9JeZ1:18754:0:99999:7:::
➜  sdb

#28 全志 SOC » How to compile Linux kernel with -O0 flag » 2021-02-23 11:36:02

qianfan
回复: 0

参考链接:

https://lists.kernelnewbies.org/pipermail/kernelnewbies/2016-August/016686.html

搬运工:

Hello

I'm currently exploring different ways of debugging Linux kernel. And I
noticed that for many variables gdb displays <optimized out>. Also from
experience of debugging ring3 code I know that sometimes debugger may
act crazy unless -O0 was used.

Apparently there is no corresponding option in `make menuconfig`. So
how do you solve this problem? Just `CFLAGS=-O0 make ...` or somehow
else? I wonder what is the "right" way of doing it because you know,
it's a kernel, it can accidentally break something unless you are
careful :)

--
Best regards,
Aleksander Alekseev







On Sat, Aug 13, 2016 at 09:15:16PM +0300, Aleksander Alekseev wrote:
> Hello
>
> I'm currently exploring different ways of debugging Linux kernel. And I
> noticed that for many variables gdb displays <optimized out>. Also from
> experience of debugging ring3 code I know that sometimes debugger may
> act crazy unless -O0 was used.
>
> Apparently there is no corresponding option in `make menuconfig`. So
> how do you solve this problem? Just `CFLAGS=-O0 make ...` or somehow
> else? I wonder what is the "right" way of doing it because you know,
> it's a kernel, it can accidentally break something unless you are
> careful :)

The kernel will not run with -O0, sorry, just live with the build
optimization levels that is currently used and you should be fine.

But why do you want to use a debugger on the kernel?  That's not a
normal task unless you are bringing up a new hardware platform.

best of luck,

greg k-h







> The kernel will not run with -O0, sorry, just live with the build
> optimization levels that is currently used and you should be fine.

Oh, I see. Fortunately I'm not afraid of assembler :) Thanks.

Just out of curiosity - is there a technical reason why -O0 couldn't
be used in Linux kernel? I don't know, spinlocks would not work in this
case because it's how GCC was written or something. Or just nobody
compiles and tests kernel like this so it most likely would not work?

> But why do you want to use a debugger on the kernel?  That's not a
> normal task unless you are bringing up a new hardware platform.

It's just something I always do when I learn new things. Trying to
figure out how to debug something in this new environment. No real task
so far.

--
Best regards,
Aleksander Alekseev









On Sat, Aug 13, 2016 at 09:56:05PM +0300, Aleksander Alekseev wrote:
> > The kernel will not run with -O0, sorry, just live with the build
> > optimization levels that is currently used and you should be fine.
>
> Oh, I see. Fortunately I'm not afraid of assembler :) Thanks.
>
> Just out of curiosity - is there a technical reason why -O0 couldn't
> be used in Linux kernel?

Yes, it doesn't work :)

> I don't know, spinlocks would not work in this
> case because it's how GCC was written or something. Or just nobody
> compiles and tests kernel like this so it most likely would not work?

Try it, it will not work :)

good luck!

greg k-h






On Sat, Aug 13, 2016 at 09:56:05PM +0300, Aleksander Alekseev wrote:
> > The kernel will not run with -O0, sorry, just live with the build
> > optimization levels that is currently used and you should be fine.
>
> Oh, I see. Fortunately I'm not afraid of assembler :) Thanks.
>
> Just out of curiosity - is there a technical reason why -O0 couldn't
> be used in Linux kernel? I don't know, spinlocks would not work in this
> case because it's how GCC was written or something. Or just nobody
> compiles and tests kernel like this so it most likely would not work?

Just fixed Makefile and tried to build it with -O0, it doesn't even
compile, i got errors like this:

./include/linux/compiler-gcc.h:243:38: error: impossible constraint in ‘asm’
#define asm_volatile_goto(x...) do { asm goto(x); asm (""); } while (0)
                                      ^
./arch/x86/include/asm/cpufeature.h:146:3: note: in expansion of macro ‘asm_volatile_goto’
   asm_volatile_goto("1: jmp 6f\n"

Probably gcc cannot figure out that an macro argument can be evaluated at
compile time with optimizations disabled.

>
> > But why do you want to use a debugger on the kernel?  That's not a
> > normal task unless you are bringing up a new hardware platform.
>
> It's just something I always do when I learn new things. Trying to
> figure out how to debug something in this new environment. No real task
> so far.
>
> --
> Best regards,
> Aleksander Alekseev
>
> _______________________________________________
> Kernelnewbies mailing list
> Kernelnewbies at kernelnewbies.org
> https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies








> Just out of curiosity - is there a technical reason why -O0 couldn't
> be used in Linux kernel? I don't know, spinlocks would not work in this
> case because it's how GCC was written or something. Or just nobody
> compiles and tests kernel like this so it most likely would not work?
>
>> But why do you want to use a debugger on the kernel?  That's not a
>> normal task unless you are bringing up a new hardware platform.
>
> It's just something I always do when I learn new things. Trying to
> figure out how to debug something in this new environment. No real task
> so far.

Hi, I also like figuring out what's happening in the OS underlying. So
I have some ideas about reducing optimization. Although you couldn't
turn off optimization completely, you can use both -O2 and other
options to reducing optimization as far as possible.
You can use -O2 -Q -v to find out which options are enabled when using
-O2. Then you can try -O2 -fno-defer-pop -fno-thread-jumps etc. to
disable some options. I once used this approach to debug kernel-2.4 in
bochs simulator. Unfortunately, this approach could not counteract the
effects of -O2 completely, but it's worth a try.

Good Luck,
Hao Lee







On Sun, Aug 14, 2016 at 07:11:01PM +0800, Hao Lee wrote:
> > Just out of curiosity - is there a technical reason why -O0 couldn't
> > be used in Linux kernel? I don't know, spinlocks would not work in this
> > case because it's how GCC was written or something. Or just nobody
> > compiles and tests kernel like this so it most likely would not work?
> >
> >> But why do you want to use a debugger on the kernel?  That's not a
> >> normal task unless you are bringing up a new hardware platform.
> >
> > It's just something I always do when I learn new things. Trying to
> > figure out how to debug something in this new environment. No real task
> > so far.
>
> Hi, I also like figuring out what's happening in the OS underlying. So
> I have some ideas about reducing optimization. Although you couldn't
> turn off optimization completely, you can use both -O2 and other
> options to reducing optimization as far as possible.
> You can use -O2 -Q -v to find out which options are enabled when using
> -O2. Then you can try -O2 -fno-defer-pop -fno-thread-jumps etc. to
> disable some options. I once used this approach to debug kernel-2.4 in
> bochs simulator. Unfortunately, this approach could not counteract the
> effects of -O2 completely, but it's worth a try.

No, please don't do that.  If you do, you will end up with a completly
unsuported and unknown system and no one will be able to help you out
with any sort of problem solving.

Just use the default build options, and all should be fine.  We know
they work.  Anything else is a total unknown, and not something that
anyone trying to learn about the kernel should be messing with.

thanks,

greg k-h






>> Hi, I also like figuring out what's happening in the OS underlying. So
>> I have some ideas about reducing optimization. Although you couldn't
>> turn off optimization completely, you can use both -O2 and other
>> options to reducing optimization as far as possible.
>> You can use -O2 -Q -v to find out which options are enabled when using
>> -O2. Then you can try -O2 -fno-defer-pop -fno-thread-jumps etc. to
>> disable some options. I once used this approach to debug kernel-2.4 in
>> bochs simulator. Unfortunately, this approach could not counteract the
>> effects of -O2 completely, but it's worth a try.
>
> No, please don't do that.  If you do, you will end up with a completly
> unsuported and unknown system and no one will be able to help you out
> with any sort of problem solving.
>
> Just use the default build options, and all should be fine.  We know
> they work.  Anything else is a total unknown, and not something that
> anyone trying to learn about the kernel should be messing with.


Thank you!!!
I didn't know this before. Thanks for your correction!

Thanks,
Hao Lee






Hi,

Le dimanche 14 août 2016 à 13:31 +0200, Greg KH a écrit :
> On Sun, Aug 14, 2016 at 07:11:01PM +0800, Hao Lee wrote:
> >
> > >
> > > Just out of curiosity - is there a technical reason why -O0
> > > couldn't be used in Linux kernel? I don't know, spinlocks would
> > > not work in this case because it's how GCC was written or
> > > something. Or just nobody compiles and tests kernel like this so
> > > it most likely would not work?
> > >
[...]
> > Hi, I also like figuring out what's happening in the OS underlying.
> > So I have some ideas about reducing optimization. Although you
> > couldn't turn off optimization completely, you can use both -O2 and
> > other options to reducing optimization as far as possible.
> > You can use -O2 -Q -v to find out which options are enabled when
> > using -O2. Then you can try -O2 -fno-defer-pop -fno-thread-jumps
> > etc. to disable some options. I once used this approach to debug
> > kernel-2.4 in bochs simulator. Unfortunately, this approach could
> > not counteract the effects of -O2 completely, but it's worth a try.
>
> No, please don't do that.  If you do, you will end up with a
> completly unsuported and unknown system and no one will be able to
> help you out with any sort of problem solving.
>

And what about -Og which is a dedicated optimization level since GCC
4.8

https://gcc.gnu.org/onlinedocs/gcc/Optimize-Options.html#index-Og-723
https://gcc.gnu.org/gcc-4.8/changes.html

Regards.

--
Yann Droneaud
OPTEYA

#29 全志 SOC » 全志平台使用jlink调试vmlinux内核程序 » 2021-02-23 11:20:42

qianfan
回复: 1

硬件平台: 全志R40 + JLinkV9
软件工具: sunxi-tools, JLinkExe, JLinkGdbServer, arm-linux-gnueabihf-gcc, arm-linux-gnueabihf-gdb
程序源码:
2021.01-rc1-14752-gcdeb7b8f98-dirty 
Linux OrangePi_One 5.11.0-40525-g77cdf1d653ba-dirty


一. 使用sunxi-tools构建可从ram启动的系统

使用sunxi-tools将编译后的引导, 内核, dtb, 根文件系统通过usb下载至内存中, 等待u-boot启动之后, 按任意按键进入u-boot控制台, 之后输入bootz命令可以启动linux系统. 免去烧写镜像的过程. 使用的uInitrd可以从https://whycan.com/files/members/2542/uInitrd_20210223-1517.zip中下载.

#!/bin/bash

BOARD=r40
UBOOT=~/debug/port/github-os/u-boot-${BOARD}
LINUX=~/debug/port/github-os/linux-${BOARD}/arch/arm/boot
DTS=${LINUX}/dts/sun8i-r40-bananapi-m2-ultra.dtb

sunxi-fel -p uboot ${UBOOT}/u-boot-sunxi-with-spl.bin write 0x42000000 ${LINUX}/zImage write 0x43000000 ${DTS} write 0x43300000 ./ramdisk/uInitrd

echo "Input this command in u-boot shell to boot linux kernel:"
echo "bootz 42000000 43300000 43000000"
$ sudo ./start_r40_live.sh
[sudo] password for qianfan:
100% [================================================]  4688 kB,  352.0 kB/s
100% [================================================]    24 kB,  343.7 kB/s
100% [================================================]  5044 kB,  349.3 kB/s
Input this command in u-boot shell to boot linux kernel:
bootz 42000000 43300000 43000000

(测试发现, R40使用sunxi-fel下载镜像速度比H3慢很多. H3可以达到接近1M的速度)



二: 使用tf卡转接板从MMC0(PF0-PF5)接口上引出JTAG并连接至JLink. 按下RPI M2U的boot按键进入fel模式. 使用JLinkExe程序测试硬件连接.
正常的话可以读取到芯片的信息.

Type "connect" to establish a target connection, '?' for help
J-Link>connect
Please specify device / core. <Default>: CORTEX-A7
Type '?' for selection dialog
Device>
Please specify target interface:
  J) JTAG (Default)
  S) SWD
  T) cJTAG
TIF>
Device position in JTAG chain (IRPre,DRPre) <Default>: -1,-1 => Auto-detect
JTAGConf>
Specify target interface speed [kHz]. <Default>: 4000 kHz
Speed>
Device "CORTEX-A7" selected.


Connecting to target via JTAG
TotalIRLen = 4, IRPrint = 0x01
JTAG chain detection found 1 devices:
 #0 Id: 0x5BA00477, IRLen: 04, CoreSight JTAG-DP
DPv0 detected
Scanning AP map to find all available APs
AP[2]: Stopped AP scan as end of AP map has been reached
AP[0]: AHB-AP (IDR: 0x64770001)
AP[1]: APB-AP (IDR: 0x44770002)
Iterating through AP map to find APB-AP to use
AP[0]: Skipped. Not an APB-AP
AP[1]: APB-AP found
ROMTbl[0][0]: CompAddr: 80001000 CID: 00000000, PID: 00000000 ???
ROMTbl[0][1]: CompAddr: 80100000 CID: B105100D, PID: 000BB4A7 ROM Table
ROMTbl[1][0]: CompAddr: 80110000 CID: B105900D, PID: 005BBC07 Cortex-A7
Found Cortex-A7 r0p5
6 code breakpoints, 4 data breakpoints
Debug architecture ARMv7.1
Data endian: little
Main ID register: 0x410FC075
I-Cache L1: 32 KB, 512 Sets, 32 Bytes/Line, 2-Way
D-Cache L1: 32 KB, 128 Sets, 64 Bytes/Line, 4-Way
Unified-Cache L2: 512 KB, 1024 Sets, 64 Bytes/Line, 8-Way
System control register:
  Instruction endian: little
  Level-1 instruction cache disabled
  Level-1 data cache disabled
  MMU disabled
  Branch prediction enabled
Memory zones:
  Zone: Default Description: Default access mode
  Zone: AHB-AP (AP0) Description: DMA like acc. in AP0 addr. space
  Zone: APB-AP (AP1) Description: DMA like acc. in AP1 addr. space
Cortex-A7 identified.
J-Link>

三: 修改代码保留JTAG功能

u-boot及内核启动之后, 会配置MMC0的引脚, 复用为MMC功能. 需要禁用相关代码以保证JTAG功能呢可用.

u-boot:
禁用CONFIG_MMC和CONFIG_CMD_MMC
linux: 在dts中禁用mmc0

diff --git a/arch/arm/boot/dts/sun8i-r40-bananapi-m2-ultra.dts b/arch/arm/boot/dts/sun8i-r40-bananapi-m2-ultra.dts
index a7aa8112433a..68ffa2e48658 100644
--- a/arch/arm/boot/dts/sun8i-r40-bananapi-m2-ultra.dts
+++ b/arch/arm/boot/dts/sun8i-r40-bananapi-m2-ultra.dts
@@ -175,21 +175,21 @@
 #include "axp22x.dtsi"

 &ir0 {
        status = "okay";
 };

 &mmc0 {
        vmmc-supply = <&reg_dcdc1>;
        bus-width = <4>;
        cd-gpios = <&pio 7 13 GPIO_ACTIVE_LOW>; /* PH13 */
-       status = "okay";
+       status = "disabled";
 };

 &mmc1 {
        pinctrl-names = "default";
        pinctrl-0 = <&mmc1_pg_pins>;
        vmmc-supply = <&reg_dldo2>;
        vqmmc-supply = <&reg_dldo1>;
        mmc-pwrseq = <&wifi_pwrseq>;
        bus-width = <4>;
        non-removable;

四: 配置linux内核以增加调试信息

在menuconfig中勾上这些选项:
CONFIG_DEBUG_INFO=y
CONFIG_GDB_SCRIPTS=y
CONFIG_DEBUG_KERNEL=y
CONFIG_DEBUG_VM=y

五: 启动系统并停留在u-boot控制台中.
(不要输入bootz命令, 仅停留在控制台中, 等待JLink连接. 参考步骤一)

六: 在u-boot停留在控制台中时, 使用JLinkGdbServer连接芯片

➜  ~ JLinkGDBServer -device CORTEX-A7 -if jtag -speed 2000
SEGGER J-Link GDB Server V6.92 Command Line Version

JLinkARM.dll V6.92 (DLL compiled Dec 18 2020 14:10:53)

Command line: -device CORTEX-A7 -if jtag -speed 2000
-----GDB Server start settings-----
GDBInit file:                  none
GDB Server Listening port:     2331
SWO raw output listening port: 2332
Terminal I/O port:             2333
Accept remote connection:      yes
Generate logfile:              off
Verify download:               off
Init regs on start:            off
Silent mode:                   off
Single run mode:               off
Target connection timeout:     0 ms
------J-Link related settings------
J-Link Host interface:         USB
J-Link script:                 none
J-Link settings file:          none
------Target related settings------
Target device:                 CORTEX-A7
Target interface:              JTAG
Target interface speed:        2000kHz
Target endian:                 little

Connecting to J-Link...
J-Link is connected.
Firmware: J-Link V9 compiled Dec 13 2019 11:14:50
Hardware: V9.30
S/N: 36310083
Feature(s): RDI, GDB, FlashDL, FlashBP, JFlash
Checking target voltage...
Target voltage: 3.31 V
Listening on TCP/IP port 2331
Connecting to target...

J-Link found 1 JTAG device, Total IRLen = 4
JTAG ID: 0x5BA00477 (Cortex-A7)
Connected to target
Waiting for GDB connection...

七: 启动arm gdb, 并连接到JLinkGdbServer的端口2331

➜  linux git:(sun8i-r40-usb-otg) ✗ arm-linux-gnueabihf-gdb vmlinux
GNU gdb (Linaro_GDB-2019.12) 8.3.1.20191204-git
Copyright (C) 2019 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "--host=x86_64-unknown-linux-gnu --target=arm-linux-gnueabihf".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
    <http://www.gnu.org/software/gdb/documentation/>.

连接成功之后, 使用target命令连接远程端口, 并在start_kernel上面打上断点. 此时CPU已经halt. 需要使用continue命令继续运行u-boot.

(gdb) tar extended-remote :2331
Remote debugging using :2331
0xbffa4740 in ?? ()
(gdb) b start_kernel
Breakpoint 1 at 0xc0b0093c: file init/main.c, line 850.
(gdb) c
Continuing.

八: 启动linux内核.

在u-boot控制台中输入bootz 42000000 43300000 43000000命令以启动内核. 启动之后gdb停在start_kernel函数中, 之后可以单步调试.

Breakpoint 1, start_kernel () at init/main.c:850
850     {
(gdb) n
854             set_task_stack_end_magic(&init_task);
(gdb)
850     {
(gdb)
854             set_task_stack_end_magic(&init_task);
(gdb)
855             smp_setup_processor_id();
(gdb)
858             cgroup_init_early();
(gdb)
860             local_irq_disable();
(gdb)

九: 部分函数设置断点无法进入

使用该方法调试内核时, 发现只能停在start_kernel中, 在驱动中打断点无法进入. 经过探索, 发现是多核引起的. 在menuconfig中关掉CONFIG_SMP并重新编译内核, 该问题得到解决.

例如: 在gpiolib_seq_show函数中打上断点.

(gdb) b gpiolib_seq_show
Breakpoint 2 at 0xc03ca5f8: file drivers/gpio/gpiolib.c, line 4321.
(gdb) c
Continuing.

在linux控制台中触发:
mount -t debugfs none /sys/kernel/debug
cat /sys/kernel/debug/gpio

断点被gdb捕捉到, 可进行单步调试:

(gdb) i b
Num     Type           Disp Enb Address    What
1       breakpoint     keep y   0xc0b0093c in start_kernel at init/main.c:850
        breakpoint already hit 1 time
2       breakpoint     keep y   0xc03ca5f8 in gpiolib_seq_show at drivers/gpio/gpiolib.c:4321
(gdb) c
Continuing.

Breakpoint 2, gpiolib_seq_show (s=0xc1bd3000, v=0xc1835800) at drivers/gpio/gpiolib.c:4321
4321    {
(gdb) n
4323            struct gpio_chip *gc = gdev->chip;
(gdb)
4321    {
(gdb)
4326            if (!gc) {
(gdb)
4334                       gdev->base, gdev->base + gdev->ngpio - 1);
(gdb)
4332            seq_printf(s, "%s%s: GPIOs %d-%d", (char *)s->private,
(gdb)
4334                       gdev->base, gdev->base + gdev->ngpio - 1);
(gdb)
4332            seq_printf(s, "%s%s: GPIOs %d-%d", (char *)s->private,
(gdb) p s
$1 = (struct seq_file *) 0xc1bd3000
(gdb) n
4334                       gdev->base, gdev->base + gdev->ngpio - 1);
(gdb)
4332            seq_printf(s, "%s%s: GPIOs %d-%d", (char *)s->private,
(gdb)
4335            parent = gc->parent;
(gdb) bt
#0  gpiolib_seq_show (s=0xc1bd3000, v=0xc1835800) at drivers/gpio/gpiolib.c:4335
#1  0xc02217fc in seq_read_iter (iocb=0xc1bf3e88, iocb@entry=0xc1bf3e80, iter=0xc0c043bc <totalreserve_pages>,
    iter@entry=0xc1bf3e68) at fs/seq_file.c:227
#2  0xc0221ce0 in seq_read (file=file@entry=0xc1bfe840,
    buf=buf@entry=0xbee4ec58 <error: Cannot access memory at address 0xbee4ec58>, size=size@entry=4096,
    ppos=ppos@entry=0xc1bf3f78) at fs/seq_file.c:159
#3  0xc03383b4 in full_proxy_read (filp=filp@entry=0xc1bfe840,
    buf=buf@entry=0xbee4ec58 <error: Cannot access memory at address 0xbee4ec58>, size=size@entry=4096,
    ppos=ppos@entry=0xc1bf3f78) at fs/debugfs/file.c:229
#4  0xc01fcf60 in vfs_read (file=0xc1bfe840, buf=0xbee4ec58 <error: Cannot access memory at address 0xbee4ec58>,
    count=<optimized out>, pos=0xc1bf3f78) at fs/read_write.c:494
#5  0xc01fd5d4 in ksys_read (fd=<optimized out>, buf=0xbee4ec58 <error: Cannot access memory at address 0xbee4ec58>,
    count=4096) at fs/read_write.c:634
#6  0xc0100060 in cpu_v7_reset () at arch/arm/mm/proc-v7.S:64
Backtrace stopped: previous frame identical to this frame (corrupt stack?)
(gdb)

#30 Re: 全志 SOC » 新手,linux内核如何选择,V3s » 2020-10-22 14:25:13

sdk有自己的打包脚本, 不用这么费劲, 搞个主线的内核的话, 可以这么搞. 主线内核打上sunxi_defconfig

#32 Re: 技术人生/软件使用技巧/破解经验/技术吐槽/灌水 » script.bin文件头特征以及直接从flash镜像文件中提取的方法 » 2020-10-22 11:11:34

sunxi-tools里面有个工具script_extractor.c也可以提取, 前提是能够进入目标机器并能运行文件.

全志的代码默认将sys_config加载到43000000这个地址, 参考代码里面的配置:

```c
➜  linux-3.4 git:(r16-v2.1.y) grep -nr SYS_CONFIG_MEMBASE arch/arm/mach-sunxi
arch/arm/mach-sunxi/sun8i.c:114:unsigned int sys_config_addr = SYS_CONFIG_MEMBASE;
arch/arm/mach-sunxi/include/mach/sun8i/memory-sun8iw7p1.h:27:#define SYS_CONFIG_MEMBASE       (PLAT_PHYS_OFFSET + SZ_32M + SZ_16M)           /* 0x43000000 */
arch/arm/mach-sunxi/include/mach/sun8i/memory-sun8iw1p1.h:23:#define SYS_CONFIG_MEMBASE       (PLAT_PHYS_OFFSET + SZ_32M + SZ_16M)           /* 0x43000000 */
arch/arm/mach-sunxi/include/mach/sun8i/memory-sun8iw5p1.h:27:#define SYS_CONFIG_MEMBASE       (PLAT_PHYS_OFFSET + SZ_32M + SZ_16M)           /* 0x43000000 */
arch/arm/mach-sunxi/include/mach/sun8i/memory-sun8iw6p1.h:27:#define SYS_CONFIG_MEMBASE       (PLAT_PHYS_OFFSET + SZ_32M + SZ_16M)           /* 0x43000000 */
arch/arm/mach-sunxi/include/mach/sun8i/memory-sun8iw3p1.h:27:#define SYS_CONFIG_MEMBASE       (PLAT_PHYS_OFFSET + SZ_32M + SZ_16M)           /* 0x43000000 */
arch/arm/mach-sunxi/include/mach/sun8i/memory-sun8iw8p1.h:25:#define SYS_CONFIG_MEMBASE       (PLAT_PHYS_OFFSET + SZ_32M + SZ_16M)           /* 0x43000000 */
arch/arm/mach-sunxi/include/mach/sun8i/memory-sun8iw9p1.h:27:#define SYS_CONFIG_MEMBASE       (PLAT_PHYS_OFFSET + SZ_32M + SZ_16M)           /* 0x43000000 */
```

这个工具使用memmap读取物理地址的数据, 可以使用devmem简单的看下地址是否正确:

busybox devmem 0x43000000

之后提取出128K的文件并使用sunxi-fexc转换就行了.

#33 Re: 技术人生/软件使用技巧/破解经验/技术吐槽/灌水 » script.bin文件头特征以及直接从flash镜像文件中提取的方法 » 2020-10-21 15:14:03

0x00处的4C是sections. 可以参考这份代码: https://github.com/linux-sunxi/sunxi-tools/blob/master/script_bin.h#L28

struct script_bin_head {
    uint32_t sections;
    uint32_t filesize;
    uint32_t version[2];
    struct script_bin_section section[];
};

这个fex.bin的头里面没什么magic的字符串, 比较难找. 只能打开固件文件手动的查找.

全志新一点的内核, 使用dtb的, 那个就好处理了.

#34 Re: 全志 SOC » 感谢 @aodzip @达克罗德, 我的小智X3开发板u-boot ums运行成功, TF卡和eMMC都能模拟成U盘挂载到电脑. » 2020-09-28 16:55:24

我用的R40, 在添加UMS的时候, 编译出错: 请问这个是需要udc的驱动吗?

```
cmd/built-in.o: In function `do_usb_mass_storage':
/home/qianfan/debug/port/github-os/u-boot/cmd/usb_mass_storage.c:218: undefined reference to `usb_gadget_handle_interrupts'
drivers/usb/gadget/built-in.o: In function `usb_composite_register':
/home/qianfan/debug/port/github-os/u-boot/drivers/usb/gadget/composite.c:1171: undefined reference to `usb_gadget_register_driver'
drivers/usb/gadget/built-in.o: In function `usb_composite_unregister':
/home/qianfan/debug/port/github-os/u-boot/drivers/usb/gadget/composite.c:1189: undefined reference to `usb_gadget_unregister_driver'
drivers/usb/gadget/built-in.o: In function `sleep_thread':
/home/qianfan/debug/port/github-os/u-boot/drivers/usb/gadget/f_mass_storage.c:682: undefined reference to `usb_gadget_handle_interrupts'
arm-linux-gnueabihf-ld.bfd: BFD (Linaro_Binutils-2017.02) 2.27.0.20161019 assertion fail /home/tcwg-buildslave/workspace/tcwg-make-release/label/docker-trusty-amd64-tcwg-build/target/arm-linux-gnueabihf/snapshots/binutils-gdb.git~linaro_binutils-2_27-branch/bfd/elf32-arm.c:8784
arm-linux-gnueabihf-ld.bfd: BFD (Linaro_Binutils-2017.02) 2.27.0.20161019 assertion fail /home/tcwg-buildslave/workspace/tcwg-make-release/label/docker-trusty-amd64-tcwg-build/target/arm-linux-gnueabihf/snapshots/binutils-gdb.git~linaro_binutils-2_27-branch/bfd/elf32-arm.c:8784
arm-linux-gnueabihf-ld.bfd: BFD (Linaro_Binutils-2017.02) 2.27.0.20161019 assertion fail /home/tcwg-buildslave/workspace/tcwg-make-release/label/docker-trusty-amd64-tcwg-build/target/arm-linux-gnueabihf/snapshots/binutils-gdb.git~linaro_binutils-2_27-branch/bfd/elf32-arm.c:8784
Makefile:1753: recipe for target 'u-boot' failed
make: *** [u-boot] Error 1
➜  u-boot git:(master) ✗ grep -nr usb_gadget_register_driver
include/linux/usb/gadget.h:861: * usb_gadget_register_driver - register a gadget driver
include/linux/usb/gadget.h:871:int usb_gadget_register_driver(struct usb_gadget_driver *driver);
drivers/usb/musb-new/musb_uboot.c:388:int usb_gadget_register_driver(struct usb_gadget_driver *driver)
drivers/usb/gadget/pxa25x_udc.c:1903:int usb_gadget_register_driver(struct usb_gadget_driver *driver)
drivers/usb/gadget/ci_udc.c:1010:int usb_gadget_register_driver(struct usb_gadget_driver *driver)
drivers/usb/gadget/composite.c:1171:    res = usb_gadget_register_driver(&composite_driver);
drivers/usb/gadget/dwc2_udc_otg.c:243:int usb_gadget_register_driver(struct usb_gadget_driver *driver)
Binary file drivers/usb/gadget/built-in.o matches
drivers/usb/gadget/fotg210.c:914:int usb_gadget_register_driver(struct usb_gadget_driver *driver)
Binary file drivers/usb/gadget/g_dnl.o matches
drivers/usb/gadget/atmel_usba_udc.c:1209:int usb_gadget_register_driver(struct usb_gadget_driver *driver)
drivers/usb/gadget/udc/udc-core.c:348:int usb_gadget_register_driver(struct usb_gadget_driver *driver)
drivers/usb/gadget/udc/udc-core.c:352:EXPORT_SYMBOL_GPL(usb_gadget_register_driver);
drivers/usb/gadget/ether.c:2384:        if (usb_gadget_register_driver(&priv->eth_driver) < 0)
drivers/usb/gadget/at91_udc.c:1439:int usb_gadget_register_driver(struct usb_gadget_driver *driver)
➜  u-boot git:(master) ✗ cat drivers/usb/gadget/udc/Makefile
# SPDX-License-Identifier: GPL-2.0+
#
# USB peripheral controller drivers

ifndef CONFIG_$(SPL_)DM_USB_GADGET
obj-$(CONFIG_USB_DWC3_GADGET)   += udc-core.o
endif

obj-$(CONFIG_$(SPL_)DM_USB_GADGET)      += udc-core.o
obj-$(CONFIG_$(SPL_)DM) += udc-uclass.o
➜  u-boot git:(master) ✗
```

#35 Re: 全志 SOC » buildroot 与busybox » 2019-12-07 23:27:00

Buildroot的根目录下,可以直接改其他包的defconfig。具体的语法好像是make xxx_menuconfig,有点记不清了。不用特意先cd到目录。可以make help查看一下。

#36 Re: 全志 SOC » Allwinner A40i Quad-Core Industrial Control Processor » 2019-11-29 21:23:51

mango 说:

完整资料大概是20.28GB。你可以问问验证下。

听说代码有公版sdk, 这个公版是全志放出来的吗?

#38 Re: 全志 SOC » Allwinner A40i Quad-Core Industrial Control Processor » 2019-11-29 15:12:53

请问,现在淘宝上那些买板子送代码的靠谱不,代码能用吗?

页脚

工信部备案:粤ICP备20025096号 Powered by FluxBB

感谢为中文互联网持续输出优质内容的各位老铁们。 QQ: 516333132, 微信(wechat): whycan_cn (哇酷网/挖坑网/填坑网) service@whycan.cn