Navigation

    全志在线开发者论坛

    • Register
    • Login
    • Search
    • Categories
    • Tags
    • 在线文档
    • 社区主页

    fw_printfenv不可用(Error locking file /var/lock/fw_printenv.lock)

    V853系列-AI视觉
    2
    5
    141
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • L
      htujun LV 3 last edited by

      tina-v851s 的fw_printfenv报错。

      分区表如下:

      [partition_start]
      
      [partition]
          name         = boot
          size         = 7040
          downloadfile = "boot.fex"
          user_type    = 0x8000
      
      [partition]
          name         = rootfs
          size         = 11264
          downloadfile = "rootfs.fex"
          user_type    = 0x8000
      
      [partition]
          name         = extend
          size         = 7040
          downloadfile = "usr.fex"
          user_type    = 0x8000
      
      [partition]
          name         = rootfs_data
          size         = 1024
          user_type    = 0x8000
      
      [partition]
         name         = env
         size         = 512
         downloadfile = "env_nor.fex"
         user_type    = 0x8000
      

      fw_env.config如下:

      # Configuration file for fw_(printenv/setenv) utility.
      # Up to two entries are valid, in this case the redundant
      # environment sector is assumed present.
      # Notice, that the "Number of sectors" is not required on NOR and SPI-dataflash.
      # Futhermore, if the Flash sector size is omitted, this value is assumed to
      # be the same as the Environment size, which is valid for NOR and SPI-dataflash
      # Device offset must be prefixed with 0x to be parsed as a hexadecimal value.
      
      # NOR example
      # MTD device name       Device offset   Env. size       Flash sector size       Number of sectors
      # /dev/mtd1             0x0000          0x4000          0x4000
      # /dev/mtd2             0x0000          0x4000          0x4000
      
      # MTD SPI-dataflash example
      # MTD device name       Device offset   Env. size       Flash sector size       Number of sectors
      #/dev/mtd5              0x4200          0x4200
      #/dev/mtd6              0x4200          0x4200
      
      # NAND example
      #/dev/mtd0              0x4000          0x4000          0x20000                 2
      
      # On a block device a negative offset is treated as a backwards offset from the
      # end of the device/partition, rather than a forwards offset from the start.
      
      # Block device example
      #/dev/mmcblk0           0xc0000         0x20000
      #/dev/mmcblk0           -0x20000        0x20000
      
      # VFAT example
      #/boot/uboot.env        0x0000          0x4000
      
      # UBI volume
      #/dev/ubi0_0            0x0             0x1f000         0x1f000
      #/dev/ubi0_1            0x0             0x1f000         0x1f000
      
      # UBI volume by name
      #/dev/ubi0:env          0x0             0x1f000         0x1f000
      #/dev/ubi0:env-redund   0x0             0x1f000         0x1f000
      
      # Allwinner Tina
      /dev/by-name/env        0x0000          0x20000
      

      分区如下:

      root@(none):/mnt/extsd# cat /proc/mtd 
      dev:    size   erasesize  name
      mtd0: 00200000 00010000 "uboot"
      mtd1: 00370000 00010000 "boot"
      mtd2: 00580000 00010000 "rootfs"
      mtd3: 00370000 00010000 "extend"
      mtd4: 00040000 00010000 "env"
      mtd5: 00080000 00010000 "rootfs_data"
      mtd6: 010e0000 00010000 "UDISK"
      
      root@(none):/mnt/extsd# fw_printenv 
      Error locking file /var/lock/fw_printenv.lock
      root@(none):/mnt/extsd# fw_setenv 
      Error locking file /var/lock/fw_printenv.lock
      
      1 Reply Last reply Reply Quote Share 0
      • L
        htujun LV 3 last edited by

        v851s-fastboot的 麻烦看下?给个方向

        T 1 Reply Last reply Reply Quote Share 0
        • T
          TEVET LV 6 @lishengyin last edited by

          @lishengyin 遇到相同问题,我的是SPI NAND 作为存储器, 大佬解决了吗

          L 1 Reply Last reply Reply Quote Share 0
          • L
            htujun LV 3 @TEVET last edited by

            @tevet - make_kernel_menuconfig 搜索 CONFIG_FILE_LOCKING,打开如下配置,重新编译即可。

            默认不编译POSIX标准文件锁定API,所以程序执行到文件加锁与解锁的flock()时失败。

            # fw_env_main.c
                if (-1 == flock(lockfd, LOCK_EX)) {
                    fprintf(stderr, "Error locking file %s\n", lockname);
                    close(lockfd);
                    return EXIT_FAILURE;
                }
            
            
            T 1 Reply Last reply Reply Quote Share 1
            • T
              TEVET LV 6 @lishengyin last edited by

              @lishengyin 非常感谢

              1 Reply Last reply Reply Quote Share 0
              • 1 / 1
              • First post
                Last post

              Copyright © 2022 深圳全志在线有限公司 粤ICP备2021084185号 粤公网安备44030502007680号

              行为准则 | 用户协议 | 隐私权政策