DebugDump Forum

本站无需注册,无需积分,无需回复可下载所有资料,如果真的喜欢小站,请您注册之后请至少回复一个帖子激活Id,谢谢支持! 站长QQ: 516333132 (挖坑网/填坑网) admin@debugdump.com

您尚未登录。

#1 2019-02-22 13:36:43

jiangming1399
会员
注册时间: 2018-06-14
累计积分: 24

荔枝派nano的SPI-Flash系统编译创建全过程

原文发表在我博客上:荔枝派nano的SPI-Flash系统编译创建全过程

前言

本文的目标是创建一个运行在SPI-Flash上的精简系统,附带填一些前人没有提及的坑。在开始之前,请先通读官方教程的即食部分(U-Boot)、Linux编译SPI-Flash系统的创建部分的教程,并搭建好编译工具链。以下我假设你已经按照上面的教程下载好了U-Boot和Linux内核,并且到Buildroot的官网下载好了Buildroot(但没按教程创建config文件)。

SPI-Flash的分区结构

以下是我这里的分区结构。你可以自由的分配后面两个分区的大小。

ID  SIZE    USAGE   ADDR
0   448kb   U-boot  0x0000 0000 - 0x0007 0000
1   64kb    dtb     0x0007 0000 - 0x0008 0000
2   4mb     kernel  0x0008 0000 - 0x0048 0000
3   7.5mb   rootfs  0x0048 0000 - 0x00c0 0000
4   4mb     overlay 0x00c0 0000 - 0x0100 0000   
U-Boot的编译和填坑

按照上面的U-Boot的编译教程来编译基本上是没有什么太大问题。我这里就说一下上面教程里面没有说的配置:

设置内核启动参数

勾上

Enable boot arguments

,然后在下面填上:

panic=5 rootwait root=/dev/mtdblock3 rw rootfstype=squashfs

其中,root=/dev/mtdblock3指定了第3分区为rootfs所在分区,rootfstype=squashfs指定了这个分区的格式是squashfs。

设置Bootcmd

勾上

Enable a default value for bootcmd

,然后在下面填上:

sf probe 0 60000000; sf read 0x80c00000 0x70000 0x10000; sf read 0x80008000 0x80000 0x400000; bootz 0x80008000 - 0x80c00000

0x70000和0x80000分别是分区1和2的起始地址。

减小U-Boot体积

默认配置下,U-Boot的体积是接近1M的,但实际上U-Boot本体才270k左右。多余的空间实际上是被环境配置所占据了。

进入Environment菜单,找到Environment Offset。这个Offset就是配置的偏移地址,只要它比U-Boot本体大就可以了。这里我设置成0x68000,并将Environment Size设置成0x8000,这样编译出来的U-Boot大小就正好是0x70000,也就是448kb。

设置显示输出日志

勾上Console下的 Enable console multiplexing 和 Select console devices from environment,就可以在屏幕上看到启动日志了。

Linux的编译和填坑

Linux的坑就稍微有些多了。在做接下来的东西之前,你最好先载入官方的配置文件。

SPI-Flash的支持

进入 Device Drivers -> SPI support,将 Allwinner A10 SoCs SPI controller取消勾选,然后勾上下面的Allwinner A31 SPI Controller。这是为了修正配置文件中SPI驱动不正确的问题。

勾上并进入 Device Drivers -> Memory Technology Device (MTD) support,选上下面两项:

  • Command line partitioning table parsing #为了解析内核参数传过来的分区信息,如果用设备树应该可以不选

  • Caching block device access to MTD devices  #为了生成/dev/mtdblock*设备,不选会报错

取消勾选 General setup -> initramfs support (存疑)。

再进入Filesystem Drivers,选上JFFS2和SquashFS的支持。

然后打开drivers/mtd/spi-nor/spi-nor.c,检查自己的flash型号的参数是否含有SECT_4K,如果有则改为0。例如对于w25q128,需要将

 { "w25q128", INFO(0xef4018, 0, 64 * 1024, 256, SECT_4K) },

改为

{ "w25q128", INFO(0xef4018, 0, 64 * 1024, 256, 0) }

最后修改设备树文件中的分区信息,可以参考前面官方教程里面的dts修改章节。

flash@0 {
    #address-cells = <1>;
    #size-cells = <1>;
    compatible = "macronix,mx25l12805d", "jedec,spi-nor";
    reg = <0>;
    spi-max-frequency = <50000000>;
    partitions {
      compatible = "fixed-partitions";
      #address-cells = <1>;
      #size-cells = <1>;

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

      partition@70000 {
        label = "dtb";
        reg = <0x70000 0x10000>;
        read-only;
      };

      partition@80000 {
        label = "kernel";
        reg = <0x80000 0x400000>;
        read-only;
      };

      partition@480000 {
        label = "rootfs";
        reg = <0x480000 0x780000>;
      };
      
      partition@c00000 {
        label = "overlayfs";
        reg = <0xc00000 0x400000>;
      };
    };
  };
USB Gadget的支持

为了方便调试,需要启用USB Gadget。

转到 Device Driver -> USB support -> USB Gadget support,勾上 Usb gadget functions configurable through configfs,和上面的Serial gadget console support,以及下面的CDC ACM、CDC ECM、RNDIS、FunctionFS,再取消USB Gadget precomposed configurations的勾选。(具体原因和操作方法可以看我前面的文章

对文件drivers/clk/sunxi-ng/ccu-suniv.c应用下面这个补丁,修正USB驱动问题

--- ../linux/drivers/clk/sunxi-ng/ccu-suniv.c    2019-01-15 22:48:18.824587965 +0800
+++ drivers/clk/sunxi-ng/ccu-suniv.c    2019-01-23 09:05:17.959348454 +0800
@@ -238,7 +238,7 @@
/* The BSP header file has a CIR_CFG, but no mod clock uses this definition */

static SUNXI_CCU_GATE(usb_phy0_clk,    "usb-phy0",    "osc24M",
-              0x0cc, BIT(8), 0);
+              0x0cc, BIT(1), 0);

static SUNXI_CCU_GATE(dram_ve_clk,    "dram-ve",    "pll-ddr",
              0x100, BIT(0), 0);
Wifi支持

我这里用的是rtl8723bs,所以在drivers->staging里面启用相关的驱动就可以了。

Buildroot的使用和rootfs的编译

下载Buildroot后解压,不要使用官方的配置文件,应当自己从零开始编译。

基础设置
Target options
  -- Target Architecture (ARM (little endian))
  -- Target Variant arm926t
Toolchain
  -- C library (musl) # 使用musl减小最终体积
System configuration
  -- Use syslinks to /usr .... # 启用/bin, /sbin, /lib的链接
  -- Enable root login # 启用root登录
  -- Run a getty after boot # 启用登录密码输入窗口
  -- remount root filesystem # 重新挂载根文件系统到可读写
  -- Install Timezone info # 安装时区信息。我的程序需要所以就打开了这个玩意
     -- timezone list (asia)
     -- default local time (Asia/Shanghai)
Target Packages
  -- mount/umount # 如果要用overlayfs,那就要用这个挂载
网络部分软件包

这里我给出包名然后自己搜素就好了

  • ifupdown scripts

  • iw # 用做无线网络管理的,可不要

  • wpa_supplicant # 无线网络管理需要这个玩意

  • linux-firmware -> rtl87xx # 无线网卡的固件

其他可能需要的软件包
  • lrzsz # rz/sz命令,用于传输文件

  • gawk # 用于解析iw命令的输出

  • dialog # 用于wifish管理的图形界面的生成

Busybox的设置

有一些软件包在busybox内是自带的,可以到使用busybox的menuconfig进行配置。需要先运行一次make生成busybox的构建文件夹,然后再使用 make busybox-menuconfig 配置。每次clean后都需要重新配置一次,因为在clean的时候这个配置会被清除。

可能需要的软件包:

  • ntpd # 网络自动校正时间

  • udhcpc # dhcp客户端

烧写镜像的生成和其他设置

下面所说的所有操作都包含在这个打包脚本里面了:licheepi-nano-image-master

镜像的生成

这里有个脚本可以一键生成镜像。

    OUT_FILENAME="flashimg.bin"

    UBOOT_FILE=../u-boot-new/u-boot-sunxi-with-spl.bin
    KERNEL_DIR=../linux
    KERNEL_MODULES_DIR=$KERNEL_DIR/out/*
    DTB_FILE=$KERNEL_DIR/arch/arm/boot/dts/suniv-f1c100s-licheepi-nano.dtb
    KERNEL_FILE=$KERNEL_DIR/arch/arm/boot/zImage
    ROOTFS_FILE=../buildroot-2018.11.1/output/images/rootfs.tar
    SPEC_FILE=./custom/*
    SCRIPTES=./scripts/*.sh

    dd if=/dev/zero of=$OUT_FILENAME bs=1M count=16
    dd if=$UBOOT_FILE of=$OUT_FILENAME bs=1K conv=notrunc
    dd if=$DTB_FILE of=$OUT_FILENAME bs=1K seek=448  conv=notrunc
    dd if=$KERNEL_FILE of=$OUT_FILENAME bs=1K seek=512  conv=notrunc

    mkdir rootfs
    tar xf $ROOTFS_FILE -C ./rootfs

    cp -r $KERNEL_MODULES_DIR rootfs/usr/
    cp -r $SPEC_FILE rootfs/

    # add some custom modify
    for f in $SCRIPTES; do
        ROOTFS_PATH=./rootfs bash "$f" -H
    done

    fakeroot mksquashfs rootfs/ rootfs.img -no-exports -no-xattrs -all-root
    fakeroot mkfs.jffs2 -s 0x100 -e 0x10000 --pad=0x400000 -o jffs2.img -d overlay/

    dd if=rootfs.img of=$OUT_FILENAME  bs=1K seek=4608  conv=notrunc
    dd if=jffs2.img of=$OUT_FILENAME bs=1M seek=12 conv=notrunc

    rm -rf rootfs rootfs.img jffs2.img
启用Gadget与串口

需要增加一个开机启动脚本,指向前面文章的USB gadget的配置脚本。

需要修改/etc/inittab,增加ttyGS0的getty。

sed -i 's/\# Put a getty on the serial port/\# Put a getty on the serial port\nttyGS0::respawn:\/sbin\/getty -L ttyGS0 0 vt100 # GENERIC_SERIAL/g' $ROOTFS_PATH/etc/inittab
配置网络

修改/etc/network/interface,增加wlan0

auto wlan0
iface wlan0 inet dhcp
    pre-up wpa_supplicant -i wlan0 -c /overlay/etc/wpa_supplicant.conf -B
    wait-delay 15
    hostname $(hostname)
    post-down killall -q wpa_supplicant

为了使wpa_supplicant.conf可写,故我将其放在了overlay分区上。

配置挂载点

修改/etc/fstab,增加一行

/dev/mtdblock4  /overlay    jffs2   defaults    0   0

这就将第四分区挂载到了/overlay上。需要注意这个文件夹需要预先创建

配置wpa_supplicant

在overlay分区创建etc/wpa_supplicant.conf,内容如下:

    ctrl_interface=/var/run/wpa_supplicant
    ctrl_interface_group=wheel
    update_config=1
    eapol_version=1
    ap_scan=1
    fast_reauth=1

增加的update_config=1是为了让wpa_cli能够修改这个文件,保存wifi的配置。

创建/etc/wpa_supplicant/wpa_cli-action.sh,内容见:
https://git.yoctoproject.org/cgit/cgit.cgi/meta-intel-edison/plain/meta-intel-edison-distro/recipes-connectivity/wpa_supplicant/wpa-supplicant/wpa_cli-actions.sh

增加一个启动脚本,命令行为:

/usr/sbin/wpa_cli -a /etc/wpa_supplicant/wpa_cli-action.sh -B


上面的两个脚本的作用是让wpa_cli在Wifi连接上后调用wpa_cli-action.sh,从而自动调用udhcpc获取ip地址。

wifish

按照安装脚本将wifish的文件复制到它们应该在的地方。启动后就可以调用wifish来配置WiFi了。

离线

#2 2019-02-22 14:33:47

晕哥
Administrator
注册时间: 1970-01-01
累计积分: 5,730

Re: 荔枝派nano的SPI-Flash系统编译创建全过程

感谢长文分享!

希望 debugdump 早日可以加入赞赏和提现功能.

离线

#3 2019-02-22 14:37:49

smartcar
会员
注册时间: 2018-02-19
累计积分: 163

Re: 荔枝派nano的SPI-Flash系统编译创建全过程

太棒了, f1c100s  从零到整机!

离线

#4 2019-02-22 16:42:29

迪卡
会员
注册时间: 2018-11-02
累计积分: 49

Re: 荔枝派nano的SPI-Flash系统编译创建全过程

大佬,牛逼,大佬使我前进

离线

#5 2019-02-22 17:08:55

微凉VeiLiang
会员
注册时间: 2018-10-28
累计积分: 60

Re: 荔枝派nano的SPI-Flash系统编译创建全过程

感谢楼主无私分享

晕哥 说:

感谢长文分享!

希望 debugdump 早日可以加入赞赏和提现功能.

坐等晕哥发工资

离线

#6 2019-02-22 17:51:02

tianjjff
会员
注册时间: 2018-12-24
累计积分: 11

Re: 荔枝派nano的SPI-Flash系统编译创建全过程

膜拜大神,大神牛逼

离线

#7 2019-02-22 19:42:52

zzm24
会员
注册时间: 2018-05-07
累计积分: 13

Re: 荔枝派nano的SPI-Flash系统编译创建全过程

多谢分享

离线

#8 2019-02-22 21:10:11

tkyl01
会员
注册时间: 2018-11-19
累计积分: 9

Re: 荔枝派nano的SPI-Flash系统编译创建全过程

膜拜!

离线

#9 2019-02-23 13:34:37

小王子&木头人
会员
注册时间: 2018-05-08
累计积分: 19

Re: 荔枝派nano的SPI-Flash系统编译创建全过程

楼主是用buildroot2017.8 吗

离线

#10 2019-02-23 17:03:17

jiangming1399
会员
注册时间: 2018-06-14
累计积分: 24

Re: 荔枝派nano的SPI-Flash系统编译创建全过程

小王子&木头人 说:

楼主是用buildroot2017.8 吗

用的是最新的2018.11.1

离线

#11 2019-02-23 17:14:20

jiangming1399
会员
注册时间: 2018-06-14
累计积分: 24

Re: 荔枝派nano的SPI-Flash系统编译创建全过程

博客里面的文章更新了背光的调整设置,这里没法编辑原帖很难受

离线

#12 2019-02-23 20:16:51

qinxiongxu
会员
注册时间: 2018-12-13
累计积分: 40

Re: 荔枝派nano的SPI-Flash系统编译创建全过程

必须要赞一下~

离线

#13 2019-02-23 20:23:44

qinxiongxu
会员
注册时间: 2018-12-13
累计积分: 40

Re: 荔枝派nano的SPI-Flash系统编译创建全过程

jiangming1399 说:

原文发表在我博客上:荔枝派nano的SPI-Flash系统编译创建全过程

前言

本文的目标是创建一个运行在SPI-Flash上的精简系统,附带填一些前人没有提及的坑。在开始之前,请先通读官方教程的即食部分(U-Boot)、Linux编译SPI-Flash系统的创建部分的教程,并搭建好编译工具链。以下我假设你已经按照上面的教程下载好了U-Boot和Linux内核,并且到Buildroot的官网下载好了Buildroot(但没按教程创建config文件)。

SPI-Flash的分区结构

以下是我这里的分区结构。你可以自由的分配后面两个分区的大小。

ID  SIZE    USAGE   ADDR
0   448kb   U-boot  0x0000 0000 - 0x0007 0000
1   64kb    dtb     0x0007 0000 - 0x0008 0000
2   4mb     kernel  0x0008 0000 - 0x0048 0000
3   7.5mb   rootfs  0x0048 0000 - 0x00c0 0000
4   4mb     overlay 0x00c0 0000 - 0x0100 0000   
U-Boot的编译和填坑

按照上面的U-Boot的编译教程来编译基本上是没有什么太大问题。我这里就说一下上面教程里面没有说的配置:

设置内核启动参数

勾上

Enable boot arguments

,然后在下面填上:

panic=5 rootwait root=/dev/mtdblock3 rw rootfstype=squashfs

其中,root=/dev/mtdblock3指定了第3分区为rootfs所在分区,rootfstype=squashfs指定了这个分区的格式是squashfs。

设置Bootcmd

勾上

Enable a default value for bootcmd

,然后在下面填上:

sf probe 0 60000000; sf read 0x80c00000 0x70000 0x10000; sf read 0x80008000 0x80000 0x400000; bootz 0x80008000 - 0x80c00000

0x70000和0x80000分别是分区1和2的起始地址。

减小U-Boot体积

默认配置下,U-Boot的体积是接近1M的,但实际上U-Boot本体才270k左右。多余的空间实际上是被环境配置所占据了。

进入Environment菜单,找到Environment Offset。这个Offset就是配置的偏移地址,只要它比U-Boot本体大就可以了。这里我设置成0x68000,并将Environment Size设置成0x8000,这样编译出来的U-Boot大小就正好是0x70000,也就是448kb。

设置显示输出日志

勾上Console下的 Enable console multiplexing 和 Select console devices from environment,就可以在屏幕上看到启动日志了。

Linux的编译和填坑

Linux的坑就稍微有些多了。在做接下来的东西之前,你最好先载入官方的配置文件。

SPI-Flash的支持

进入 Device Drivers -> SPI support,将 Allwinner A10 SoCs SPI controller取消勾选,然后勾上下面的Allwinner A31 SPI Controller。这是为了修正配置文件中SPI驱动不正确的问题。

勾上并进入 Device Drivers -> Memory Technology Device (MTD) support,选上下面两项:

  • Command line partitioning table parsing #为了解析内核参数传过来的分区信息,如果用设备树应该可以不选

  • Caching block device access to MTD devices  #为了生成/dev/mtdblock*设备,不选会报错

取消勾选 General setup -> initramfs support (存疑)。

再进入Filesystem Drivers,选上JFFS2和SquashFS的支持。

然后打开drivers/mtd/spi-nor/spi-nor.c,检查自己的flash型号的参数是否含有SECT_4K,如果有则改为0。例如对于w25q128,需要将

 { "w25q128", INFO(0xef4018, 0, 64 * 1024, 256, SECT_4K) },

改为

{ "w25q128", INFO(0xef4018, 0, 64 * 1024, 256, 0) }

最后修改设备树文件中的分区信息,可以参考前面官方教程里面的dts修改章节。

flash@0 {
    #address-cells = <1>;
    #size-cells = <1>;
    compatible = "macronix,mx25l12805d", "jedec,spi-nor";
    reg = <0>;
    spi-max-frequency = <50000000>;
    partitions {
      compatible = "fixed-partitions";
      #address-cells = <1>;
      #size-cells = <1>;

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

      partition@70000 {
        label = "dtb";
        reg = <0x70000 0x10000>;
        read-only;
      };

      partition@80000 {
        label = "kernel";
        reg = <0x80000 0x400000>;
        read-only;
      };

      partition@480000 {
        label = "rootfs";
        reg = <0x480000 0x780000>;
      };
      
      partition@c00000 {
        label = "overlayfs";
        reg = <0xc00000 0x400000>;
      };
    };
  };
USB Gadget的支持

为了方便调试,需要启用USB Gadget。

转到 Device Driver -> USB support -> USB Gadget support,勾上 Usb gadget functions configurable through configfs,和上面的Serial gadget console support,以及下面的CDC ACM、CDC ECM、RNDIS、FunctionFS,再取消USB Gadget precomposed configurations的勾选。(具体原因和操作方法可以看我前面的文章

对文件drivers/clk/sunxi-ng/ccu-suniv.c应用下面这个补丁,修正USB驱动问题

--- ../linux/drivers/clk/sunxi-ng/ccu-suniv.c    2019-01-15 22:48:18.824587965 +0800
+++ drivers/clk/sunxi-ng/ccu-suniv.c    2019-01-23 09:05:17.959348454 +0800
@@ -238,7 +238,7 @@
/* The BSP header file has a CIR_CFG, but no mod clock uses this definition */

static SUNXI_CCU_GATE(usb_phy0_clk,    "usb-phy0",    "osc24M",
-              0x0cc, BIT(8), 0);
+              0x0cc, BIT(1), 0);

static SUNXI_CCU_GATE(dram_ve_clk,    "dram-ve",    "pll-ddr",
              0x100, BIT(0), 0);
Wifi支持

我这里用的是rtl8723bs,所以在drivers->staging里面启用相关的驱动就可以了。

Buildroot的使用和rootfs的编译

下载Buildroot后解压,不要使用官方的配置文件,应当自己从零开始编译。

基础设置
Target options
  -- Target Architecture (ARM (little endian))
  -- Target Variant arm926t
Toolchain
  -- C library (musl) # 使用musl减小最终体积
System configuration
  -- Use syslinks to /usr .... # 启用/bin, /sbin, /lib的链接
  -- Enable root login # 启用root登录
  -- Run a getty after boot # 启用登录密码输入窗口
  -- remount root filesystem # 重新挂载根文件系统到可读写
  -- Install Timezone info # 安装时区信息。我的程序需要所以就打开了这个玩意
     -- timezone list (asia)
     -- default local time (Asia/Shanghai)
Target Packages
  -- mount/umount # 如果要用overlayfs,那就要用这个挂载
网络部分软件包

这里我给出包名然后自己搜素就好了

  • ifupdown scripts

  • iw # 用做无线网络管理的,可不要

  • wpa_supplicant # 无线网络管理需要这个玩意

  • linux-firmware -> rtl87xx # 无线网卡的固件

其他可能需要的软件包
  • lrzsz # rz/sz命令,用于传输文件

  • gawk # 用于解析iw命令的输出

  • dialog # 用于wifish管理的图形界面的生成

Busybox的设置

有一些软件包在busybox内是自带的,可以到使用busybox的menuconfig进行配置。需要先运行一次make生成busybox的构建文件夹,然后再使用 make busybox-menuconfig 配置。每次clean后都需要重新配置一次,因为在clean的时候这个配置会被清除。

可能需要的软件包:

  • ntpd # 网络自动校正时间

  • udhcpc # dhcp客户端

烧写镜像的生成和其他设置

下面所说的所有操作都包含在这个打包脚本里面了:licheepi-nano-image-master

镜像的生成

这里有个脚本可以一键生成镜像。

    OUT_FILENAME="flashimg.bin"

    UBOOT_FILE=../u-boot-new/u-boot-sunxi-with-spl.bin
    KERNEL_DIR=../linux
    KERNEL_MODULES_DIR=$KERNEL_DIR/out/*
    DTB_FILE=$KERNEL_DIR/arch/arm/boot/dts/suniv-f1c100s-licheepi-nano.dtb
    KERNEL_FILE=$KERNEL_DIR/arch/arm/boot/zImage
    ROOTFS_FILE=../buildroot-2018.11.1/output/images/rootfs.tar
    SPEC_FILE=./custom/*
    SCRIPTES=./scripts/*.sh

    dd if=/dev/zero of=$OUT_FILENAME bs=1M count=16
    dd if=$UBOOT_FILE of=$OUT_FILENAME bs=1K conv=notrunc
    dd if=$DTB_FILE of=$OUT_FILENAME bs=1K seek=448  conv=notrunc
    dd if=$KERNEL_FILE of=$OUT_FILENAME bs=1K seek=512  conv=notrunc

    mkdir rootfs
    tar xf $ROOTFS_FILE -C ./rootfs

    cp -r $KERNEL_MODULES_DIR rootfs/usr/
    cp -r $SPEC_FILE rootfs/

    # add some custom modify
    for f in $SCRIPTES; do
        ROOTFS_PATH=./rootfs bash "$f" -H
    done

    fakeroot mksquashfs rootfs/ rootfs.img -no-exports -no-xattrs -all-root
    fakeroot mkfs.jffs2 -s 0x100 -e 0x10000 --pad=0x400000 -o jffs2.img -d overlay/

    dd if=rootfs.img of=$OUT_FILENAME  bs=1K seek=4608  conv=notrunc
    dd if=jffs2.img of=$OUT_FILENAME bs=1M seek=12 conv=notrunc

    rm -rf rootfs rootfs.img jffs2.img
启用Gadget与串口

需要增加一个开机启动脚本,指向前面文章的USB gadget的配置脚本。

需要修改/etc/inittab,增加ttyGS0的getty。

sed -i 's/\# Put a getty on the serial port/\# Put a getty on the serial port\nttyGS0::respawn:\/sbin\/getty -L ttyGS0 0 vt100 # GENERIC_SERIAL/g' $ROOTFS_PATH/etc/inittab
配置网络

修改/etc/network/interface,增加wlan0

auto wlan0
iface wlan0 inet dhcp
    pre-up wpa_supplicant -i wlan0 -c /overlay/etc/wpa_supplicant.conf -B
    wait-delay 15
    hostname $(hostname)
    post-down killall -q wpa_supplicant

为了使wpa_supplicant.conf可写,故我将其放在了overlay分区上。

配置挂载点

修改/etc/fstab,增加一行

/dev/mtdblock4  /overlay    jffs2   defaults    0   0

这就将第四分区挂载到了/overlay上。需要注意这个文件夹需要预先创建

配置wpa_supplicant

在overlay分区创建etc/wpa_supplicant.conf,内容如下:

    ctrl_interface=/var/run/wpa_supplicant
    ctrl_interface_group=wheel
    update_config=1
    eapol_version=1
    ap_scan=1
    fast_reauth=1

增加的update_config=1是为了让wpa_cli能够修改这个文件,保存wifi的配置。

创建/etc/wpa_supplicant/wpa_cli-action.sh,内容见:
https://git.yoctoproject.org/cgit/cgit.cgi/meta-intel-edison/plain/meta-intel-edison-distro/recipes-connectivity/wpa_supplicant/wpa-supplicant/wpa_cli-actions.sh

增加一个启动脚本,命令行为:

/usr/sbin/wpa_cli -a /etc/wpa_supplicant/wpa_cli-action.sh -B


上面的两个脚本的作用是让wpa_cli在Wifi连接上后调用wpa_cli-action.sh,从而自动调用udhcpc获取ip地址。

wifish

按照安装脚本将wifish的文件复制到它们应该在的地方。启动后就可以调用wifish来配置WiFi了。


可以分享下源码下载链接吗?

离线

#14 2019-02-26 15:53:54

刘少来了
会员
注册时间: 2019-01-24
累计积分: 19

Re: 荔枝派nano的SPI-Flash系统编译创建全过程

楼主,我按照你的改了一部分,启动log如下,一直打印 can't open /dev/ttyS0: Permission denied,有什么方法能解决吗

U-Boot 2018.01-05679-g013ca45-dirty (Feb 25 2019 - 16:03:42 +0800) Allwinner Technology

CPU:   Allwinner F Series (SUNIV)
Model: Lichee Pi Nano
DRAM:  32 MiB
MMC:   SUNXI SD/MMC: 0
SF: Detected w25q128bv with page size 256 Bytes, erase size 4 KiB, total 16 MiB
*** Warning - bad CRC, using default environment

Setting up a 480x272 lcd console (overscan 0x0)
In:    serial@1c25000
Out:   serial@1c25000
Err:   serial@1c25000
Net:   No ethernet found.
starting USB...
No controllers found
Hit any key to stop autoboot:  0 
SF: Detected w25q128bv with page size 256 Bytes, erase size 4 KiB, total 16 MiB
device 0 offset 0x100000, size 0x4000
SF: 16384 bytes @ 0x100000 Read: OK
device 0 offset 0x110000, size 0x400000
SF: 4194304 bytes @ 0x110000 Read: OK
## Flattened Device Tree blob at 80c00000
   Booting using the fdt blob at 0x80c00000
   Loading Device Tree to 80e5f000, end 80e640ee ... OK

Starting kernel ...

[    0.000000] Booting Linux on physical CPU 0x0
[    0.000000] Linux version 4.15.0-rc8-licheepi-nano+ (gsk@gsk-machine) (gcc version 7.2.1 20171011 (Linaro GCC 7.2-2017.11)) #8 Tue Feb 26 11:36:29 CST 2019
[    0.000000] CPU: ARM926EJ-S [41069265] revision 5 (ARMv5TEJ), cr=0005317f
[    0.000000] CPU: VIVT data cache, VIVT instruction cache
[    0.000000] OF: fdt: Machine model: Lichee Pi Nano
[    0.000000] Memory policy: Data cache writeback
[    0.000000] random: fast init done
[    0.000000] Built 1 zonelists, mobility grouping on.  Total pages: 8128
[    0.000000] Kernel command line: console=ttyS0,115200 panic=5 rootwait root=31:3 rw rootfstype=jffs2
[    0.000000] Dentry cache hash table entries: 4096 (order: 2, 16384 bytes)
[    0.000000] Inode-cache hash table entries: 2048 (order: 1, 8192 bytes)
[    0.000000] Memory: 22672K/32768K available (6144K kernel code, 237K rwdata, 1412K rodata, 1024K init, 246K bss, 10096K 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 : 0xc2800000 - 0xff800000   ( 976 MB)
[    0.000000]     lowmem  : 0xc0000000 - 0xc2000000   (  32 MB)
[    0.000000]     pkmap   : 0xbfe00000 - 0xc0000000   (   2 MB)
[    0.000000]     modules : 0xbf000000 - 0xbfe00000   (  14 MB)
[    0.000000]       .text : 0x(ptrval) - 0x(ptrval)   (7136 kB)
[    0.000000]       .init : 0x(ptrval) - 0x(ptrval)   (1024 kB)
[    0.000000]       .data : 0x(ptrval) - 0x(ptrval)   ( 238 kB)
[    0.000000]        .bss : 0x(ptrval) - 0x(ptrval)   ( 247 kB)
[    0.000000] SLUB: HWalign=32, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
[    0.000000] NR_IRQS: 16, nr_irqs: 16, preallocated irqs: 16
[    0.000047] sched_clock: 32 bits at 24MHz, resolution 41ns, wraps every 89478484971ns
[    0.000112] clocksource: timer: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 79635851949 ns
[    0.000664] Console: colour dummy device 80x30
[    0.000755] Calibrating delay loop... 203.16 BogoMIPS (lpj=1015808)
[    0.070233] pid_max: default: 32768 minimum: 301
[    0.070547] Mount-cache hash table entries: 1024 (order: 0, 4096 bytes)
[    0.070594] Mountpoint-cache hash table entries: 1024 (order: 0, 4096 bytes)
[    0.072020] CPU: Testing write buffer coherency: ok
[    0.073716] Setting up static identity map for 0x80100000 - 0x80100058
[    0.076282] devtmpfs: initialized
[    0.083124] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 19112604462750000 ns
[    0.083190] futex hash table entries: 256 (order: -1, 3072 bytes)
[    0.083448] pinctrl core: initialized pinctrl subsystem
[    0.085490] NET: Registered protocol family 16
[    0.086956] DMA: preallocated 256 KiB pool for atomic coherent allocations
[    0.088749] cpuidle: using governor menu
[    0.115003] SCSI subsystem initialized
[    0.115359] usbcore: registered new interface driver usbfs
[    0.115506] usbcore: registered new interface driver hub
[    0.115710] usbcore: registered new device driver usb
[    0.116134] pps_core: LinuxPPS API ver. 1 registered
[    0.116159] pps_core: Software ver. 5.3.6 - Copyright 2005-2007 Rodolfo Giometti <giometti@linux.it>
[    0.116218] PTP clock support registered
[    0.116702] Advanced Linux Sound Architecture Driver Initialized.
[    0.118223] clocksource: Switched to clocksource timer
[    0.144944] NET: Registered protocol family 2
[    0.146376] TCP established hash table entries: 1024 (order: 0, 4096 bytes)
[    0.146454] TCP bind hash table entries: 1024 (order: 0, 4096 bytes)
[    0.146505] TCP: Hash tables configured (established 1024 bind 1024)
[    0.146790] UDP hash table entries: 256 (order: 0, 4096 bytes)
[    0.146849] UDP-Lite hash table entries: 256 (order: 0, 4096 bytes)
[    0.147324] NET: Registered protocol family 1
[    0.148673] RPC: Registered named UNIX socket transport module.
[    0.148713] RPC: Registered udp transport module.
[    0.148729] RPC: Registered tcp transport module.
[    0.148744] RPC: Registered tcp NFSv4.1 backchannel transport module.
[    0.150954] NetWinder Floating Point Emulator V0.97 (double precision)
[    0.152803] Initialise system trusted keyrings
[    0.153359] workingset: timestamp_bits=30 max_order=13 bucket_order=0
[    0.171055] NFS: Registering the id_resolver key type
[    0.171148] Key type id_resolver registered
[    0.171166] Key type id_legacy registered
[    0.171281] jffs2: version 2.2. (NAND) © 2001-2006 Red Hat, Inc.
[    0.186075] Key type asymmetric registered
[    0.186117] Asymmetric key parser 'x509' registered
[    0.186319] Block layer SCSI generic (bsg) driver version 0.4 loaded (major 251)
[    0.186353] io scheduler noop registered
[    0.186372] io scheduler deadline registered
[    0.187155] io scheduler cfq registered (default)
[    0.187188] io scheduler mq-deadline registered
[    0.187207] io scheduler kyber registered
[    0.188482] sun4i-usb-phy 1c13400.phy: Couldn't request ID GPIO
[    0.198077] suniv-pinctrl 1c20800.pinctrl: initialized sunXi PIO driver
[    0.370039] Serial: 8250/16550 driver, 8 ports, IRQ sharing disabled
[    0.376795] console [ttyS0] disabled
[    0.397057] 1c25000.serial: ttyS0 at MMIO 0x1c25000 (irq = 24, base_baud = 6250000) is a 16550A
[    0.869998] console [ttyS0] enabled
[    0.880791] panel-simple panel: panel supply power not found, using dummy regulator
[    0.890232] SCSI Media Changer driver v0.25 
[    0.897921] m25p80 spi0.0: w25q128 (16384 Kbytes)
[    0.902818] 4 ofpart partitions found on MTD device spi0.0
[    0.908367] Creating 4 MTD partitions on "spi0.0":
[    0.913176] 0x000000000000-0x000000100000 : "u-boot"
[    0.920889] 0x000000100000-0x000000110000 : "dtb"
[    0.928094] 0x000000110000-0x000000510000 : "kernel"
[    0.935664] 0x000000510000-0x000001000000 : "rootfs"
[    0.943795] ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
[    0.950458] ehci-platform: EHCI generic platform driver
[    0.955988] ohci_hcd: USB 1.1 'Open' Host Controller (OHCI) Driver
[    0.962289] ohci-platform: OHCI generic platform driver
[    0.967950] usbcore: registered new interface driver usb-storage
[    0.975005] udc-core: couldn't find an available UDC - added [g_cdc] to list of pending drivers
[    0.984068] i2c /dev entries driver
[    1.048356] sunxi-mmc 1c0f000.mmc: base:0xea95933e irq:20
[    1.055819] usbcore: registered new interface driver usbhid
[    1.061517] usbhid: USB HID core driver
[    1.083512] NET: Registered protocol family 17
[    1.088196] Key type dns_resolver registered
[    1.094749] Loading compiled-in X.509 certificates
[    1.110731] sun4i-drm display-engine: bound 1e60000.display-backend (ops 0xc0739c38)
[    1.119636] sun4i-drm display-engine: bound 1c0c000.lcd-controller (ops 0xc0738f1c)
[    1.127301] [drm] Supports vblank timestamp caching Rev 2 (21.10.2013).
[    1.134019] [drm] No driver support for vblank timestamp query.
[    1.150448] mmc0: queuing unknown CIS tuple 0x01 (3 bytes)
[    1.157736] mmc0: queuing unknown CIS tuple 0x1a (5 bytes)
[    1.161061] mmc0: queuing unknown CIS tuple 0x1b (8 bytes)
[    1.163539] mmc0: queuing unknown CIS tuple 0x80 (1 bytes)
[    1.163632] mmc0: queuing unknown CIS tuple 0x81 (1 bytes)
[    1.164263] mmc0: queuing unknown CIS tuple 0x82 (1 bytes)
[    1.164357] mmc0: new high speed SDIO card at address 0001
[    1.188125] Console: switching to colour frame buffer device 60x34
[    1.249871] sun4i-drm display-engine: fb0:  frame buffer device
[    1.256980] [drm] Initialized sun4i-drm 1.0.0 20150629 for display-engine on minor 0
[    1.266209] usb_phy_generic usb_phy_generic.0.auto: usb_phy_generic.0.auto supply vcc not found, using dummy regulator
[    1.278079] musb-hdrc musb-hdrc.1.auto: MUSB HDRC host driver
[    1.284044] musb-hdrc musb-hdrc.1.auto: new USB bus registered, assigned bus number 1
[    1.294088] hub 1-0:1.0: USB hub found
[    1.298005] hub 1-0:1.0: 1 port detected
[    1.303680] using random self ethernet address
[    1.308148] using random host ethernet address
[    1.314464] usb0: HOST MAC 9e:95:18:25:11:ff
[    1.319037] usb0: MAC 2e:d1:6d:fe:c1:28
[    1.322980] g_cdc gadget: CDC Composite Gadget, version: King Kamehameha Day 2008
[    1.330543] g_cdc gadget: g_cdc ready
[    1.335257] cfg80211: Loading compiled-in X.509 certificates for regulatory database
[    1.352882] cfg80211: Loaded X.509 cert 'sforshee: 00b28ddf47aef9cea7'
[    1.359699] ALSA device list:
[    1.362684]   #0: Loopback 1
[    1.366438] platform regulatory.0: Direct firmware load for regulatory.db failed with error -2
[    1.375194] cfg80211: failed to load regulatory.db
[    1.475892] random: crng init done
[    2.943518] VFS: Mounted root (jffs2 filesystem) on device 31:3.
[    2.951360] devtmpfs: mounted
[    2.959088] Freeing unused kernel memory: 1024K
mount: only root can use "--types" option (effective UID is 1000)
mount: only root can use "--options" option (effective UID is 1000)
mkdir: can't create directory '/dev/pts': Permission denied
mkdir: can't create directory '/dev/shm': Permission denied
mount: only root can use "--all" option (effective UID is 1000)
hostname: sethostname: Operation not permitted
Starting logging: OK
Initializing random number generator... done.
can't open /dev/ttyS0: Permission denied
can't open /dev/ttyS0: Permission denied
can't open /dev/ttyS0: Permission denied
can't open /dev/ttyS0: Permission denied
can't open /dev/ttyS0: Permission denied
can't open /dev/ttyS0: Permission denied
can't open /dev/ttyS0: Permission denied
can't open /dev/ttyS0: Permission denied

离线

#15 2019-02-26 18:30:19

jiangming1399
会员
注册时间: 2018-06-14
累计积分: 24

Re: 荔枝派nano的SPI-Flash系统编译创建全过程

刘少来了 说:

楼主,我按照你的改了一部分,启动log如下,一直打印 can't open /dev/ttyS0: Permission denied,有什么方法能解决吗

USB那里没有启用gadget。要么把gadget打开,要么修改inittab把里面的/dev/ttyS0的getty给删了

离线

#16 2019-02-27 11:48:32

刘少来了
会员
注册时间: 2019-01-24
累计积分: 19

Re: 荔枝派nano的SPI-Flash系统编译创建全过程

jiangming1399 说:
刘少来了 说:

楼主,我按照你的改了一部分,启动log如下,一直打印 can't open /dev/ttyS0: Permission denied,有什么方法能解决吗

USB那里没有启用gadget。要么把gadget打开,要么修改inittab把里面的/dev/ttyS0的getty给删了

开启了gadget后,启动log基本没变化,但是改了inittab后,启动log如下,还是卡住了 - -。感觉是root权限的问题,有没有什么方法,让开机启动时就是root

U-Boot SPL 2018.01-05679-g013ca45-dirty (Feb 25 2019 - 16:03:42)
DRAM: 32 MiB
Trying to boot from MMC1
Card did not respond to voltage select!
mmc_init: -95, time 22
spl: mmc init failed with error: -95
Trying to boot from sunxi SPI


U-Boot 2018.01-05679-g013ca45-dirty (Feb 25 2019 - 16:03:42 +0800) Allwinner Technology

CPU:   Allwinner F Series (SUNIV)
Model: Lichee Pi Nano
DRAM:  32 MiB
MMC:   SUNXI SD/MMC: 0
SF: Detected w25q128bv with page size 256 Bytes, erase size 4 KiB, total 16 MiB
*** Warning - bad CRC, using default environment

Setting up a 480x272 lcd console (overscan 0x0)
In:    serial@1c25000
Out:   serial@1c25000
Err:   serial@1c25000
Net:   No ethernet found.
starting USB...
No controllers found
Hit any key to stop autoboot:  0 
SF: Detected w25q128bv with page size 256 Bytes, erase size 4 KiB, total 16 MiB
device 0 offset 0x100000, size 0x4000
SF: 16384 bytes @ 0x100000 Read: OK
device 0 offset 0x110000, size 0x400000
SF: 4194304 bytes @ 0x110000 Read: OK
## Flattened Device Tree blob at 80c00000
   Booting using the fdt blob at 0x80c00000
   Loading Device Tree to 80e5f000, end 80e640ee ... OK

Starting kernel ...

[    0.000000] Booting Linux on physical CPU 0x0
[    0.000000] Linux version 4.15.0-rc8-licheepi-nano+ (gsk@gsk-machine) (gcc version 7.2.1 20171011 (Linaro GCC 7.2-2017.11)) #9 Wed Feb 27 10:33:51 CST 2019
[    0.000000] CPU: ARM926EJ-S [41069265] revision 5 (ARMv5TEJ), cr=0005317f
[    0.000000] CPU: VIVT data cache, VIVT instruction cache
[    0.000000] OF: fdt: Machine model: Lichee Pi Nano
[    0.000000] Memory policy: Data cache writeback
[    0.000000] random: fast init done
[    0.000000] Built 1 zonelists, mobility grouping on.  Total pages: 8128
[    0.000000] Kernel command line: console=ttyS0,115200 panic=5 rootwait root=31:3 rw rootfstype=jffs2
[    0.000000] Dentry cache hash table entries: 4096 (order: 2, 16384 bytes)
[    0.000000] Inode-cache hash table entries: 2048 (order: 1, 8192 bytes)
[    0.000000] Memory: 22672K/32768K available (6144K kernel code, 238K rwdata, 1416K rodata, 1024K init, 246K bss, 10096K 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 : 0xc2800000 - 0xff800000   ( 976 MB)
[    0.000000]     lowmem  : 0xc0000000 - 0xc2000000   (  32 MB)
[    0.000000]     pkmap   : 0xbfe00000 - 0xc0000000   (   2 MB)
[    0.000000]     modules : 0xbf000000 - 0xbfe00000   (  14 MB)
[    0.000000]       .text : 0x(ptrval) - 0x(ptrval)   (7136 kB)
[    0.000000]       .init : 0x(ptrval) - 0x(ptrval)   (1024 kB)
[    0.000000]       .data : 0x(ptrval) - 0x(ptrval)   ( 239 kB)
[    0.000000]        .bss : 0x(ptrval) - 0x(ptrval)   ( 247 kB)
[    0.000000] SLUB: HWalign=32, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
[    0.000000] NR_IRQS: 16, nr_irqs: 16, preallocated irqs: 16
[    0.000046] sched_clock: 32 bits at 24MHz, resolution 41ns, wraps every 89478484971ns
[    0.000113] clocksource: timer: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 79635851949 ns
[    0.000654] Console: colour dummy device 80x30
[    0.000744] Calibrating delay loop... 203.16 BogoMIPS (lpj=1015808)
[    0.070237] pid_max: default: 32768 minimum: 301
[    0.070548] Mount-cache hash table entries: 1024 (order: 0, 4096 bytes)
[    0.070592] Mountpoint-cache hash table entries: 1024 (order: 0, 4096 bytes)
[    0.072029] CPU: Testing write buffer coherency: ok
[    0.073726] Setting up static identity map for 0x80100000 - 0x80100058
[    0.076301] devtmpfs: initialized
[    0.083113] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 19112604462750000 ns
[    0.083180] futex hash table entries: 256 (order: -1, 3072 bytes)
[    0.083432] pinctrl core: initialized pinctrl subsystem
[    0.085468] NET: Registered protocol family 16
[    0.086922] DMA: preallocated 256 KiB pool for atomic coherent allocations
[    0.088780] cpuidle: using governor menu
[    0.114373] SCSI subsystem initialized
[    0.114707] usbcore: registered new interface driver usbfs
[    0.114883] usbcore: registered new interface driver hub
[    0.115092] usbcore: registered new device driver usb
[    0.115516] pps_core: LinuxPPS API ver. 1 registered
[    0.115545] pps_core: Software ver. 5.3.6 - Copyright 2005-2007 Rodolfo Giometti <giometti@linux.it>
[    0.115605] PTP clock support registered
[    0.116107] Advanced Linux Sound Architecture Driver Initialized.
[    0.117604] clocksource: Switched to clocksource timer
[    0.144550] NET: Registered protocol family 2
[    0.145971] TCP established hash table entries: 1024 (order: 0, 4096 bytes)
[    0.146050] TCP bind hash table entries: 1024 (order: 0, 4096 bytes)
[    0.146101] TCP: Hash tables configured (established 1024 bind 1024)
[    0.146381] UDP hash table entries: 256 (order: 0, 4096 bytes)
[    0.146437] UDP-Lite hash table entries: 256 (order: 0, 4096 bytes)
[    0.146916] NET: Registered protocol family 1
[    0.148296] RPC: Registered named UNIX socket transport module.
[    0.148341] RPC: Registered udp transport module.
[    0.148359] RPC: Registered tcp transport module.
[    0.148375] RPC: Registered tcp NFSv4.1 backchannel transport module.
[    0.150559] NetWinder Floating Point Emulator V0.97 (double precision)
[    0.152384] Initialise system trusted keyrings
[    0.152937] workingset: timestamp_bits=30 max_order=13 bucket_order=0
[    0.170544] NFS: Registering the id_resolver key type
[    0.170624] Key type id_resolver registered
[    0.170643] Key type id_legacy registered
[    0.170755] jffs2: version 2.2. (NAND) © 2001-2006 Red Hat, Inc.
[    0.185427] Key type asymmetric registered
[    0.185471] Asymmetric key parser 'x509' registered
[    0.185684] Block layer SCSI generic (bsg) driver version 0.4 loaded (major 251)
[    0.185718] io scheduler noop registered
[    0.185736] io scheduler deadline registered
[    0.186516] io scheduler cfq registered (default)
[    0.186551] io scheduler mq-deadline registered
[    0.186571] io scheduler kyber registered
[    0.187831] sun4i-usb-phy 1c13400.phy: Couldn't request ID GPIO
[    0.197509] suniv-pinctrl 1c20800.pinctrl: initialized sunXi PIO driver
[    0.370938] Serial: 8250/16550 driver, 8 ports, IRQ sharing disabled
[    0.377848] console [ttyS0] disabled
[    0.398078] 1c25000.serial: ttyS0 at MMIO 0x1c25000 (irq = 24, base_baud = 6250000) is a 16550A
[    0.871088] console [ttyS0] enabled
[    0.881922] panel-simple panel: panel supply power not found, using dummy regulator
[    0.891342] SCSI Media Changer driver v0.25 
[    0.899231] m25p80 spi0.0: w25q128 (16384 Kbytes)
[    0.904015] 4 ofpart partitions found on MTD device spi0.0
[    0.909607] Creating 4 MTD partitions on "spi0.0":
[    0.914419] 0x000000000000-0x000000100000 : "u-boot"
[    0.922064] 0x000000100000-0x000000110000 : "dtb"
[    0.929416] 0x000000110000-0x000000510000 : "kernel"
[    0.936807] 0x000000510000-0x000001000000 : "rootfs"
[    0.944964] ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
[    0.951625] ehci-platform: EHCI generic platform driver
[    0.957152] ohci_hcd: USB 1.1 'Open' Host Controller (OHCI) Driver
[    0.963459] ohci-platform: OHCI generic platform driver
[    0.969146] usbcore: registered new interface driver usb-storage
[    0.976344] i2c /dev entries driver
[    1.037743] sunxi-mmc 1c0f000.mmc: base:0x8f3b36d4 irq:20
[    1.045191] usbcore: registered new interface driver usbhid
[    1.050892] usbhid: USB HID core driver
[    1.073039] NET: Registered protocol family 17
[    1.077843] Key type dns_resolver registered
[    1.084271] Loading compiled-in X.509 certificates
[    1.100003] sun4i-drm display-engine: bound 1e60000.display-backend (ops 0xc0739c38)
[    1.108905] sun4i-drm display-engine: bound 1c0c000.lcd-controller (ops 0xc0738f1c)
[    1.116570] [drm] Supports vblank timestamp caching Rev 2 (21.10.2013).
[    1.123289] [drm] No driver support for vblank timestamp query.
[    1.139386] mmc0: queuing unknown CIS tuple 0x01 (3 bytes)
[    1.146658] mmc0: queuing unknown CIS tuple 0x1a (5 bytes)
[    1.149990] mmc0: queuing unknown CIS tuple 0x1b (8 bytes)
[    1.152480] mmc0: queuing unknown CIS tuple 0x80 (1 bytes)
[    1.152573] mmc0: queuing unknown CIS tuple 0x81 (1 bytes)
[    1.152654] mmc0: queuing unknown CIS tuple 0x82 (1 bytes)
[    1.152720] mmc0: new high speed SDIO card at address 0001
[    1.177349] Console: switching to colour frame buffer device 60x34
[    1.239112] sun4i-drm display-engine: fb0:  frame buffer device
[    1.246241] [drm] Initialized sun4i-drm 1.0.0 20150629 for display-engine on minor 0
[    1.255464] usb_phy_generic usb_phy_generic.0.auto: usb_phy_generic.0.auto supply vcc not found, using dummy regulator
[    1.267315] musb-hdrc musb-hdrc.1.auto: MUSB HDRC host driver
[    1.273281] musb-hdrc musb-hdrc.1.auto: new USB bus registered, assigned bus number 1
[    1.283349] hub 1-0:1.0: USB hub found
[    1.287278] hub 1-0:1.0: 1 port detected
[    1.293692] cfg80211: Loading compiled-in X.509 certificates for regulatory database
[    1.311371] cfg80211: Loaded X.509 cert 'sforshee: 00b28ddf47aef9cea7'
[    1.318191] ALSA device list:
[    1.321171]   #0: Loopback 1
[    1.324977] platform regulatory.0: Direct firmware load for regulatory.db failed with error -2
[    1.333694] cfg80211: failed to load regulatory.db
[    1.435349] random: crng init done
[    2.914720] VFS: Mounted root (jffs2 filesystem) on device 31:3.
[    2.922582] devtmpfs: mounted
[    2.930312] Freeing unused kernel memory: 1024K
mount: only root can use "--types" option (effective UID is 1000)
mount: only root can use "--options" option (effective UID is 1000)
mkdir: can't create directory '/dev/pts': Permission denied
mkdir: can't create directory '/dev/shm': Permission denied
mount: only root can use "--all" option (effective UID is 1000)
hostname: sethostname: Operation not permitted
Starting logging: OK
Initializing random number generator... done.

离线

#17 2019-02-27 13:05:42

jiangming1399
会员
注册时间: 2018-06-14
累计积分: 24

Re: 荔枝派nano的SPI-Flash系统编译创建全过程

刘少来了 说:
jiangming1399 说:
刘少来了 说:

楼主,我按照你的改了一部分,启动log如下,一直打印 can't open /dev/ttyS0: Permission denied,有什么方法能解决吗

USB那里没有启用gadget。要么把gadget打开,要么修改inittab把里面的/dev/ttyS0的getty给删了

开启了gadget后,启动log基本没变化,但是改了inittab后,启动log如下,还是卡住了 - -。感觉是root权限的问题,有没有什么方法,让开机启动时就是root


mount: only root can use "--types" option (effective UID is 1000)
mount: only root can use "--options" option (effective UID is 1000)
mkdir: can't create directory '/dev/pts': Permission denied
mkdir: can't create directory '/dev/shm': Permission denied
mount: only root can use "--all" option (effective UID is 1000)
hostname: sethostname: Operation not permitted
Starting logging: OK
Initializing random number generator... done.

按理说默认就是root用户才对啊,你构建jffs2的时候有没有用fakeroot?

离线

#18 2019-02-27 14:25:45

刘少来了
会员
注册时间: 2019-01-24
累计积分: 19

Re: 荔枝派nano的SPI-Flash系统编译创建全过程

jiangming1399 说:
刘少来了 说:
jiangming1399 说:

USB那里没有启用gadget。要么把gadget打开,要么修改inittab把里面的/dev/ttyS0的getty给删了

开启了gadget后,启动log基本没变化,但是改了inittab后,启动log如下,还是卡住了 - -。感觉是root权限的问题,有没有什么方法,让开机启动时就是root


mount: only root can use "--types" option (effective UID is 1000)
mount: only root can use "--options" option (effective UID is 1000)
mkdir: can't create directory '/dev/pts': Permission denied
mkdir: can't create directory '/dev/shm': Permission denied
mount: only root can use "--all" option (effective UID is 1000)
hostname: sethostname: Operation not permitted
Starting logging: OK
Initializing random number generator... done.

按理说默认就是root用户才对啊,你构建jffs2的时候有没有用fakeroot?


没有,我用的官网提供的buildroot和 .config文件,然后自己做了修改,修改后里面也没有用到 fakeroot

离线

#19 2019-02-27 17:03:09

jiangming1399
会员
注册时间: 2018-06-14
累计积分: 24

Re: 荔枝派nano的SPI-Flash系统编译创建全过程

刘少来了 说:
jiangming1399 说:
刘少来了 说:

开启了gadget后,启动log基本没变化,但是改了inittab后,启动log如下,还是卡住了 - -。感觉是root权限的问题,有没有什么方法,让开机启动时就是root


mount: only root can use "--types" option (effective UID is 1000)
mount: only root can use "--options" option (effective UID is 1000)
mkdir: can't create directory '/dev/pts': Permission denied
mkdir: can't create directory '/dev/shm': Permission denied
mount: only root can use "--all" option (effective UID is 1000)
hostname: sethostname: Operation not permitted
Starting logging: OK
Initializing random number generator... done.

按理说默认就是root用户才对啊,你构建jffs2的时候有没有用fakeroot?


没有,我用的官网提供的buildroot和 .config文件,然后自己做了修改,修改后里面也没有用到 fakeroot

我感觉可能是文件权限的问题。你用的是我的打包脚本吗?如果不是的话,在制作jffs2的时候要用root权限,或者用fakeroot,不然里面的文件权限可能会有问题。

离线

#20 2019-02-27 17:45:45

刘少来了
会员
注册时间: 2019-01-24
累计积分: 19

Re: 荔枝派nano的SPI-Flash系统编译创建全过程

jiangming1399 说:
刘少来了 说:
jiangming1399 说:

按理说默认就是root用户才对啊,你构建jffs2的时候有没有用fakeroot?


没有,我用的官网提供的buildroot和 .config文件,然后自己做了修改,修改后里面也没有用到 fakeroot

我感觉可能是文件权限的问题。你用的是我的打包脚本吗?如果不是的话,在制作jffs2的时候要用root权限,或者用fakeroot,不然里面的文件权限可能会有问题。


哈哈哈哈哈,成功解决了,刚刚看了下楼主的脚本,和我的写的脚本有点不一样,发现mkfs.jffs2 -s 0x100 -e 0x10000 --pad=0xAF0000 -d rootfs/ -o jffs2.img 前面应该加上 fakeroot,打包后成功启动。

离线

#21 2019-02-28 11:26:25

tango_zhu
会员
注册时间: 2018-04-12
累计积分: 19

Re: 荔枝派nano的SPI-Flash系统编译创建全过程

感谢 正是需要的

离线

#22 2019-03-01 10:19:23

雷龙发展q2852826868
会员
所在地: 深圳
注册时间: 2018-12-10
累计积分: 31
个人网站

Re: 荔枝派nano的SPI-Flash系统编译创建全过程

厉害啊,专业的就是不一样


CS品牌SD NAND , ATO 小容量SLC/SPI NAND/MCP. T:13691982107,Q:2852826868

离线

#23 2019-03-01 13:34:37

elecompu
会员
注册时间: 2019-02-25
累计积分: 4

Re: 荔枝派nano的SPI-Flash系统编译创建全过程

请问编译Buildroot的工具链怎么配置呢?

离线

#24 2019-03-01 16:32:31

jiangming1399
会员
注册时间: 2018-06-14
累计积分: 24

Re: 荔枝派nano的SPI-Flash系统编译创建全过程

elecompu 说:

请问编译Buildroot的工具链怎么配置呢?

我用的是buildroot自带工具链,配置方法见“基础设置”那一节。如果要设置外部工具链,可以在同一个菜单中设置

离线

#25 2019-03-10 15:41:11

ArcherEmiya
会员
注册时间: 2019-03-10
累计积分: 3

Re: 荔枝派nano的SPI-Flash系统编译创建全过程

感谢,非常详细的指导

离线

页脚