当前位置: 首页 > news >正文

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

存储切换方法

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切换spinandspinand切换spinorspinor切换emmcspinor切换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

切换部分原文链接:https://bbs.aw-ol.com/topic/1701/

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 //选中

Tina 一般支持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  

原文链接:https://bbs.aw-ol.com/topic/1701/
作者@YterAA

相关文章:

  • 《苍穹外卖》Day10部分知识点记录
  • Atcoder Beginner Contest351 A-E Solution题解
  • RabbitMQ消息是如何分发的,消息是怎么路由的, RabbitMQ中的交换机类型有哪些
  • Redis可视化工具RedisInsight
  • 商城数据库88张表结构(十二)
  • 62、回溯-N皇后
  • Docker基础(一)
  • java线程池原理源码解析,程序员如何技术划水
  • FL Studio Producer Edition2024中文进阶版Win/Mac
  • 2024数字中国创新大赛·数据要素赛道“能源大数据应用赛”正式上线!参赛指南请查收
  • Java应用通过jmx_exporter对外暴露jvm指标
  • 【C++】类和对象之常引用与运算符重载
  • FPGA—从加法运算理解流水线的作用
  • C++从入门到精通 C++98.11.14.17
  • 基于单片机的16×16点阵的滚动显示屏设计
  • LeetCode 940. 不同的子序列 II
  • 【VUE基础】webpack
  • 【漏洞复现-discuz-wooyun-命令执行】vulfocus/discuz-wooyun_2010_080723
  • SDWAN和MPLS谁才是最佳选择
  • 记一次失败的使用python selenium刷课学习通脚本(细节满满)+关于使用selenium的疑难杂症解决+json数据请求的疑难杂症+py冷门知识
  • Mybatis架构,SqlSessionFactory源码分析
  • 我终于读懂了设计模式的七大原则。。。
  • stm32f4xx-SPI
  • 高数(下) 第十二章:无穷级数
  • LeetCode·每日一题·940.不同的子序列 || · 动态规划
  • 【云原生】Elasticsearch + kibana on k8s 讲解与实战操作
  • 神经网络过拟合什么意思,神经网络中解决过拟合
  • win11toast:python桌面通知工具
  • 【cloud Alibaba】(四)分布式事务处理——Seata
  • [算法入门笔记] 19. 有序表
  • (Java岗)秋招打卡!一本学历拿下美团、阿里、快手、米哈游offer
  • Java反射小练之手写BeanUtils的copyProperties(Upgrade)