嵌入式系统系统升级内核双备份的实现方式
2012-12-16 22:54
429 查看
1.nand flash MTD分区
kernels/linux-2.6.31.1-cavm1/drivers/mtd/maps/xxxxx-flash.c
/* MTD partitions: From CNW5602 32MB
* mtd0: 0x000C0000 00020000 "bootloader"
* mtd1: 0x00040000 00020000 "factory_config"
* mtd2: 0x00100000 00020000 "sysconfig"
* mtd3: 0x00DE0000 00020000 "kernel_and_fs"
* mtd4: 0x00020000 00020000 "bootloader_env"
* mtd5: 0x00DE0000 00020000 "kernel_and_fs_backup"
* mtd6: 0x001E0000 00020000 "syslog"
* mtd7: 0x00020000 00020000 "transconfig"
* mtd8: 0x00020000 00020000 "factoryconfig"
*/
static struct mtd_partition xxx_flash_partitions[] = {
{
.name = "bootloader", /* u-boot 6 sector (768KB), 0x20000-0xC0000: Reserved Space */
.size = 0x000C0000, /* 0x00000000 .. 0x000BFFFF */
.offset = 0,
.mask_flags = MTD_WRITEABLE, /* force read-only */
}, {
.name = "factory_config", /* Static Configuration from factory, (256KB = 128KB used + 128KB reserved) */
.size = 0x00040000, /* 0x000C0000 .. 0x000FFFFF */
.offset = MTDPART_OFS_APPEND,
.mask_flags = MTD_WRITEABLE, /* force read-only */
}, {
.name = "sysconfig", /* sysconfig 8 sector (1024KB) */
.size = 0x00100000, /* 0x00100000 .. 0x001FFFFF */
.offset = MTDPART_OFS_APPEND,
}, {
.name = "kernel_and_fs", /* Linux Kernel and File System (bootpImage) (14208KB) */
.size = 0x00DE0000, /* 0x00200000 .. 0x00FDFFFF */
.offset = MTDPART_OFS_APPEND,
}, {
.name = "bootloader_env", /* bottom 1 sector (128KB) for u-boot env variables */
.size = 0x00020000, /* 0x00FE0000 .. 0x00FFFFFF */
.offset = MTDPART_OFS_APPEND,
}, {
.name = "kernel_and_fs_backup", /* Linux Kernel and File System (bootpImage) (14208KB) */
.size = 0x00DE0000, /* 0x01000000 .. 0x01DDFFFF */
.offset = MTDPART_OFS_APPEND,
}, {
.name = "syslog", /* syslog 15 sector (1920KB) */
.size = 0x001E0000, /* 0x01DE0000 .. 0x01FBFFFF */
.offset = MTDPART_OFS_APPEND,
}, {
.name = "transconfig", /* transconfig 1 sector (128KB) */
.size = 0x00020000, /* 0x01FC0000 .. 0x01FDFFFF */
.offset = MTDPART_OFS_APPEND,
}, {
.name = "factoryconfig", /* factoryconfig 1 sector (128KB) */
.size = MTDPART_SIZ_FULL, /* 0x01FE0000 .. 0x01FFFFFF */ /* MTDPART_SIZ_FULL= 0x00020000 */
.offset = MTDPART_OFS_APPEND,
}
};
2.在应用层读写open("/dev/mtd3", O_RDWR);
kernels/linux-2.6.31.1-cavm1/drivers/mtd/maps/xxxxx-flash.c
/* MTD partitions: From CNW5602 32MB
* mtd0: 0x000C0000 00020000 "bootloader"
* mtd1: 0x00040000 00020000 "factory_config"
* mtd2: 0x00100000 00020000 "sysconfig"
* mtd3: 0x00DE0000 00020000 "kernel_and_fs"
* mtd4: 0x00020000 00020000 "bootloader_env"
* mtd5: 0x00DE0000 00020000 "kernel_and_fs_backup"
* mtd6: 0x001E0000 00020000 "syslog"
* mtd7: 0x00020000 00020000 "transconfig"
* mtd8: 0x00020000 00020000 "factoryconfig"
*/
static struct mtd_partition xxx_flash_partitions[] = {
{
.name = "bootloader", /* u-boot 6 sector (768KB), 0x20000-0xC0000: Reserved Space */
.size = 0x000C0000, /* 0x00000000 .. 0x000BFFFF */
.offset = 0,
.mask_flags = MTD_WRITEABLE, /* force read-only */
}, {
.name = "factory_config", /* Static Configuration from factory, (256KB = 128KB used + 128KB reserved) */
.size = 0x00040000, /* 0x000C0000 .. 0x000FFFFF */
.offset = MTDPART_OFS_APPEND,
.mask_flags = MTD_WRITEABLE, /* force read-only */
}, {
.name = "sysconfig", /* sysconfig 8 sector (1024KB) */
.size = 0x00100000, /* 0x00100000 .. 0x001FFFFF */
.offset = MTDPART_OFS_APPEND,
}, {
.name = "kernel_and_fs", /* Linux Kernel and File System (bootpImage) (14208KB) */
.size = 0x00DE0000, /* 0x00200000 .. 0x00FDFFFF */
.offset = MTDPART_OFS_APPEND,
}, {
.name = "bootloader_env", /* bottom 1 sector (128KB) for u-boot env variables */
.size = 0x00020000, /* 0x00FE0000 .. 0x00FFFFFF */
.offset = MTDPART_OFS_APPEND,
}, {
.name = "kernel_and_fs_backup", /* Linux Kernel and File System (bootpImage) (14208KB) */
.size = 0x00DE0000, /* 0x01000000 .. 0x01DDFFFF */
.offset = MTDPART_OFS_APPEND,
}, {
.name = "syslog", /* syslog 15 sector (1920KB) */
.size = 0x001E0000, /* 0x01DE0000 .. 0x01FBFFFF */
.offset = MTDPART_OFS_APPEND,
}, {
.name = "transconfig", /* transconfig 1 sector (128KB) */
.size = 0x00020000, /* 0x01FC0000 .. 0x01FDFFFF */
.offset = MTDPART_OFS_APPEND,
}, {
.name = "factoryconfig", /* factoryconfig 1 sector (128KB) */
.size = MTDPART_SIZ_FULL, /* 0x01FE0000 .. 0x01FFFFFF */ /* MTDPART_SIZ_FULL= 0x00020000 */
.offset = MTDPART_OFS_APPEND,
}
};
2.在应用层读写open("/dev/mtd3", O_RDWR);
相关文章推荐
- 嵌入式系统系统升级内核双备份的实现方式
- 嵌入式Linux编译系统的设计——Bootloader, 内核,驱动,文件系统,升级镜像等自动化编译打包
- 教你如何实现在原系统上编译升级新内核的编译
- 嵌入式linux烧写内核,文件系统的2种方式
- 基于at91sam9x5ek嵌入式系统的内核和文件系统双备份实现
- 在Bootloader中实现嵌入式系统自动升级
- 利用SD卡实现嵌入式Linux系统的自动升级
- 基于嵌入式Linux的视频采集系统5--基于MJPEG编码方式的视频采集实现
- java-第四章-升级我行我素购物管理系统,实现计算会员折扣
- 嵌入式linux系统开发概述之二----内核(Kernel)
- W5100 在嵌入式系统中实现TCP/IP 网络通信的应用
- Android 系统 '七夕'巨献 VIVO Xplay 基于ViVo官方稳定内核,完美root,适度美化,降噪点,完美支持官方OTA升级
- java开发系统内核:实现系统API调用
- 自动升级系统的设计与实现(源码)
- Linux系统NAT实现机制的升级改进
- 模拟器开发以及嵌入式系统内核调试
- 制造业新版ERP系统三大功能升级,实现智能工业4.0
- Linux如何禁止系统内核Kernel自动升级避免不必要的麻烦
- 系统内核开发:实现命令控制台
- 06-android入门_listview采用系统和自定义的方式实现item