Flash size Select and add MTD Data partition--Linux kernel

Source: Internet
Author: User

You need to modify the location:

(1)/linux-2.6/arch/mips/rt2880/kconfig

(2)/linux-2.6/drivers/mtd/maps/ralink-flash.h

(3)/ LINUX-2.6/DRIVERS/MTD/MAPS/RALINK-SPI.C

(4)/vendors/ralink/rt5350/config/4m_32m_config.linux-2.6 (Config.h generated after make DEP)

(1) Add options in Menuconfig

Choiceprompt "Flash Size" default rt2880_flash_4mconfig t2880_flash_2m bool "2M" config rt2880_flash_4m bool " 4M "config rt2880_flash_8m bool" 8M "config rt2880_flash_16m bool" 16M "config rt2880_flash_32m bool" 32 M "#select rt2880_flash_32mendchoice#data Partition # comment section is not invalid Choiceprompt" FLASH Data Size "Default Rt2880_flash_data_ 320KBconfig rt2880_flash_data_0kb bool "None (0) KB" #config rt2880_flash_data_64kb# bool "0x10000 (+) KB" #confi G rt2880_flash_data_128kb# bool "0x20000 (+) KB" #config rt2880_flash_data_192kb# bool "0x30000 (192) KB" #confi G rt2880_flash_data_256kb# bool "0x40000 (UP) KB" config rt2880_flash_data_320kb bool "0x50000 (+) KB" Config R t2880_flash_data_384kb bool "0x60000 (384) KB" Endchoiceconfig mtd_physmap_data_len hex default 0x0 if RT       2880_flash_data_0kb default 0x10000 If rt2880_flash_data_64kb default 0x20000 if rt2880_flash_data_128kb Default 0x30000 if rt2880_flash_data_192KB default 0x40000 If rt2880_flash_data_256kb default 0x50000 if rt2880_flash_data_320kb default 0x6000  0 if Rt2880_flash_data_384kbchoice

(2) Add the data partition size and modify the kernel partition size.

#if defined (config_rt2880_flash_32m) #define Mtd_boot_part_size0x40000#definemtd_config_part_size0x20000# Definemtd_factory_part_size0x20000#define mtd_data_papt_size config_mtd_physmap_data_len/**/#else # if defined ( reconfig_partition_size) #if!defined (mtd_boot_part_size) #error "please define mtd_boot_part_size" #endif # if!defined (mtd_config_part_size) #error "please define mtd_config_part_size" #endif # if!defined (mtd_factory_part_size) #error " Please define mtd_factory_part_size "#endif #else#define Mtd_boot_part_size0x30000#definemtd_config_part_ Size0x10000#definemtd_factory_part_size0x10000#define mtd_data_papt_size Config_mtd_physmap_data_len<span Style= "Font-family:arial, Helvetica, Sans-serif;" >/* Add data partition length */</span> #endif #endif#ifdef config_rt2880_rootfs_in_flash#ifdef config_rootfs_in_flash_no_ Padding#define config_mtd_kernel_part_siz 0#endif#define mtd_rootfs_part_sizeimage1_size-(MTD_BOOT_PART_SIZE + MTD_ Config_part_size + mtd_factory_part_size + config_mtd_kernel_part_siz + mtd_data_papt_size) #defineMTD_KERN_PART_SIZECONFIG_MTD_KERNEL_PART_SIZ//#defineMTD_KERN_PART_ Size0x310000#else//config_rt2880_rootfs_in_rom#define mtd_kern_part_sizeimage1_size-(MTD_BOOT_PART_SIZE + MTD_ Config_part_size + mtd_factory_part_size + mtd_data_papt_size)/* Calculates the memory partition length after removing the DATA partition length *///#defineMTD_KERN_PART_ Size0x310000#endif

(3) Define data partition

static struct Mtd_partition rt2880_partitions[] = {{name: ' All ', size:                Mtdpart_siz_full, offset:0,},/* Put your own partition definitions here */{ Name: "Bootloader", Size:mtd_boot_part_size, offset:0                ,}, {name: "Config", Size:mtd_config_part_size, Offset:mtdpart_ofs_append}, {name: "Factory", size:m                Td_factory_part_size, Offset:mtdpart_ofs_append#ifdef Config_rt2880_rootfs_in_flash}, { Name: "Kernel", Size:mtd_kern_part_size, Offset:m Tdpart_ofs_append,}, {name: "RootFS", Size:mtd_rootfs_part_siz E, offset: Mtdpart_ofs_append, #ifdef config_rootfs_in_flash_no_padding}, {name: "Kern El_rootfs ", Size:mtd_kern_part_size + mtd_rootfs_part_size, offset:mtd_b                Oot_part_size + mtd_config_part_size + mtd_factory_part_size, #endif #else//config_rt2880_rootfs_in_ram}, { Name: "Kernel", Size:mtd_kern_part_size, OFFSET:MT           Dpart_ofs_append, #endif//config_rt2880_rootfs_in_flash#ifdef config_dual_image}, {name: "Kernel2", Size:mtd_kern2_part_size, Offset:mtd_kern2_part_offset, #i Fdef Config_rt2880_rootfs_in_flash}, {name: "RootFS2", SIZE:MT D_rootfs2_part_size, Offset:mtd_rootfs2_part_offset, #endif #endif//config_dual_image/*data Division Add */}, {name: "Date",/* MTdblock5 */size:mtd_data_papt_size, offset:mtdpart_ofs_append,/* offset, DATA start position */}}; 







Flash size Select and add MTD Data partition--Linux kernel

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.