JZ2440:编译linux内核

来源:互联网 发布:多人直播源码 编辑:程序博客网 时间:2024/06/08 17:56
linux内核版本:linux-3.4.112
本文链接:http://blog.csdn.net/qqliyunpeng/article/details/52163039

1. 更改Makefile:

ARCH            ?= arm
CROSS_COMPILE   ?= arm-none-linux-gnueabi-

2. 打开arch/arm/mach-s3c24xx/mach-mini2440.c,修改参数分区:

@@ -248,25 +248,33 @@ static struct s3c24xx_mci_pdata mini2440_mmc_cfg __initdata = {
static struct mtd_partition mini2440_default_nand_part[] __initdata = {
        [0] = {
                .name   = "u-boot",
-               .size   = SZ_256K,
+               .size   = SZ_512K,
                .offset = 0,
        },
        [1] = {
                .name   = "u-boot-env",
-               .size   = SZ_128K,
-               .offset = SZ_256K,
-       },
-       [2] = {
-               .name   = "kernel",
-               /* 5 megabytes, for a kernel with no modules
-                * or a uImage with a ramdisk attached */
-               .size   = 0x00500000,
-               .offset = SZ_256K + SZ_128K,
+               .size   = SZ_512K,
+               .offset = SZ_512K,
        },
+    [2] = {
+        .name  = "kernel",
+        /* 5 megabytes, for a kernel with no modules
+         * or a uImage with a ramdisk attached */
+        /*
+         *.size        = 0x00500000,
+         *.offset      = SZ_256K + SZ_128K,
+         */
+        .size  = SZ_4M,
+        .offset        = SZ_1M,
+    },
        [3] = {
                .name   = "root",
-               .offset = SZ_256K + SZ_128K + 0x00500000,
-               .size   = MTDPART_SIZ_FULL,
+        /*
+                *.offset       = SZ_256K + SZ_128K + 0x00500000,
+                *.size = MTDPART_SIZ_FULL,
+         */
+               .offset = SZ_1M*5,
+               .size   = SZ_1M*100,
        },
 };

drivers/mtd/nand/s3c2410.c 文件
@@ -843,7 +843,7 @@ static void s3c2410_nand_init_chip(struct s3c2410_nand_info *info,

                }
        } else {
-               chip->ecc.mode      = NAND_ECC_SOFT;
+               chip->ecc.mode      = NAND_ECC_NONE;
        }

        if (set->ecc_layout != NULL)

3. 配置内核:

make mini2440_defconfig
这里也可以是 make s3c2410_defconfig
他们的行为后者说目的之一就是 将 arch/arm/config/ 目录下的相同名字的配置文件拷贝到根目录下并且更改名字为 .config
在编译的时候编译的文件也有所不同:
make mini2440_defconfig,会编译 arch/arm/mach-s3c2440/ 下的文件
make s3c2410_defconfig,会编译 arch/arm/mach-s3c2410/ 下的文件

make menuconfig
Kernel Features  ---> 
    [*]   Allow old ABI binaries to run with this kernel (EXPERIMENTAL)  
    [*] Provide old way to pass kernel parameters  
Device Drivers  --->  
    <*> Memory Technology Device (MTD) support  --->
  < >   FTL (Flash Translation Layer) support
  < >   NFTL (NAND Flash Translation Layer) support
  < >   INFTL (Inverse NAND Flash Translation Layer) support
去掉这三项,会消除相应的警告

使内核支持yaffs2,此对应的是yaffs2根文件系统的制作
File systems  --->
    [*] Miscellaneous filesystems  --->
 <*>   yaffs2 file system support
Kernel hacking  --->
  [*] Kernel low-level debugging functions (read help!)
 (这里没选上,starting kernel 之后无输出)

make uImage

生成的uImage存放在:
arch/arm/boot/uImage
现在你可以将它放到你的tftp的服务的文件夹下了
我的是放在的 /tftpboot

4. 需要注意的几点:

有两个概念需要明白,即是bootm address和kernel运行地址。
  • bootm address:通过uboot的bootm命令,从address启动kernel。
  • kernel运行地址:在具体mach目录中的Makefile.boot中指定,是kernel启动后实际运行的物理地址。
  1. 如果bootm address和Load Address相等,在这种情况下,bootm不会对uImage header后的zImage进行memory move的动作,而会直接go到Entry Point开始执行。因此此时的Entry Point必须设置为Load Address+ 0x40。如果kernel boot过程没有到uncompressing the kernel,就可能是这里设置不对。它们之间的关系为:boom address == Load Address == Entry Point - 0x40
  2. 如果bootm address和Load Address不相等(但需要避免出现memory move时出现覆盖导致zImage被破坏的情况)。此种情况下,bootm会把uImage header后的zImage文件move到Load Address,然后go到entry point开始执行。这段代码在common/cmd_bootm.c中bootm_load_os函数中。由此知道此时的Load Address必须等于Entry Point。它们之间的关系则为:boom address != Load Address == Entry Point
5. 后来添加:
在调试驱动的过程中,发现用的 mini2440 的开发板的配置文件中的按键跟 jz2440 开发板的 S4 按键有冲突,考虑到想要以模块的方式加载 按键设备和按键驱动,将相关设备部分去掉,修改如下:
@@ -345,6 +353,7 @@ static struct platform_device mini2440_device_eth = {
  *       .....
  */
 static struct gpio_keys_button mini2440_buttons[] = {
+#if 0
        {
                .gpio           = S3C2410_GPG(0),               /* K1 */
                .code           = KEY_F1,
@@ -375,7 +384,7 @@ static struct gpio_keys_button mini2440_buttons[] = {
                .desc           = "Button 5",
                .active_low     = 1,
        },
-#if 0
+/*#if 0*/
        /* this pin is also known as TCLK1 and seems to already
         * marked as "in use" somehow in the kernel -- possibly wrongly */
        {
0 0
原创粉丝点击