移植部分主要參考: [精華] s3c2410全線移植linux2.6.14.1 u盤 cs8900a busybox 詳細過程 http://www.linuxforum.net/forum/showflat.php?Cat=&Board=embedded&Number=648878&page=0&view=collapsed 配置系統可以參考: Linux2.6.14.1核心移植手記 北理小碩的Blog http://chern.blog.edu.cn/user2/51200/archives/2007/1658311.shtml 主要摘抄移植部分如下: 編譯kernel 2.6.14.1 步驟: 1. tar jxvf linux-2.6.14.1.tar.bz2 2. edit source files A) edit arch/arm/mach-s3c2410/devs.c 1. #include <linux/mtd/partitions.h> #include <asm/arch/nand.h> #include <linux/mtd/nand.h> 2. 要根據自己的BootLoad需要修改該部分: static struct mtd_partition partition_info[] ={ { name: "vivi", //注意這裡的size和offset的位置和vivi的mtd結構的位置 size: 0x00020000, offset: 0, }, { name: "param", size: 0x00010000, offset: 0x00020000, }, { name: "kernel", size: 0x00200000, offset: 0x00030000, }, { name: "root", size: 0x01E00000, offset: 0x00230000, //檢視了許多Blog都沒有這句話 } }; struct s3c2410_nand_set nandset ={ nr_partitions: 4 , partitions: partition_info , }; struct s3c2410_platform_nand superlpplatform={ tacls:0, //感謝superlp的Blog,沒有人不知道superlp的吧! twrph0:30, twrph1:0, sets: &nandset, nr_sets: 1, }; 3. struct platform_device s3c_device_nand = { .name = "s3c2410-nand", .id = -1, .num_resources = ARRAY_SIZE(s3c_nand_resource), .resource = s3c_nand_resource, .dev = { .platform_data = &superlpplatform / &s3c_device_nand, // rei1984 add }; C) edit drivers/mtd/nand/s3c2410.c s3c2410_nand_init_chip() chip->eccmode = NAND_ECC_NONE; //disable ECC,不知道現在的核心2.6.20 ECC能用嗎? D) edit /include/linux/mtd/partitions.h partitions.h檔案的最前面加上 #include <linux/list.h> //為什麼kernel出現這麼低級的錯誤?網上也讨論的很少,知道的朋友說明一下。 E) edit fs/kconfig //支援devfs, 目前2.6.17以後的kernel放棄devfs,需要udev的支援。 menu "Pseudo filesystems" config DEVFS_FS bool "/dev file system support (OBSOLETE)" default y config DEVFS_MOUNT bool "Automatically mount at boot" default y depends on DEVFS_FS // edit 終于結束了,以下是配置編譯kernel 3. edit makefile ARCH ?= arm //其實修改SUBARCH 也可以,具體檢視makefile CROSS_COMPILE ?=/usr/local/arm/3.4.1/bin/arm-linux- //注意後面的’-’ 4. make zImage Finish !kernel in /root/arm/linux-2.6.14.1/arch/arm/boot 配置部分可以參考:Linux2.6.14.1核心移植手記 [email protected] linux2.6.14]$ cp arch/arm/configs/smdk2410_defconfig .config [[email protected] linux2.6.14]$ make menuconfig 在smdk2410_defconfig基礎上,我所增删的核心配置項如下: Loadable module support > [*] Enable loadable module support [*] Automatic kernel module loading System Type > [*] S3C2410 DMA support Boot options > Default kernel command string: noinitrd root=/dev/mtdblock2 init=/linuxrc console=ttySAC0,115200 #說明:mtdblock2代表我的第3個flash分區,它是我的rootfs # console=ttySAC0,115200使kernel啟動期間的資訊全部輸出到序列槽0上. # 2.6核心對于序列槽的命名改為ttySAC0,但這不影響使用者空間的序列槽程式設計。 # 使用者空間的序列槽程式設計針對的仍是/dev/ttyS0等 Floating point emulation > [*] NWFPE math emulation This is necessary to run most binaries!!! #接下來要做的是對核心MTD子系統的設定 Device Drivers > Memory Technology Devices (MTD) > [*] MTD partitioning support #支援MTD分區,這樣我們在前面設定的分區才有意義 [*] Command line partition table parsing #支援從指令行設定flash分區資訊,靈活 RAM/ROM/Flash chip drivers > <*> Detect flash chips by Common Flash Interface (CFI) probe <*> Detect nonCFI AMD/JEDECcompatible flash chips <*> Support for Intel/Sharp flash chips <*> Support for AMD/Fujitsu flash chips <*> Support for ROM chips in bus mapping NAND Flash Device Drivers > <*> NAND Device Support <*> NAND Flash support for S3C2410/S3C2440 SoC Character devices > [*] Nonstandard serial port support [*] S3C2410 RTC Driver #接下來做的是針對檔案系統的設定,本人實驗時目标闆上要上的檔案系統是cramfs,故做如下配置 File systems > <> Second extended fs support #去除對ext2的支援 Pseudo filesystems > [*] /proc file system support [*] Virtual memory file system support (former shm fs) [*] /dev file system support (OBSOLETE) [*] Automatically mount at boot (NEW) #這裡會看到我們前先修改fs/Kconfig的成果,devfs已經被支援上了 Miscellaneous filesystems > <*> Compressed ROM file system support (cramfs) #支援cramfs Network File Systems > <*> NFS file system support 儲存退出,産生.config檔案. .config檔案能從提供的2.4.14.1的核心包中找到,檔案名為config.back. 1.4.3編譯核心 [[email protected] linux2.6.14]$ make zImage [email protected] linux2.6.14]$ cp arch/arm/configs/smdk2410_defconfig .config [[email protected] linux2.6.14]$ make menuconfig 在smdk2410_defconfig基礎上,我所增删的核心配置項如下: Loadable module support > [*] Enable loadable module support [*] Automatic kernel module loading System Type > [*] S3C2410 DMA support Boot options > Default kernel command string: noinitrd root=/dev/mtdblock2 init=/linuxrc console=ttySAC0,115200 #說明:mtdblock2代表我的第3個flash分區,它是我的rootfs # console=ttySAC0,115200使kernel啟動期間的資訊全部輸出到序列槽0上. # 2.6核心對于序列槽的命名改為ttySAC0,但這不影響使用者空間的序列槽程式設計。 # 使用者空間的序列槽程式設計針對的仍是/dev/ttyS0等 Floating point emulation > [*] NWFPE math emulation This is necessary to run most binaries!!! #接下來要做的是對核心MTD子系統的設定 Device Drivers > Memory Technology Devices (MTD) > [*] MTD partitioning support #支援MTD分區,這樣我們在前面設定的分區才有意義 [*] Command line partition table parsing #支援從指令行設定flash分區資訊,靈活 RAM/ROM/Flash chip drivers > <*> Detect flash chips by Common Flash Interface (CFI) probe <*> Detect nonCFI AMD/JEDECcompatible flash chips <*> Support for Intel/Sharp flash chips <*> Support for AMD/Fujitsu flash chips <*> Support for ROM chips in bus mapping NAND Flash Device Drivers > <*> NAND Device Support <*> NAND Flash support for S3C2410/S3C2440 SoC Character devices > [*] Nonstandard serial port support [*] S3C2410 RTC Driver #接下來做的是針對檔案系統的設定,本人實驗時目标闆上要上的檔案系統是cramfs,故做如下配置 File systems > <> Second extended fs support #去除對ext2的支援 Pseudo filesystems > [*] /proc file system support [*] Virtual memory file system support (former shm fs) [*] /dev file system support (OBSOLETE) [*] Automatically mount at boot (NEW) #這裡會看到我們前先修改fs/Kconfig的成果,devfs已經被支援上了 Miscellaneous filesystems > <*> Compressed ROM file system support (cramfs) #支援cramfs Network File Systems > <*> NFS file system support 儲存退出,産生.config檔案. .config檔案能從提供的2.4.14.1的核心包中找到,檔案名為config.back. 1.4.3編譯核心 [[email protected] linux2.6.14]$ make zImage 做完這些,應該就可以通過cramfs,jffs2等檔案系統啟動了,加上前面cs8900網卡驅動的移植,應該就可以通過nfs啟動系統了;如果沒有檔案系統,也下載下傳後,也可以看到核心的啟動資訊 |