i8320内核编译笔记

我下载内核源码后,安装2011版交叉编译工具编译出错,然后下载2009q3编译工具,
按照老刘贴子用make zImage编译生成zImage文件成功
但要生成uImage
根据htp1983的贴子修改.config文件

CONFIG_BLK_DEV_INITRD=y
CONFIG_INITRAMFS_SOURCE="…/android/nitird"

没有解包boot.img,就从手机系统根目提取spin和lib文件夹和脚本文件,添加proc.dev.sys.system这几个空文件夹放入nitird文件夹内

然后修改board-nowplus.c文件,问题不大分区修改为

#ifdef CONFIG_TOUCHSCREEN_SYNAPTICS_I2C_RMI4
 omap_register_i2c_bus(3, 400, NULL,  nowplus_i2c_boardinfo_4, ARRAY_SIZE(nowplus_i2c_boardinfo_4));
#else
        omap_register_i2c_bus(3, 400, NULL,  NULL, NULL);
#endif
 return 0;
}


#if defined(CONFIG_MTD_ONENAND_OMAP2) || \
 defined(CONFIG_MTD_ONENAND_OMAP2_MODULE)
/*
Adresses of the BML partitions

minor position size blocks id

  1: 0x00000000-0x00040000 0x00040000      2        0
  2: 0x00040000-0x00640000 0x00600000     48        1
  3: 0x00640000-0x00780000 0x00140000     10        2
  4: 0x00780000-0x008c0000 0x00140000     10        3
  5: 0x008c0000-0x00dc0000 0x00500000     40        4
  6: 0x00dc0000-0x012c0000 0x00500000     40        5
  7: 0x012c0000-0x02640000 0x01380000    156        6   initrd
  8: 0x02640000-0x0da40000 0x0b400000   1440        7   factoryfs
  9: 0x0da40000-0x1f280000 0x11840000   2242        8   datafs
 10: 0x1f280000-0x1f380000 0x00100000      8        9
 11: 0x1f380000-0x1f480000 0x00100000      8       10
*/
//  max size = 0x1f280000-0x012c0000 = 0x1dfc0000

/*
start at limo initrd partition
leave blocks bevore untouched so we use odin to flash
kernel to BML partiton

new layout:
   ____________
  | 0x00000000 |    BML AREA, flash with odin
  |    ...     |
  | ---------- | -----------------------------
  | 0x012c0000 |    MTD AREA, flash from linux
  |    ...     |
  | ---------- | -----------------------------
  | 0x1f280000 |    reserved area
  |    ...     |
  | 0x1f480000 |
  |____________|

*/
#define MTD_SPLASH_SIZE     3*(64*2048)
#define MTD_START_OFFSET    (0x012c0000+MTD_SPLASH_SIZE)   
#define MTD_MAX_SIZE        (0x1dfc0000-MTD_SPLASH_SIZE)  

#ifdef CONFIG_MTD_PARTITIONS
//for safety
int check_mtd(struct mtd_partition *partitions , int cnt)
{
    int i;
    int size=0;

    //check start
    if (partitions[0].offset != MTD_START_OFFSET)
    {
        printk("check_mtd failed: wrong offset of MTD start: 0x%08x!\n", (unsigned int)partitions[0].offset);
        return 0;
    }

    for (i=0; i<cnt; i++)
        size+=partitions[i].size;
    if(size > MTD_MAX_SIZE)
    {
        printk("check_mtd failed: wrong size of MTD area: 0x%08x!\n", size);
        return 0;
    }

    return 1;
}

static struct mtd_partition onenand_partitions[] = {
    {
  .name           = "misc",
        .offset         = MTD_START_OFFSET,
  .size           = 2*(64*2048),
 },
    {
  .name           = "recovery",
  .offset         = MTDPART_OFS_APPEND,
  .size           = 40*(64*2048),
 },
 {
  .name           = "boot",
  .offset         = MTDPART_OFS_APPEND,
  .size           = 40*(64*2048),
 },
 {
  .name           = "system",
  .offset         = MTDPART_OFS_APPEND,
  .size           = 1312*(64*2048),
 },
    {
  .name           = "cache",
  .offset         = MTDPART_OFS_APPEND,
  .size           = 40*(64*2048),
 },
    {
  .name           = "userdata",
  .offset         = MTDPART_OFS_APPEND,
        .size           = 2401*(64*2048),
    },

};
#endif
static struct omap_onenand_platform_data board_onenand_data = {
 .cs  = 0,
 //.gpio_irq = OMAP_GPIO_AP_NAND_INT,
    .dma_channel = -1,  /* disable DMA in OMAP OneNAND driver */
#ifdef CONFIG_MTD_PARTITIONS
 .parts  = onenand_partitions,
 .nr_parts = ARRAY_SIZE(onenand_partitions),
#endif
 .flags  = ONENAND_SYNC_READWRITE,
};

static void __init board_onenand_init(void)
{
#ifdef CONFIG_MTD_PARTITIONS
// only register if size and offset is correct
    if(check_mtd(onenand_partitions, ARRAY_SIZE(onenand_partitions)))
        gpmc_onenand_init(&board_onenand_data);
#else
    gpmc_onenand_init(&board_onenand_data);
#endif
}

#else

static inline void board_onenand_init(void)
{
}

#endif

//然后删除旧的分区代码编译成功

然后make uImage不能打开nitird文件夹

make uImage

scripts/kconfig/conf -s arch/arm/Kconfig
drivers/media/Kconfig:165⚠️ defaults for choice values not supported
drivers/media/Kconfig:171⚠️ defaults for choice values not supported
CHK include/linux/version.h
make[1]: “include/asm-arm/mach-types.h”是最新的。
CHK include/linux/utsrelease.h
SYMLINK include/asm -> include/asm-arm
CALL scripts/checksyscalls.sh
CHK include/linux/compile.h
/media/mtd1/r3d4/scripts/gen_initramfs_list.sh: Cannot open ‘…/android/nitird’
make[1]: *** [usr/initramfs_data.cpio] 错误 1
make: *** [usr] 错误 2

于是重新修改.config
CONFIG_BLK_DEV_INITRD=y
CONFIG_INITRAMFS_SOURCE="/android/nitird"
再运行make uImage
Initial RAM filesystem and RAM disk (initramfs/initrd) support (BLK_DEV_INITRD) [Y/n/?] y
Initramfs source file(s) (INITRAMFS_SOURCE) [] (NEW) /android/nitird //在此处键入路径后编译成功
在运行中出现有两项不匹配

将生成的uImage更名为boot.img文件要大一点!(最后…分区文件修改后编译成功)

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

pinkrecall2012

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值