Port kernel 2.6.24.4 to S3C2440

Source: Internet
Author: User

After twists and turns, the new kernel finally starts the new system. Thank you for your guidance and the authors of these two articles, which have helped me a lot. Bytes. Bytes --------------------------------------------------------------------------------------------------- Porting environment:HOST: centos 5.1 Cross Compiler: arm-linux-gcc-3.4.1 Development Board platform: S3C2440 (YL-2440/YLP-2440 Development Board) Bytes -------------------------------------------------------------------------------------------- Preparations:Download the Linux kernel source code: http://www.kernel.org/pub/linux/kernel/v2.6/linux-2.6.24.4.tar.bz2 (go up to a look, today 2.6.25 kernel out) cross compilation Toolkit: From the disc is generally taken, not to the Internet to look for it. Unzip source code: tar-jxvf linux-2.6.24.4.tar.bz2 install cross-compilation tool: tar-jxvf arm-linux-gcc-3.4.1.tar.bz2-C/will install the tool in/usr/local/ARM/3.4.1, depending on the environment, you can modify the path in the makefile. Bytes -------------------------------------------------------------------------------------------------------------------- Modify the configuration file:1. Modify makefile to match the cross compiler. In the root directory of the kernel code, find the vim makefile in row 193 and change arch to arch = armcros_compile? =/Usr/local/ARM/3.4.1/bin/arm-linux-CORSS_COMPILE depends on your environment 2. to support devfs in the kernel and to automatically mount/dev to the devfs file system at startup and before/sbin/init is run. Edit fs/kconfig: Add the following code under menu "pseudo filesystems" on Line 1: config devfs_fsbool "/dev File System Support (obsolete) "Default yconfig devfs_mountbool" automatically mount at Boot "Default ydepends on devfs_fs 3. Bytes -------------------------------------------------------------------------------------------------------------------- Modify source code:1. Modify the partition information of the NAND. To make the kernel aware of the partition information of the NAND Flash, set it to be consistent with that of the bootloader. Modify smdk_default_nand_part [] in arch/ARM/plat-s3c24xx/common-smdk.c, note that this must be consistent with bootloader. Modify static struct mtd_partition smdk_default_nand_part [] = {[0] = {. name = "Boot ",. size = sz_128k + sz_64k, // 192 K 0x00300000. offset = 0 ,}, [1] = {. name = "kernel ",. size = sz_16k * 116, // 2 m-192 K 0x01e00000. offset = sz_16k * 12, // 192 K}, [2] = {. name = "rootfs ",. offset = sz_2m ,. size = sz_2m * 15, // 30 m}, [3] = {. name = "user ",. offset = sz_32m ,. size = sz_32m, }}; In addition, this file also needs to modify smdk_nand _ Info: static struct s3c2410_platform_nand smdk_nand_info = {. tacls = 0, // default is 20. twrph0 = 30, // default is 60. twrph1 = 0, // defualt is 20 changed by yangdk. nr_sets = array_size (smdk_nand_sets ),. sets = smdk_nand_sets,}; 2. modify the clock in arch/ARM/mach-s3c2440/mach-smdk2440.c smdk2440_map_io the following static void _ init smdk2440_map_io (void) {s3c24xx_init_io (inflow, array_size (smdk2440_iodesc); C S3 24xx_init_clocks (12000000); // default is 16934400, changed by partition (smdk2440_uartcfgs, array_size (smdk2440_uartcfgs);} 3. Modify the NAND Flash verification method and remove ECC verification. In Drivers/MTD/NAND/S3C2410. in line C, convert chip-> ECC. mode = nand_ecc_soft; changed to chip-> ECC. mode = nand_ecc_none; note: the ECC verification is removed, which is not recommended in the kernel, because the detection of bad NAND Flash blocks is ignored. At the beginning, I also removed the ECC verification option during compilation. I thought it was okay to remove it from the compilation option. The result always reported the following error: end_request: i/O error, Dev mtdblock2, sector 0fat: unable to read boot sectorvfs: cannot open root device "mtdblock2" or unknown-block (31,2) please append a correct "root =" Boot option; here are the available partitions: 1f00 192 mtdblock0 (driver ?) 1f01 1856 mtdblock1 (driver ?) 1f02 30720 mtdblock2 (driver ?) 1f03 32768 mtdblock3 (driver ?) Kernel panic-not syncing: VFS: Unable to mount root FS on unknown-block () all day depressed. Later, we found that the option removed from the configuration was not completely removed from the Code, but the hardware verification method was removed and replaced with software verification. Verification is not performed only when nand_ecc_none is changed in the code, but this is not recommended. However, this is the final result of my system, Amitabha! Configure and compile the kernel First, copy the default configuration file cp arch/ARM/configs/s. 3c 2410_defconfig. config Configuration Make menuconfig  [*] Enable loadable module support --->[*] Module Unloading [*] automatic kernel module loading select the two, and the rest can be removed. System type ---->[*] S3C2410 DMA support [*] Support ARM920T processor S3C2410 machines ---> [*] smdk2410/a9m2410 S3C2440 machines ---> [*] smdk2440 [*] smdk2440 with S3C2440 CPU module system type this part, if you select only these options, you can remove all the other options. I chose the thumb Support Team. In addition, some posts on the Internet say that only smdk2440 can be selected, and others can be removed. In fact, this is not the case. I tried it multiple times, are compiled to arch/ARM/plat-s3c24xx/s3c24xx. when O, error: ARCH/ARM/plat-s3c24xx/s3c244x. c: In function 's3c244x _ init_clocks ': ARCH/ARM/plat-s3c24xx/s3c244x. c: 121: Error: Implicit declaration of function 's3c2410 _ baseclk_add' make [1]: *** [ARCH/ARM/plat-s3c24xx/s3c244x. o] Error 1 make: *** [ARCH/ARM/plat-s3c24xx] Error 2 I select smdk2410/a9m2410 again, the problem is solved. Boot option ----->Change the startup parameter to noinitrd root =/dev/mtdblock2 init =/linuxrc console = ttysac0. 115200 may vary depending on the settings of the individual board, I load the file system from NAND Flash, where mtdblock2 is the partition that stores my Linux File System. However, this setting is invalid when bootloader can pass kernel parameters. Device Drivers ---><*> Memory technology device (MTD) support ---> [*] MTD partitioning support <*> NAND device support ---> <*> NAND Flash Support for S3C2410/S3C2440 SOC [] S3C2410 NAND hardware ECC // remove [*] network device support ---> [*] Ethernet (10 or 100 Mbit) ---> <*> dm9000 support <> real time clock ---> // remove the two parts of the red letter, and select the black part. You can choose other options by default. File systems ---><*> ROM file system support: Because my file system uses cramfs, select this option and use the default option for others. So far, it has basically been completed. Make zimage ...... In the last restroom, I washed my face and ate an apple. The sysmap system appeared one after another in 20 minutes. map sysmap. tmp_system.map objcopy ARCH/ARM/boot/image kernel: ARCH/ARM/boot/image is ready as ARCH/ARM/boot/compressed/head. O gzip ARCH/ARM/boot/compressed/piggy.gz as ARCH/ARM/boot/compressed/piggy. o cc arch/ARM/boot/compressed/Misc. O ld ARCH/ARM/boot/compressed/vmlinux objcopy ARCH/ARM/boot/zimage kernel: ARCH/ARM/boot/zimage is ready. The compilation is successful! Burn new kernel ...... Start the new kernel:Read chip id = ec76nand flash status = c0set boot Params = root =/dev/mtdblock2 init =/linuxrc load_ramdisk = 0 console = ttysac1, 115200 mem = 65536 K devfs = Mount load kernel... linux version 2.6.24.4 (root @ centos) (GCC version 3.4.1) #13 Thu Apr 17 10:45:28 CST 2008cpu: ARM920T [41129200] Revision 0 (armv4t), Cr = c0007177machine: Unsupported is deprecated; please update your bootloader. memory Policy: ECC disabled, data cache writebackcpu s3c2440a (ID 0x32440001) s3c244x: Core 400.000 MHz, memory 100.000 MHz, peripheral 50.000 mhzs3c24xx clocks, (c) 2004 simtec electronicsclock: slow mode (1.500 MHz), fast, mpll on, upll oncpu0: D vivt write-back cachecpu0: I cache: 16384 bytes, associativity 64, 32 byte lines, 8 setscpu0: d cache: 16384 bytes, associativity 64, 32 byte lines, 8 setsbuilt 1 Zon Elists in Zone order, mobility grouping on. total pages: 16256 kernel command line: Root =/dev/mtdblock2 init =/linuxrc load_ramdisk = 0 console = ttysac1, 115200 mem = 65536 K devfs = Mount IRQ: clearing pending ext Status Interval d400irq: Clearing subpending status limit 0092pid hash table entries: 256 (Order: 8, 1024 bytes) timer tcon = 00590000, tcnt a2c1, tcfg complete, USEC limit 1eb8console: Color dummy Device 80x30console [ttysac1] enableddentry cache hash table entries: 8192 (Order: 3, 32768 bytes) inode-Cache hash table entries: 4096 (Order: 2, 16384 bytes) memory: 64 MB = 64 MB totalmemory: 61568kb available (2896 K code, 299 K data, 124 K init) Mount-Cache hash table entries: 512cpu: Testing write buffer coherency: oknet_namespace: 64 bytesnet: Registered protocol family 16s3c2410 power management, (C) 2004 simtec electronicss3c2440: initialising ubuntures3c2440: IRQ supports3c2440: clock support, DVS offs3c24xx DMA driver, (c) 2003-simtec electronicsdma channel 0 at c4800000, IRQ 33dma Channel 1 at c4800040, IRQ 34dma Channel 2 at c4800080, IRQ 35dma Channel 3 at c48000c0, IRQ 36 usbcore: registered new interface driver usbfsusbcore: registered new interface driver hubusbcore: Registered New Device Driver usbnet: Registered protocol family 2ip route cache hash table entries: 1024 (Order: 0, 4096 bytes) TCP established hash table entries: 2048 (Order: 2, 16384 bytes) TCP bind hash table entries: 2048 (order: 1, 8192 bytes) TCP: Hash Tables configured (established 2048 bind 2048) TCP Reno registerednetwinder floating point emulator v0.97 (Double Precision) jffs2 Version 2.2. (Nand) 2001-2006 Red Hat, Inc. fuse Init (API version 7.9) Io scheduler Noop registeredio scheduler anticipatory registered (default) Io scheduler deadline registeredio scheduler CFQ registereds3c2410-lcd: no platform data for LCD, cannot s3c2410-lcd: probe of s3c2410-lcd failed with error-22lp: driver loaded but no devices foundppdev: User-space parallel port driverserial: 8250/1 6550 driver $ revision: 1.90 $4 ports, IRQ sharing enableds3c2440-uart.0: s3c2410_serial0 at mmio 0x50000000 (IRQ = 70) is a S3C2440s3c2440-uart.1: s3c2410_serial1 at mmio 0x50004000 (IRQ = 73) is a S3C2440s3c2440-uart.2: maid at mmio 0x50008000 (IRQ = 76) is a s3c2440ramdisk driver initialized: 16 RAM disks of 4096 K size 1024 blocksizeloop: module loadeddm9000 Ethernet driveruniform mu LTI-platform E-IDE driver revision: 7.00alpha2ide: Assuming 50 MHz system bus speed for Pio modes; override with idebus = xxs3c24xx NAND driver, (c) 2004 simtec Electronicss3c2440-nand s3c2440-nand: tacls = 1, 10ns twrph0 = 7 70ns, twrph1 = 1 10 nsnand device: Manufacturer ID: 0xec, chip ID: 0x76 (Samsung NAND 64mib, 3 V 8-bit) nand_ecc_none selected by board driver. this is not recommended !! Scanning Device for bad blockscreating 4 MTD partitions on "NAND 64mib 3,3 V 8-bit": 0x00000000-0x00030000: "bootloader" failed: "kernel_zimage" 0x00200000-0x02000000: "rootfs" failed: "user" usbmon: debugfs is not availables3c2410-ohci s3c2410-ohci: s3c24xx OHCIs3c2410-ohci s3c2410-ohci: new USB bus registered, assigned bus number 1s3c2410-ohci s3c2410-ohci: IRQ 42, Io Mem 0x49000000usb usb1: configuration #1 chosen from 1 choicehub 1-0:1. 0: USB hub foundhub 1-0: 1. 0: 2 ports detectedmice: PS/2 mouse device common for all mices3c2440-i2c s3c2440-i2c s3c2440-i2c: slave address 0x10s3c2440-i2c KHzs3c2440-i2c: Bus frequency set to 390 s3c2440-i2c i2c-0: s3c I2C adapters3c2410 watchdog timer, (c) 2004 simtec Electronicss3c2410-wdt s3c2410-wdt: watchdog inactive, res Et disabled, IRQ enabledtcp cubic registerednet: Registered protocol family 1rpc: Registered UDP Transport module. RPC: Registered TCP transport module. VFS: mounted root (cramfs filesystem) readonly. freeing init memory: 124 kinit started: busybox v1.9.2 (00:31:28 Cst) starting PID 772, tty '': '/etc/init. d/RCS '# mount all ....... # Starting mdev .... **************************************** ** y Angdk linux-2.6.24.4 boot ************************************* ***** starting PID 778, tty '': '/bin/Sh' processing/etc/profile ...... done! /# It indicates that the kernel is working properly... The red part shows that the file system has been loaded successfully! The file system is built on busybox1.9.2. Mainly refer to the http://blog.chinaunix.net/u2/63560/showart_518011.html, thank you! Note that when using the mkcramfs tool, you must use the-E Option to specify the version 2.6.24.4 to match the new kernel, otherwise, such errors will occur as I was and depressed. Warning: Unable to open an initial console. CLK: Version magic '2. 6.12-h1940 armv4 gcc-3.4 'could be '2. 6.24.4 mod_unload armv4 's3c2410mci: Version magic '2. 6.12-h1940 armv4 gcc-3.4 'could be '2. 6.24.4 mod_unload armv4 'for this, it is still necessary to find out the source code of mkcramfs to know that there is such an option-E. In fact, you can view it through mkcramfs-help, but did not expect it, really dizzy ~~~

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.