1. 程式人生 > >移植kernel-3.10.79 (1)

移植kernel-3.10.79 (1)

linux uimage none mas 註意 mon pat sta gcc

u-boot 使用u-boot-2014.10

find * -name "*2410*_defconfig"
find * -name "*2440*_defconfig"

可以看到
arch/arm/configs/mini2440_defconfig
arch/arm/configs/s3c2410_defconfig


下載命令:

set serverip 192.168.1.104
kernel:
  tftp 30000000 uImage
  nand erase 0x000c0000 0x500000
  nand write.jffs2 30000000 0xc0000 0x500000
  set machid 16a

1 基本修改

1.1 GCC

export  PATH=PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/home/flinn/tools/4.4
.3/bin

1.2 Makefile

ARCH            ?= arm
CROSS_COMPILE   ?= arm-linux-

或者

ARCH            ?= arm
CROSS_COMPILE   ?= /home/flinn/tools/4.4.3/bin/arm-none-linux-gnueabi-

1.3 編譯

make s3c2410_defconfig;make    uImage    // s3c2410_defconfig肯定比mini2440_defconfig更全面些

這裏s3c2410_defconfig肯定有開發板的支持, 編譯出來的uImage會很大。執行make menuconfig裁剪

1.4 燒錄

Uncompressing Linux... done, booting the kernel.
        
        Error: unrecognized/unsupported machine ID (r1 = 0x000000c1).
        
        Available machine support:
        
        ID (hex)        NAME
        000007cf        MINI2440
        0000016a        SMDK2440

1.5 設置u-boot參數machid

  set machid 16a
  boot後 亂碼
  set machid 7cf,正常
  可知smdk2440時鐘有問題

1.6 修改時鐘

  vim arch/arm/mach-s3c24xx/mach-smdk2440.c

  

smdk2440_map_io
            s3c24xx_init_clocks(16934400);   //改成12000000

燒錄啟動:

0x000000000000-0x000000004000 : "Boot Agent"
        mtd: partition "Boot Agent" doesnt end on an erase block -- force read-only
        0x000000000000-0x000000200000 : "S3C2410 flash partition 1"

1.7 修改分區

  註意:最小單位128K,否則
  mtd: partition "device_tree" doesn‘t end on an erase block -- force read-onl

  vim arch/arm/mach-s3c24xx/common-smdk.c

  

static struct mtd_partition smdk_default_nand_part[] = {
        [0] = {
                .name   = "bootloader",
                .size   = SZ_512K,
                .offset = 0,
        },
        [1] = {
                .name   = "device_tree",
                .offset = MTDPART_OFS_APPEND,
                .size   = SZ_128K,
        },
        [2] = {
                .name   = "params",
                .offset = MTDPART_OFS_APPEND,
                .size   = SZ_128K,
        },
        [3] = {
                .name   = "kernel",
                .offset = MTDPART_OFS_APPEND,
                .size   = 0x500000,          // 5M
        },
        [4] = {
                .name   = "root",
                .offset = MTDPART_OFS_APPEND,
                .size   = MTDPART_SIZ_FULL,
        }
            };

  新分區:

  

device nand0 <smdk2440-0>, # parts = 5
 #: name                size            offset          mask_flags
 0: bootloader          0x00080000      0x00000000      0
 1: device_tree         0x00020000      0x00080000      0
 2: params              0x00020000      0x000a0000      0
 3: kernel              0x00500000      0x000c0000      0
 4: rootfs              0x0fa40000      0x005c0000      0

  設置u-boot

  #define CONFIG_BOOTCOMMAND "nand read.jffs2 0x30007FC0 kernel; nand read.jffs2 32000000 device_tree; bootm 0x30007FC0 - 0x32000000"

移植kernel-3.10.79 (1)