需要把ubifs修改成cramfs需求
于是做了以下修改
=============================移植cramfs================================
UBUNTU18安装cramfs
sudo apt-get install cramfsprogs
//安装失败
E: Unable to locate package cramfsprogs
手动下载这个包
https://launchpad.net/ubuntu/xenial/+package/cramfsprogs
http://mirror4.nyist.edu.cn/ubuntu/ubuntu/pool/main/c/cramfs/cramfsprogs_1.1-6ubuntu1_amd64.deb
cramfsprogs_1.1-6ubuntu1_amd64.deb
安装
sudo dpkg -i cramfsprogs_1.1-6ubuntu1_amd64.deb
然后手动对文件系统打包:
进入对应的输出目录:
这里就是编译buildroot生成的文件系统
我要把它打包成cramfs的文件系统
sdk@ubuntu:~/work/rk/rv1126_rv1109/buildroot/output/rockchip_rv1126_rv1109$
mkcramfs target/ rootfs.cramfs
打包好之后就是格式修改
=======================================================================
diff --git a/kernel/arch/arm/configs/rv1126_defconfig b/kernel/arch/arm/configs/rv1126_defconfig
index 1e05ad5a0..8c5c2eda6 100755
--- a/kernel/arch/arm/configs/rv1126_defconfig
+++ b/kernel/arch/arm/configs/rv1126_defconfig
@@ -413,3 +413,10 @@ CONFIG_IP_ADVANCED_ROUTER=y
# CONFIG_IP_MULTIPLE_TABLES is not set
CONFIG_IP_ROUTE_MULTIPATH=y
CONFIG_IP_ROUTE_VERBOSE=y
+CONFIG_MTD_BLOCK=y
diff --git a/kernel/
CONFIG_MTD_BLOCK=y
打开驱动生成/dev/mtdblockX 节点
打开cramfs驱动
--- a/kernel/arch/arm/configs/rv1126_defconfig
+++ b/kernel/arch/arm/configs/rv1126_defconfig
@@ -413,3 +413,10 @@ CONFIG_IP_ADVANCED_ROUTER=y
# CONFIG_IP_MULTIPLE_TABLES is not set
CONFIG_IP_ROUTE_MULTIPATH=y
CONFIG_IP_ROUTE_VERBOSE=y
CONFIG_YAFFS_XATTR=y
+CONFIG_CRAMFS=y
+CONFIG_YAFFS_XATTR=y 编译以下文件
打上补丁
//这个补丁是跳坏块的功能添加
diff --git a/kernel/fs/cramfs/inode.c b/kernel/fs/cramfs/inode.c
old mode 100644
new mode 100755
index 6e000392e..b65aaf3d7
--- a/kernel/fs/cramfs/inode.c
+++ b/kernel/fs/cramfs/inode.c
@@ -63,6 +63,95 @@ static DEFINE_MUTEX(read_mutex);
/* These macros may change in future, to provide better st_ino semantics. */
#define OFFSET(x) ((x)->i_ino)
+#ifdef CONFIG_CRAMFS_NAND_SKIP_BAD
+#include <linux/mtd/mtd.h>
+#include <linux/mtd/super.h>
+
+#define MARK_PAGES_IN_BAD_BLOCK 1
+static uint8_t *page_isbad_blocks; //used to mark this pages whether in bad blocks
+
+struct cramfs_nand_info {
+ unsigned int erasesize_shift;
+ uint32_t *block_map;
+ uint32_t size;
+};
+
+static unsigned int cramfs_nand_transfer_offset(struct super_block *sb, unsigned int offset)
+{
+ struct cramfs_sb_info *sbi = sb->s_fs_info;
+ struct cramfs_nand_info *nandinfo;
+ nandinfo = (struct cramfs_nand_info *)(sbi + 1);
+ if (!nandinfo->erasesize_shift || !nandinfo->block_map)
+ return offset;
+ if (offset > nandinfo->size)
+ return offset;
+ return (offset + nandinfo->block_map[offset >> nandinfo->erasesize_shift]);
+}
+static void cramfs_fill_nand(struct super_block *sb)
+{
+ struct cramfs_sb_info *sbi = sb->s_fs_info;
+ struct cramfs_nand_info *nandinfo;
+ uint32_t *block_map = NULL;
+ uint32_t offset = 0;
+#ifdef MARK_PAGES_IN_BAD_BLOCK
+ uint32_t offset_t = 0;
+ uint32_t flag = 0;
+ uint32_t pagenr;
+#endif
+
+ nandinfo = (struct cramfs_nand_info *)(sbi + 1);
+
+ if(MAJOR(sb->s_dev) == MTD_BLOCK_MAJOR){
+ struct mtd_info *mtd;
+ int blocks, i;
+ mtd = get_mtd_device(NULL, MINOR(sb->s_dev));
+ if(!mtd)
+ return;
+ if(mtd->type != MTD_NANDFLASH)
+ return;
+ blocks = mtd->size>>mtd->erasesize_shift;
+ printk("%s blocks is %d.\n", __func__, blocks);
+#ifdef MARK_PAGES_IN_BAD_BLOCK
+ pagenr = 1<<(mtd->erasesize_shift-PAGE_SHIFT);
+#endif
+ block_map = kmalloc(blocks*sizeof(uint32_t), GFP_KERNEL);
+ if (!block_map)
+ return ;
+#ifdef MARK_PAGES_IN_BAD_BLOCK
+ page_isbad_blocks = kmalloc(pagenr*blocks*sizeof(uint8_t),GFP_KERNEL);
+ if (!page_isbad_blocks)
+ return ;
+ memset(page_isbad_blocks,0x0,pagenr*blocks);
+#endif
+ for(i = 0; i < blocks; i++){
+#ifdef MARK_PAGES_IN_BAD_BLOCK
+ offset = 0x0;
+ flag = 0x0;
+ while (/*mtd->block_isbad*/mtd_block_isbad(mtd, ((loff_t)i*mtd->erasesize + offset))) {
+ int m;
+ offset += mtd->erasesize;
+ //offset_t += offset;
+ for( m=0; m<pagenr; m++)
+ page_isbad_blocks[i*pagenr + m] = 0x1;
+ if ((i*mtd->erasesize + offset) >mtd->size) break;
+ flag++;
+ }
+ offset_t += offset;
+ block_map[i] = offset_t;
+ if (flag >= 2)
+ offset_t -= (flag-1)*mtd->erasesize;
+#else
+ while (/*mtd->block_isbad*/mtd_block_isbad(mtd, ((loff_t)i*mtd->erasesize + offset)))
+ offset += mtd->erasesize;
+ block_map[i] = offset;
+#endif
+ }
+ nandinfo->erasesize_shift = mtd->erasesize_shift;
+ nandinfo->block_map = block_map;
+ nandinfo->size = (uint32_t) mtd->size;
+ }
+}
+#endif
static unsigned long cramino(const struct cramfs_inode *cino, unsigned int offset)
{
if (!cino->offset)
@@ -186,10 +275,27 @@ static void *cramfs_blkdev_read(struct super_block *sb, unsigned int offset,
unsigned i, blocknr, buffer;
unsigned long devsize;
char *data;
+#ifdef MARK_PAGES_IN_BAD_BLOCK
+ struct mtd_info *mtd = NULL;
+ unsigned pagenr = 0;
+ //int flag = 0;
+#endif
if (!len)
return NULL;
+#ifdef CONFIG_CRAMFS_NAND_SKIP_BAD
+#ifdef MARK_PAGES_IN_BAD_BLOCK
+ mtd = get_mtd_device(NULL, MINOR(sb->s_dev));
+ if(!mtd)
+ return NULL;
+#endif
+ offset = cramfs_nand_transfer_offset(sb, offset);
+#endif
blocknr = offset >> PAGE_SHIFT;
+#ifdef MARK_PAGES_IN_BAD_BLOCK
+ if (mtd->type == MTD_NANDFLASH)
+ pagenr = 1<<(mtd->erasesize_shift-PAGE_SHIFT);
+#endif
offset &= PAGE_SIZE - 1;
/* Check if an existing buffer already has the data.. */
@@ -215,6 +321,15 @@ static void *cramfs_blkdev_read(struct super_block *sb, unsigned int offset,
struct page *page = NULL;
if (blocknr + i < devsize) {
+#ifdef MARK_PAGES_IN_BAD_BLOCK
+ if (mtd->type == MTD_NANDFLASH) {
+ unsigned int pagenum = 0x0;
+ pagenum = blocknr + i;
+ while(page_isbad_blocks[pagenum])
+ pagenum += pagenr;
+ page = read_mapping_page(mapping, pagenum, NULL);
+ } else
+#endif
page = read_mapping_page(mapping, blocknr + i, NULL);
/* synchronous error? */
if (IS_ERR(page))
@@ -610,12 +725,17 @@ static int cramfs_blkdev_fill_super(struct super_block *sb, void *data,
struct cramfs_sb_info *sbi;
struct cramfs_super super;
int i, err;
-
+#ifdef CONFIG_CRAMFS_NAND_SKIP_BAD
+ sbi = kzalloc(sizeof(struct cramfs_sb_info) + sizeof(struct cramfs_nand_info), GFP_KERNEL);
+#else
sbi = kzalloc(sizeof(struct cramfs_sb_info), GFP_KERNEL);
+#endif
if (!sbi)
return -ENOMEM;
sb->s_fs_info = sbi;
-
+#ifdef CONFIG_CRAMFS_NAND_SKIP_BAD
+ cramfs_fill_nand(sb);
+#endif
/* Invalidate the read buffers on mount: think disk change.. */
for (i = 0; i < READ_BUFFERS; i++)
buffer_blocknr[i] = -1;
diff --git a/kernel/fs/cramfs/Kconfig b/kernel/fs/cramfs/Kconfig
old mode 100644
new mode 100755
index 5933f9953..567ea83c3
--- a/kernel/fs/cramfs/Kconfig
+++ b/kernel/fs/cramfs/Kconfig
@@ -51,3 +51,10 @@ config CRAMFS_MTD
mount -t cramfs mtd:xip_fs /mnt
If unsure, say N.
+config CRAMFS_NAND_SKIP_BAD
+ bool "Compressed ROM file system support skip nand bad block"
+ default y
+ depends on CRAMFS
+ help
+ Saying Y here includes support for CramFs skip nand bad block.
+ If unsure, say N.
\ No newline at end of file
diff --git a/kernel/arch/arm/boot/dts/rv1109-38-v10-spi-nand.dts b/kernel/arch/arm/boot/dts/rv1109-38-v10-spi-nand.dts
old mode 100644
new mode 100755
index 98d0e3073..b45b79e49
--- a/kernel/arch/arm/boot/dts/rv1109-38-v10-spi-nand.dts
+++ b/kernel/arch/arm/boot/dts/rv1109-38-v10-spi-nand.dts
@@ -12,7 +12,7 @@
compatible = "rockchip,rv1109-38-v10-spi-nand", "rockchip,rv1109";
chosen {
- bootargs = "earlycon=uart8250,mmio32,0xff570000 console=ttyFIQ0 ubi.mtd=3 ubi.block=0,rootfs root=/dev/ubiblock0_0 rootfstype=squashfs snd_aloop.index=7";
+ bootargs = "earlycon=uart8250,mmio32,0xff570000 console=ttyFIQ0,rootfs root=/dev/mtdblock3 rootfstype=cramfs snd_aloop.index=7";
};
然后升级之后就成功进入了代码指令!
==========================================================================
buildroot修改
或者添加config形式
BR2_TARGET_ROOTFS_CRAMFS=y
rootfs后缀是在以下选择
可以看到rootfs选择的是cramfs的固件
=========================================================================
下面是SSD202D-UBI修改成CRAMFS的补丁
commit 2fdc14e0ac1ddbd9776141e3c74e53e95031681b
Author: Jahol Fan <fjh@lonbon.com>
Date: Mon Apr 12 16:01:39 2021 +0800
support rootfs of cramfs
diff --git a/kernel/arch/arm/configs/infinity2m_spinand_ssc011a_s01a_minigui_defconfig b/kernel/arch/arm/configs/infinity2m_spinand_ssc011a_s01a_minigui_defconfig
index a92879749..9d195cef5 100755
--- a/kernel/arch/arm/configs/infinity2m_spinand_ssc011a_s01a_minigui_defconfig
+++ b/kernel/arch/arm/configs/infinity2m_spinand_ssc011a_s01a_minigui_defconfig
@@ -2524,7 +2524,7 @@ CONFIG_UBIFS_FS_LZO=y
# CONFIG_UBIFS_FS_ZLIB is not set
# CONFIG_UBIFS_ATIME_SUPPORT is not set
# CONFIG_LOGFS is not set
-# CONFIG_CRAMFS is not set
+CONFIG_CRAMFS=y
CONFIG_SQUASHFS=y
# CONFIG_SQUASHFS_FILE_CACHE is not set
CONFIG_SQUASHFS_FILE_DIRECT=y
diff --git a/kernel/fs/cramfs/Kconfig b/kernel/fs/cramfs/Kconfig
index 11b29d491..79ad36c63 100644
--- a/kernel/fs/cramfs/Kconfig
+++ b/kernel/fs/cramfs/Kconfig
@@ -20,3 +20,11 @@ config CRAMFS
in terms of performance and features.
If unsure, say N.
+
+config CRAMFS_NAND_SKIP_BAD
+ bool "Compressed ROM file system support skip nand bad block"
+ default y
+ depends on CRAMFS
+ help
+ Saying Y here includes support for CramFs skip nand bad block.
+ If unsure, say N.
\ No newline at end of file
diff --git a/kernel/fs/cramfs/inode.c b/kernel/fs/cramfs/inode.c
old mode 100644
new mode 100755
index 791996748..b0ae9fe42
--- a/kernel/fs/cramfs/inode.c
+++ b/kernel/fs/cramfs/inode.c
@@ -54,6 +54,95 @@ static DEFINE_MUTEX(read_mutex);
/* These macros may change in future, to provide better st_ino semantics. */
#define OFFSET(x) ((x)->i_ino)
+#ifdef CONFIG_CRAMFS_NAND_SKIP_BAD
+#include <linux/mtd/mtd.h>
+#include <linux/mtd/super.h>
+
+#define MARK_PAGES_IN_BAD_BLOCK 1
+static uint8_t *page_isbad_blocks; //used to mark this pages whether in bad blocks
+
+struct cramfs_nand_info {
+ unsigned int erasesize_shift;
+ uint32_t *block_map;
+ uint32_t size;
+};
+
+static unsigned int cramfs_nand_transfer_offset(struct super_block *sb, unsigned int offset)
+{
+ struct cramfs_sb_info *sbi = sb->s_fs_info;
+ struct cramfs_nand_info *nandinfo;
+ nandinfo = (struct cramfs_nand_info *)(sbi + 1);
+ if (!nandinfo->erasesize_shift || !nandinfo->block_map)
+ return offset;
+ if (offset > nandinfo->size)
+ return offset;
+ return (offset + nandinfo->block_map[offset >> nandinfo->erasesize_shift]);
+}
+static void cramfs_fill_nand(struct super_block *sb)
+{
+ struct cramfs_sb_info *sbi = sb->s_fs_info;
+ struct cramfs_nand_info *nandinfo;
+ uint32_t *block_map = NULL;
+ uint32_t offset = 0;
+#ifdef MARK_PAGES_IN_BAD_BLOCK
+ uint32_t offset_t = 0;
+ uint32_t flag = 0;
+ uint32_t pagenr;
+#endif
+
+ nandinfo = (struct cramfs_nand_info *)(sbi + 1);
+
+ if(MAJOR(sb->s_dev) == MTD_BLOCK_MAJOR){
+ struct mtd_info *mtd;
+ int blocks, i;
+ mtd = get_mtd_device(NULL, MINOR(sb->s_dev));
+ if(!mtd)
+ return;
+ if(mtd->type != MTD_NANDFLASH)
+ return;
+ blocks = mtd->size>>mtd->erasesize_shift;
+ printk("%s blocks is %d.\n", __func__, blocks);
+#ifdef MARK_PAGES_IN_BAD_BLOCK
+ pagenr = 1<<(mtd->erasesize_shift-PAGE_SHIFT);
+#endif
+ block_map = kmalloc(blocks*sizeof(uint32_t), GFP_KERNEL);
+ if (!block_map)
+ return ;
+#ifdef MARK_PAGES_IN_BAD_BLOCK
+ page_isbad_blocks = kmalloc(pagenr*blocks*sizeof(uint8_t),GFP_KERNEL);
+ if (!page_isbad_blocks)
+ return ;
+ memset(page_isbad_blocks,0x0,pagenr*blocks);
+#endif
+ for(i = 0; i < blocks; i++){
+#ifdef MARK_PAGES_IN_BAD_BLOCK
+ offset = 0x0;
+ flag = 0x0;
+ while (/*mtd->block_isbad*/mtd_block_isbad(mtd, ((loff_t)i*mtd->erasesize + offset))) {
+ int m;
+ offset += mtd->erasesize;
+ //offset_t += offset;
+ for( m=0; m<pagenr; m++)
+ page_isbad_blocks[i*pagenr + m] = 0x1;
+ if ((i*mtd->erasesize + offset) >mtd->size) break;
+ flag++;
+ }
+ offset_t += offset;
+ block_map[i] = offset_t;
+ if (flag >= 2)
+ offset_t -= (flag-1)*mtd->erasesize;
+#else
+ while (/*mtd->block_isbad*/mtd_block_isbad(mtd, ((loff_t)i*mtd->erasesize + offset)))
+ offset += mtd->erasesize;
+ block_map[i] = offset;
+#endif
+ }
+ nandinfo->erasesize_shift = mtd->erasesize_shift;
+ nandinfo->block_map = block_map;
+ nandinfo->size = (uint32_t) mtd->size;
+ }
+}
+#endif
static unsigned long cramino(const struct cramfs_inode *cino, unsigned int offset)
{
if (!cino->offset)
@@ -170,10 +259,27 @@ static void *cramfs_read(struct super_block *sb, unsigned int offset, unsigned i
unsigned i, blocknr, buffer;
unsigned long devsize;
char *data;
+#ifdef MARK_PAGES_IN_BAD_BLOCK
+ struct mtd_info *mtd = NULL;
+ unsigned pagenr = 0;
+ //int flag = 0;
+#endif
if (!len)
return NULL;
+#ifdef CONFIG_CRAMFS_NAND_SKIP_BAD
+#ifdef MARK_PAGES_IN_BAD_BLOCK
+ mtd = get_mtd_device(NULL, MINOR(sb->s_dev));
+ if(!mtd)
+ return NULL;
+#endif
+ offset = cramfs_nand_transfer_offset(sb, offset);
+#endif
blocknr = offset >> PAGE_SHIFT;
+#ifdef MARK_PAGES_IN_BAD_BLOCK
+ if (mtd->type == MTD_NANDFLASH)
+ pagenr = 1<<(mtd->erasesize_shift-PAGE_SHIFT);
+#endif
offset &= PAGE_SIZE - 1;
/* Check if an existing buffer already has the data.. */
@@ -198,6 +304,15 @@ static void *cramfs_read(struct super_block *sb, unsigned int offset, unsigned i
struct page *page = NULL;
if (blocknr + i < devsize) {
+#ifdef MARK_PAGES_IN_BAD_BLOCK
+ if (mtd->type == MTD_NANDFLASH) {
+ unsigned int pagenum = 0x0;
+ pagenum = blocknr + i;
+ while(page_isbad_blocks[pagenum])
+ pagenum += pagenr;
+ page = read_mapping_page(mapping, pagenum, NULL);
+ } else
+#endif
page = read_mapping_page(mapping, blocknr + i, NULL);
/* synchronous error? */
if (IS_ERR(page))
@@ -246,7 +361,7 @@ static void cramfs_kill_sb(struct super_block *sb)
kill_block_super(sb);
kfree(sbi);
}
-
+//static void cramfs_put_super(struct super_block *sb)
static int cramfs_remount(struct super_block *sb, int *flags, char *data)
{
sync_filesystem(sb);
@@ -263,12 +378,17 @@ static int cramfs_fill_super(struct super_block *sb, void *data, int silent)
struct inode *root;
sb->s_flags |= MS_RDONLY;
-
+#ifdef CONFIG_CRAMFS_NAND_SKIP_BAD
+ sbi = kzalloc(sizeof(struct cramfs_sb_info) + sizeof(struct cramfs_nand_info), GFP_KERNEL);
+#else
sbi = kzalloc(sizeof(struct cramfs_sb_info), GFP_KERNEL);
+#endif
if (!sbi)
return -ENOMEM;
sb->s_fs_info = sbi;
-
+#ifdef CONFIG_CRAMFS_NAND_SKIP_BAD
+ cramfs_fill_nand(sb);
+#endif
/* Invalidate the read buffers on mount: think disk change.. */
mutex_lock(&read_mutex);
for (i = 0; i < READ_BUFFERS; i++)
diff --git a/project/configs/nvr/i2m/8.2.1/spinand.glibc.011a.128 b/project/configs/nvr/i2m/8.2.1/spinand.glibc.011a.128
index cf2f10abb..44fa4b1b9 100755
--- a/project/configs/nvr/i2m/8.2.1/spinand.glibc.011a.128
+++ b/project/configs/nvr/i2m/8.2.1/spinand.glibc.011a.128
@@ -8,7 +8,7 @@ KERNEL_VERSION = 4.9.84
LIBC = libc-2.28
BUSYBOX = busybox-1.20.2-arm-linux-gnueabihf-glibc-8.2.1-dynamic
KERNEL_CONFIG = glibc
-IMAGE_CONFIG = spinand.ubifs.p2.partition.config
+IMAGE_CONFIG = spinand.cramfs_and_ubifs.p2.partition.config
CUSTOMER_OPTIONS = 011a.201_options.mk
CUSTOMER_TAILOR = nvr_i2m_display_glibc_tailor.mk
MMAP = MMAP_I2M_128M.h
diff --git a/project/image/configs/i2m/script_nand.mk b/project/image/configs/i2m/script_nand.mk
index 5900bee86..23a46d3f8 100755
--- a/project/image/configs/i2m/script_nand.mk
+++ b/project/image/configs/i2m/script_nand.mk
@@ -116,7 +116,14 @@ logo_$(FLASH_TYPE)__script:
@echo nand erase.part $(patsubst %_$(FLASH_TYPE)_squashfs_script,%,$@) >> $(SCRIPTDIR)/[[$(patsubst %_$(FLASH_TYPE)_squashfs_script,%,$@).es
@echo nand write.e $(TFTPDOWNLOADADDR) $(patsubst %_$(FLASH_TYPE)_squashfs_script,%,$@) \$${filesize} >> $(SCRIPTDIR)/[[$(patsubst %_$(FLASH_TYPE)_squashfs_script,%,$@).es
@echo "% <- this is end of file symbol" >> $(SCRIPTDIR)/[[$(patsubst %_$(FLASH_TYPE)_squashfs_script,%,$@).es
-
+#add by fjh@lonbon >>>start
+%_$(FLASH_TYPE)_cramfs_script:
+ @echo "# <- this is for comment / total file size must be less than 4KB" > $(SCRIPTDIR)/[[$(patsubst %_$(FLASH_TYPE)_cramfs_script,%,$@).es
+ @echo tftp $(TFTPDOWNLOADADDR) $(patsubst %_$(FLASH_TYPE)_cramfs_script,%,$@).cramfs >> $(SCRIPTDIR)/[[$(patsubst %_$(FLASH_TYPE)_cramfs_script,%,$@).es
+ @echo nand erase.part $(patsubst %_$(FLASH_TYPE)_cramfs_script,%,$@) >> $(SCRIPTDIR)/[[$(patsubst %_$(FLASH_TYPE)_cramfs_script,%,$@).es
+ @echo nand write.e $(TFTPDOWNLOADADDR) $(patsubst %_$(FLASH_TYPE)_cramfs_script,%,$@) \$${filesize} >> $(SCRIPTDIR)/[[$(patsubst %_$(FLASH_TYPE)_cramfs_script,%,$@).es
+ @echo "% <- this is end of file symbol" >> $(SCRIPTDIR)/[[$(patsubst %_$(FLASH_TYPE)_cramfs_script,%,$@).es
+#add by fjh@lonbon <<<end
%_$(FLASH_TYPE)_ramfs_script:
@echo "# <- this is for comment / total file size must be less than 4KB" > $(SCRIPTDIR)/[[rootfs.es
@echo tftp $(TFTPDOWNLOADADDR) $(patsubst %_$(FLASH_TYPE)_ramfs_script,%,$@).ramfs >> $(SCRIPTDIR)/[[rootfs.es
diff --git a/project/image/configs/i2m/spinand.cramfs_and_ubifs.p2.partition.config b/project/image/configs/i2m/spinand.cramfs_and_ubifs.p2.partition.config
new file mode 100755
index 000000000..e5e04bd0d
--- /dev/null
+++ b/project/image/configs/i2m/spinand.cramfs_and_ubifs.p2.partition.config
@@ -0,0 +1,95 @@
+IMAGE_LIST = cis ipl ipl_cust uboot logo kernel lbcmd lbflash lbflash2 rootfs miservice customer appconfigs
+OTA_IMAGE_LIST = ipl ipl_cust uboot logo kernel miservice customer appconfigs
+FLASH_TYPE = spinand
+UBI_MLC_TYPE = 0
+PAT_TABLE = ubi
+PHY_TEST = no
+#overwrite CIS(BL0,BL1,UBOOT) PBAs
+CIS_PBAs = 10 0 0
+CIS_COPIES = 5
+USR_MOUNT_BLOCKS:=miservice customer appconfigs
+ENV_CFG = /dev/mtd6 0x00000 0x1000 0x20000 2
+ENV_CFG1 = /dev/mtd7 0x00000 0x1000 0x20000 2
+
+cis$(RESOUCE) = $(IMAGEDIR)/cis.bin
+cis$(DATASIZE) = 0x40000
+cis$(PGSIZE) = 2k
+cis$(COPIES) = $(CIS_COPIES)
+cis$(PATSIZE) = 0x140000
+cis$(BOOTTAB) = $(ipl$(MTDPART)),$(ipl_cust$(MTDPART)),$(uboot$(MTDPART))
+cis$(SYSTAB) = $(key_cust$(MTDPART)),$(logo$(MTDPART)),$(kernel$(MTDPART)),$(rootfs$(MTDPART)),0x80000(lbcmd),0x80000(lbflash),0x80000(lbflash2),-(UBI)
+
+ipl$(RESOUCE) = $(PROJ_ROOT)/board/$(CHIP)/boot/ipl/IPL.bin
+ipl$(DATASIZE) = 0x20000
+ipl$(COPIES) = 3
+ipl$(BKCOUNT) = 2
+ipl$(PATSIZE) = $(call multiplyhex, $(ipl$(COPIES)), $(ipl$(DATASIZE)))
+ipl$(PATCOUNT) = 2
+ipl$(MTDPART) = $(ipl$(DATASIZE))@$(cis$(PATSIZE))(IPL0)$(ipl$(BKCOUNT)),$(ipl$(DATASIZE))(IPL1)$(ipl$(BKCOUNT))
+ipl$(OTABLK) = /dev/mtd0 /dev/mtd1
+
+ipl_cust$(RESOUCE) = $(PROJ_ROOT)/board/$(CHIP)/boot/ipl/IPL_CUST.bin
+ipl_cust$(DATASIZE) = 0x20000
+ipl_cust$(COPIES) = 3
+ipl_cust$(BKCOUNT) = 2
+ipl_cust$(PATSIZE) = $(call multiplyhex, $(ipl_cust$(COPIES)), $(ipl_cust$(DATASIZE)))
+ipl_cust$(PATCOUNT) = 2
+ipl_cust$(MTDPART) = $(ipl_cust$(DATASIZE))(IPL_CUST0)$(ipl_cust$(BKCOUNT)),$(ipl_cust$(DATASIZE))(IPL_CUST1)$(ipl_cust$(BKCOUNT))
+ipl_cust$(OTABLK) = /dev/mtd2 /dev/mtd3
+
+uboot$(RESOUCE) = $(PROJ_ROOT)/board/$(CHIP)/boot/$(FLASH_TYPE)/uboot/u-boot_$(FLASH_TYPE).xz.img.bin
+uboot$(DATASIZE) = 0x40000
+uboot$(COPIES) = 3
+uboot$(BKCOUNT) = 4
+uboot$(PATSIZE) = $(call multiplyhex, $(uboot$(COPIES)), $(uboot$(DATASIZE)))
+uboot$(PATCOUNT) = 2
+uboot$(MTDPART) =$(uboot$(DATASIZE))(UBOOT0)$(uboot$(BKCOUNT)),$(uboot$(DATASIZE))(UBOOT1)$(uboot$(BKCOUNT)),0x20000(ENV0)1,0x20000(ENV1)1
+uboot$(OTABLK) = /dev/mtd4 /dev/mtd5
+
+wifi24mclkcmd = mw 1f001cc0 11
+wifirstoffcmd = gpio out 8 0
+wifirstoncmd = gpio out 8 1
+
+key_cust$(PATSIZE) = 0x20000
+key_cust$(MTDPART) = $(key_cust$(PATSIZE))(KEY_CUST)
+
+logo$(RESOUCE) = $(IMAGEDIR)/logo
+logo$(PATSIZE) = 0x60000
+logo$(MTDPART) = $(logo$(PATSIZE))(LOGO)
+logo$(OTABLK) = /dev/mtd9
+
+kernel$(RESOUCE) = $(PROJ_ROOT)/release/$(PRODUCT)/$(CHIP)/$(BOARD)/$(TOOLCHAIN)/$(TOOLCHAIN_VERSION)/bin/kernel/$(FLASH_TYPE)/uImage.xz
+kernel$(PATSIZE) = 0x500000
+kernel$(BOOTENV) = $(KERNEL_BOOT_ENV)
+kernel$(MTDPART) = $(kernel$(PATSIZE))(KERNEL),$(kernel$(PATSIZE))(RECOVERY)
+kernel$(OTABLK) = /dev/mtd10
+
+rootfs$(RESOUCE) = $(OUTPUTDIR)/rootfs
+rootfs$(FSTYPE) = cramfs
+rootfs$(PATSIZE) = 0x800000
+rootfs$(BOOTENV) = console=ttyS0,115200 ubi.mtd=UBI,2048 root=/dev/mtdblock12 rootfstype=cramfs init=/linuxrc rootwait=1
+rootfs$(MTDPART) = $(rootfs$(PATSIZE))(rootfs)
+
+miservice$(RESOUCE) = $(OUTPUTDIR)/miservice/config
+miservice$(FSTYPE) = ubifs
+miservice$(PATSIZE) = 0xA00000
+miservice$(MOUNTTG) = /config
+miservice$(MOUNTPT) = ubi0:miservice
+miservice$(OPTIONS) = rw
+miservice$(OTABLK) = /dev/ubi0_1
+
+customer$(RESOUCE) = $(OUTPUTDIR)/customer
+customer$(FSTYPE) = ubifs
+customer$(PATSIZE) = 0x5300000
+customer$(MOUNTTG) = /customer
+customer$(MOUNTPT) = ubi0:customer
+customer$(OPTIONS) = rw
+customer$(OTABLK) = /dev/ubi0_2
+
+appconfigs$(RESOUCE) = $(OUTPUTDIR)/appconfigs
+appconfigs$(FSTYPE) = ubifs
+appconfigs$(PATSIZE) = 0x400000
+appconfigs$(MOUNTTG) = /appconfigs
+appconfigs$(MOUNTPT) = ubi0:appconfigs
+appconfigs$(OPTIONS) = rw
+appconfigs$(OTABLK) = /dev/ubi0_3
diff --git a/project/image/image.mk b/project/image/image.mk
index 4c3998b93..6c4034632 100755
--- a/project/image/image.mk
+++ b/project/image/image.mk
@@ -12,6 +12,12 @@ images: $(TARGET_FSIMAGE) $(TARGET_NOFSIMAGE)
@echo [[$@]]
./build/make_ext4fs -S ./build/file_contexts -l $($(patsubst %_ext4_fsimage,%,$@)$(PATSIZE)) -b 1024 $(IMAGEDIR)/$(patsubst %_ext4_fsimage,%,$@).img $($(patsubst %_ext4_fsimage,%,$@)$(RESOUCE))
+#add by fjh@lonbon >>>start
+%_$(FLASH_TYPE)_cramfs_fsimage: $(shell which mkfs.cramfs)
+ @echo [[$@]]
+ $(FAKEROOT) $< $($(patsubst %_$(FLASH_TYPE)_cramfs_fsimage,%,$@)$(RESOUCE)) $(IMAGEDIR)/$(patsubst %_$(FLASH_TYPE)_cramfs_fsimage,%,$@).cramfs
+#add by fjh@lonbon <<<end
+
#the system can't bootup while use mkquashfs_xz compress.
%_$(FLASH_TYPE)_squashfs_fsimage: ./build/mksquashfs_xz
@echo [[$@]]