Navigation

    全志在线开发者论坛

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

    Tina Linux 存储介质切换:eMMC,SPI NAND,SPI NOR,SD Card,SD NAND

    Linux
    8
    12
    2435
    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.
    • Y
      YterAA LV 7 last edited by YuzukiTsuru

      存储切换方法

      SDK切换存储介质需要修改board.dts、sys_config.fex、内核配置、TINA系统配置。另外,在spinor 存储介质下,通过 u-boot-sun8iw21p1.bin 进行烧录,u-boot-spinor-sun8iw21p1.bin 启动,使用sys_partition_nor.fex作为分区表。在非spinor介质(spinand、emmc、sdnand),通过u-boot-sun8iw21p1.bin进行烧录和启动,使用sys_partition.fex作为分区表。下文将介绍spinor切换spinand、spinand切换spinor、spinor切换emmc、spinor切换sdnand四种切换方式。

      • sys_config.fex中只要关注storage_type选项,这个选项决定使用哪一种存储介质,配置后在pack过程,会自动打包对应介质的二进制文件。
        [target]
        storage_type = xxx
        其中storage_type | 0:nand | 1:sd | 2:emmc | 3:spinor  | 4:emmc3 | 5:spinand  | 6:sd1 |
      

      spinor切换spinand

      sys_config.fex修改

      [target]
      - storage_type = 3
      + storage_type = 5
      

      board.dts/uboot-board.dts修改

      &spi0 {
      -	status = "disabled";
      +	status = "okay";
      	spi-nand@0 {
      -		status="disabled";
      +		status="okay";
      	};
      };
      

      uboot编译

      编译u-boot-sun8iw21p1.bin,spinand使用u-boot-sun8iw21p1.bin进行烧录、启动。
      cboot切换到uboot目录,编辑configs/sun8iw21p1_defconfig
      CONFIG_SUNXI_UBIFS=y   //SDK发布默认已选上
      执行mboot               //编译
      确保device/config/chips/vxxx/bin/u-boot-sun8iw21p1.bin已更新
      

      内核配置

      make kernel_menuconfig 层层选中
      内核驱动配置
      Device Driver --->
         Memory Technology Device (MTD) support --->
            sunxi-nand  --->
                <*> AWNAND CHOICE (Allwinner MTD SPINAND Device Support)  --->
            -*-   Enable UBI - Unsorted block images  --->
               [*]   Read-only block devices on top of UBI volumes
               
      内核文件系统配置
      File systems --->
         [*] Miscellaneous filesystems  --->
            <*>   UBIFS file system support
      

      TINA环境配置

      make menuconfig 层层选中
      Target Images  --->
         Boot (SD Card) Kernel format (boot.img)  ---> //默认选中
         [ ] For storage less than 32M, enable this when using ota  //取消勾选
         
      Global build settings  --->
         [*] Strip unnecessary functions from libraries  //取消勾选
         
      Utilities  --->
         <*> mtd-utils --->
            <*>   mtd-utils-mkfs.ubifs
      

      spinand切换spinor

      sys_config.fex修改

      [target]
      - storage_type = 5
      + storage_type = 3
      

      board.dts/uboot-board.dts修改

      &spi0 {
      -	status = "okay";
      +	status = "disabled";
      	spi-nand@0 {
      -		status="okay";
      +		status="disabled";
      	};
      };
      
      

      内核配置

      make kernel_menuconfig 层层选中
      内核驱动配置
      Device Driver --->
         Memory Technology Device (MTD) support --->
            sunxi-nand  --->  //取消勾选
         Self-contained MTD device drivers  --->
            <*> Support most SPI Flash chips (AT26DF, M25P, W25X, ...)  //确认已选中
         <*>   SPI-NOR device support  --->    
      内核文件系统配置
      File systems --->
         [*] Miscellaneous filesystems  --->
            <*>   Journalling Flash File System v2 (JFFS2) support
      

      TINA环境配置

      make menuconfig 层层选中
      Target Images  --->
         [*] For storage less than 32M, enable this when using ota  //选中
         
      Global build settings  --->
         [*] Strip unnecessary functions from libraries  //选中
         
      Utilities  --->
         <*> mtd-utils
            <*>   mtd-utils-mkfs.jffs2  //选中
      

      spinor切换emmc

      sys_config.fex修改

      [target]
      - storage_type = 3
      + storage_type = 2
      

      内核配置

      make kernel_menuconfig 层层选中
      [*] Enable the block layer  --->
         [*]   Support for large (2TB+) block devices and files
         [*]   Block layer SG support v4
      Device Drivers  --->
         < > Memory Technology Device (MTD) support  --->  //取消勾选
         [*] Block devices  --->  //确认勾选
      File systems  --->
         <*> The Extended 4 (ext4) filesystem
      

      TINA环境配置

      make menuconfig 层层选中
      Target Images  --->
         Boot (SD Card) Kernel format (boot.img)  ---> //默认选中
         [ ] For storage less than 32M, enable this when using ota  //取消勾选
         
      Global build settings  --->
         [ ] Strip unnecessary functions from libraries  //取消勾选
         
      Utilities  --->
         Filesystem  --->
            <*> e2fsprogs //选中
      

      spinor切换sdnand

      sys_config.fex修改

      [target]
      - storage_type = 3
      + storage_type = 1
      

      board.dts修改

      &sdc2 {
      	non-removable;
      	bus-width = <8>;
      	mmc-ddr-1_8v;
      	mmc-hs200-1_8v;
      	mmc-hs400-1_8v;
      	no-sdio;
      -	no-sd;
      +	//no-sd;
      	ctl-spec-caps = <0x308>;
      	cap-mmc-highspeed;
      	sunxi-power-save-mode;
      	sunxi-dis-signal-vol-sw;
      	max-frequency = <100000000>;
      	vmmc-supply = <&reg_dcdc1>;
      	/*emmc io vol 3.3v*/
      	vqmmc-supply = <&reg_bldo1>;
      	/*emmc io vol 1.8v*/
      	/*vqmmc-supply = <&reg_eldo1>;*/
      	status = "disabled";
      };
      

      内核配置

      make kernel_menuconfig 层层选中
      [*] Enable the block layer  --->
         [*]   Support for large (2TB+) block devices and files
         [*]   Block layer SG support v4
      Device Drivers  --->
         < > Memory Technology Device (MTD) support  --->  //取消勾选
         [*] Block devices  --->  //确认勾选
      File systems  --->
         <*> The Extended 4 (ext4) filesystem
      

      TINA环境配置

      make menuconfig 层层选中
      Target Images  --->
         Boot (SD Card) Kernel format (boot.img)  ---> //默认选中
         [ ] For storage less than 32M, enable this when using ota  //取消勾选
         
      Global build settings  --->
         [ ] Strip unnecessary functions from libraries  //取消勾选
         
      Utilities  --->
         Filesystem  --->
            <*> e2fsprogs //选中
      
      1 Reply Last reply Reply Quote Share 1
      • tigger
        tigger LV 7 last edited by

        没有SDK,只能偷偷看你玩了。

        YuzukiTsuru 1 Reply Last reply Reply Quote Share 0
        • Moved from V853系列-AI视觉 by  YuzukiTsuru YuzukiTsuru 
        • YuzukiTsuru
          柚木 鉉 LV 9 @tigger last edited by

          @tigger 全系适用的

          1 Reply Last reply Reply Quote Share 0
          • Referenced by  YuzukiTsuru YuzukiTsuru 
          • Referenced by  Y YterAA 
          • Y
            YterAA LV 7 last edited by YuzukiTsuru

            Tina 3.5 一般支持nor, nand, mmc 三种介质。

            更具体的,nand分为并口nand和spinand,mmc分emmc和sd卡

            主要需要区分的是nor和其他介质,因为需要打包的部分有所不同。

            即,emmc和nand,sd卡一般可共用一份固件,而nor则需使用另一份固件

            sys_config配置

            在sys_config中有一个配置项,storage_type,取值及含义如下

            ;----------------------------------------------------------------------------------
            ; storage_type 0:nand 1:sd 2:emmc 3:spinor 4:emmc3 5:spinand 6:sd1
            ;----------------------------------------------------------------------------------
            [target]
            storage_type = xxx
            

            对于nor的方案,必须配置为

             storage_type = 3
            

            对于其他介质,storage_type则不能配置为3

            spinand切换为spinor

            sys_config 设置介质为nor

            [target]
            storage_type = 3
            

            配置所用nor的大小

            [norflash]
            size		= 16   
            

            内核配置

             make kernel_menuconfig --->
            	Device Drivers --->
                            < >Block devices  (取消选中)
            	Device Drivers --->
            		<*>Memory Technology Device (MTD) support
                                    <*>OpenFirmware partitioning information support
            			<*>SUNXI partitioning support
                   <*>   Caching block device access to MTD devices
            			<*>   SPI-NOR device support  (对于linux4.9,先选这个,下面的选项才出现)
            			Self-contained MTD device drivers  --->
            				 <*> Support most SPI Flash chips (AT26DF, M25P, W25X, ...)
              File systems  --->
                < > The Extended 4 (ext4) filesystem(取消选中)
              File systems  --->
                [*] Miscellaneous filesystems  ---> 
                 <*>   Journalling Flash File System v2 (JFFS2) support(选中)
              [*] Enable the block layer  --->
                [ ]   Support for large (2TB+) block devices and files(取消选中)
            

            menuconfig配置

            make menuconfig --->
                   Utilities  --->
                            <*> mtd-utils (选择) --->
                                    <*> mtd-utils-mkfs.jffs2
            make menuconfig --->
                   Utilities  --->
                            Filesystem  --->
                                    < > e2fsprogs(取消选择)
            

            spinor切换为spinand

            sys_config 设置介质为spinand

            [target]
            storage_type = 5
            

            内核配置

             make kernel_menuconfig --->
                  Device Drivers --->
                             [*]Block devices --->
                                     <*>   sunxi nand flash driver
                  Device Drivers --->
            		< >Memory Technology Device (MTD) support(取消选择)
                   [*] Enable the block layer  --->
                            [*]   Support for large (2TB+) block devices and files 
                  File systems  --->
                           <*> The Extended 4 (ext4) filesystem
            

            menuconfig 配置

            make menuconfig --->
                   Utilities  --->
                            < > mtd-utils (取消选择)
                            Filesystem  --->
                                    <*> e2fsprogs
            

            分区表配置
            注意点

            对于nand,rootfs_data分区,使用ext4格式。分配太小的话可能会创建失败。

            FAQ

            使用mkfs.ext4等工具的时候出现

            /usr/sbin/fsck.ext4 -y /dev/by-name/rootfs_data
            Error loading shared library /home/wuguanling/workspace/project/v316-sdv-tina/out/v316-sdv/staging_dir/target/rootfs/lib/libc.so: No such file or directory (needed by /usr/lib/libext2fs.so.2)
            

            关闭以下选项:

            make menuconfig
               | --- Global build settings
            		| --- []strip unnecessary functions for libraries  
            
            T 1 Reply Last reply Reply Quote Share 0
            • Referenced by  YuzukiTsuru YuzukiTsuru 
            • Referenced by  YuzukiTsuru YuzukiTsuru 
            • Referenced by  YuzukiTsuru YuzukiTsuru 
            • Referenced by  YuzukiTsuru YuzukiTsuru 
            • Referenced by  YuzukiTsuru YuzukiTsuru 
            • J
              jetchenxg2021 LV 1 last edited by

              还有env.cfg中的bootcmd也要改成从nand启动的命令
              env set bootcmd run setargs_nand boot_normal

              1 Reply Last reply Reply Quote Share 0
              • tigger
                tigger LV 7 last edited by

                好详细喔,收藏起来慢慢消化。

                1 Reply Last reply Reply Quote Share 0
                • Referenced by  C captain 
                • D
                  dream LV 6 last edited by

                  扫盲贴,666。。。

                  1 Reply Last reply Reply Quote Share 0
                  • Referenced by  K konosiba 
                  • Q
                    qqqlb LV 5 last edited by

                    想问一下,你第一次发的和第二次发的有什么区别呢?我看了一下,配置好像不一样?

                    YuzukiTsuru 1 Reply Last reply Reply Quote Share 0
                    • YuzukiTsuru
                      柚木 鉉 LV 9 @qinlinbin last edited by

                      @qinlinbin 下面那个是Tina 3.5的配置

                      Q 1 Reply Last reply Reply Quote Share 0
                      • Q
                        qqqlb LV 5 @YuzukiTsuru last edited by

                        @yuzukitsuru 看漏了,谢谢大佬

                        1 Reply Last reply Reply Quote Share 0
                        • Referenced by  Q qq354813374 
                        • Referenced by  Q qq354813374 
                        • Referenced by  J JIAndanai 
                        • J
                          Justyu666 LV 5 last edited by

                          亲们,请教下,从 SDC 转 nand 的 UBOOT-BOARD.DTS修改是这样没?谢谢!
                          SDC0---nandFlash.png

                          1 Reply Last reply Reply Quote Share 0
                          • T
                            tanlining LV 2 @YterAA last edited by tanlining

                            @yteraa 老师您好,各位大神们好,请教下按你的教程从nor切换到nand后启动找不到文件系统,是哪方面问题?谢谢。1676633152331.jpg-------------- 1676633142829.jpg

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

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

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