Embedded ARM transplantation 3: porting linux-2.6.26 Kernel

Source: Internet
Author: User

Host:
Kubuntu 8.04 (linux-2.6.24-19)
Gcc-4.2.3
Target machine:
S3C2440
Cross Compiler (made by crosstool-0.43 ):
Arm-linux-gcc-4.1.0
Kernel version to be transplanted:
Linux-2.6.26
File System:
Cramfs
Bytes ---------------------------------------------------------------------------------------------------
Prerequisites:
Linux supports multiple platform architectures. Under the arch directory of its source code, the source code of various supported platform architectures has been divided into different categories. For ease of configuration, a directory named configs is usually provided under the directories of various platform architectures. There are many pre-configured defconfig files. Through these defconfig files, we can speed up Kernel configuration.
For example, if I use an ARM-based S3C2440 board, I can find the s3c2410_defconfig from arch/ARM/configs/. This is a default configuration file that currently best matches 2440. Usage:
$ Make s3c2410_defconfig
Or
$ Cp arch/ARM/configs/s3c2410_defconfig./. config
After the preceding command is executed, the corresponding. config configuration file is generated in the source code directory. Pass
$ Make menuconfig
Or
$ Make xconfig
You can further configure the kernel. Last executed
$ Make zimage
Generate the burning files we need
Basic commands for Kernel Compilation:
Make mrproper --- clear all files, including. config and some backup files
Make clean --- clear the generated files, but keep. config and some module files.
Make defconfig --- generate a. config file containing all default options. Replace make s3c2410_defconfig here
Make oldconfig --- generate a new. config file based on the old. config file. If you only want to modify some small points based on the original Kernel configuration, it will save a lot of trouble.
Make config --- text-based most traditional configuration interface, which is not recommended
Make menuconfig --- text menu-based configuration interface, which is recommended for character Terminals
Make xconfig --- configuration interface based on the graphic window mode, which is recommended in XWindow
The purpose is to generate a. config file. In the three commands, make
The xconfig interface is the most friendly. If you can use XWindow, you can use this interface, which is convenient and easy to set. If you cannot use XWindow, use
Make menuconfig. Although the interface is worse than the previous one, it is better than make config.
Make --- compile by default.
Make bzimage --- compile and generate compressed kernel binary files, which will also be replaced by make zimage
Bytes ---------------------------------------------------------------------------------------------------
References:

Linux 2.6.22.2 kernel porting Method
"

Port kernel 2.6.24.4 to S3C2440
"

For Kernel panic -...... A summary of the error!
"
Bytes ---------------------------------------------------------------------------------------------------
Transplant linux-2.6.26inner kernel (hypothetical downloaded linux-2.6.26.tar.bz2)
1. Extract the source code
$ Tar jxvf linux-2.6.26.tar.bz2
$ Linux-2.6.26 CD
2. Change makefile
# Arch? = $ (Subarch)
# Cross_compile? =
Arch? = Arm
Cross_compile? = $ Home/toolchain/crosstool/gcc-4.1.0-glibc-2.3.2/ARM-Linux-GNU/bin/ARM-Linux-GNU-
3. Generate Default Configuration
$ Make s3c2410_defconfig
4. Added support for the devfs file system.
Linux2.6.26 has removed devfs. To support devfs in the kernel and automatically mount/dev to the devfs file system at startup and before running/sbin/init, modify the kconfig file of FS.
Linux-2.6.26/fs/kconfig
Modified content:
Find menu "pseudo filesystems"
Add the following statement:
Config devfs_fs
Bool "/dev File System Support (obsolete )"
Depends on experimental
Help
This is support for devfs, A Virtual File System (like/proc) which
Provides the file system interface to device drivers, normally found
In/dev. devfs does not depend on major and minor number
Allocations. device drivers register entries in/dev which then
Appear automatically, which means that the system administrator does
Not have to create character and block special device files in
/Dev directory using the mknod command (or makedev script) anymore.
This is work in progress. If you want to use this, you * Must * read
The material in, especially
The file readme there.
Note that devfs no longer manages/dev/PTS! If you are using unix98
Ptys, you will also need to mount the/dev/PTS filesystem (devpts ).
Note that devfs has been obsoleted by udev,
.
It has been stripped down to a bare minimum and is only provided
Legacy installations that use its naming scheme which is
Unfortunately different from the names normal Linux Installations
Use.
If unsure, say n.
Config devfs_mount
Bool "automatically mount at Boot"
Depends on devfs_fs
Help
This option appears if you have config_devfs_fs enabled. Setting
This to 'y' will make the kernel automatically mount devfs onto/dev
When the system is booted, before the init thread is started.
You can override this with the "devfs = nomount" Boot option.
If unsure, say n.
Config devfs_debug
Bool "Debug devfs"
Depends on devfs_fs
Help
If you say y here, then the/dev file system code will generate
Debugging messages. See the file
For more details.
If unsure, say n.
5. Modify the crystal oscillator to solve the problem of printing information garbled characters)
Files: ARCH/ARM/mach-s3c2440/mach-smdk2440.c
/* S3c24xx_init_clocks (16934400 );*/
2011-0xx_init_clocks (12000000 );
6. Modify MTD Partition
Files: ARCH/ARM/plat-s3c24xx/common-smdk.c
/* Fix MTD partition to be same with bootloader */
/* A flash all in 64 M bit size have been devided into 4 partition :*/
/* 1. Boot: offset is 0 and size is 192 K */
/* 2. kernel: offset is 0x30000 and size is 1856 K */
/* 3. rootfs: offset is 0x200000 and size is 30 m */
/* 4. ext-fs1: offset is 0x2000000 and size is 32 m */
Static struct mtd_partition smdk_default_nand_part [] = {
[0] = {
. Name = "Boot",/* default is "Boot Agent", by qspy */
. Size = sz_64k * 3,/* default is sz_16k, qspy fix it to 192 K */
. Offset = 0,
},
[1] = {
. Name = "kernel",/* default is "S3C2410 flash partition 1", by qspy */
. Offset = sz_64k * 3,/* default is 0, by qspy */
. Size = sz_64k * 29,/* default is sz_2m, qspy fix it to 1856 K */
},
[2] = {
. Name = "rootfs",/* default is "S3C2410 flash partition 2", by qspy */
. Offset = sz_2m,/* default is sz_4m, by qspy */
. Size = sz_1m * 30,/* default is sz_4m, qspy fix it to 30 m */
},
[3] = {
. Name = "ext-fs1",/* default is "S3C2410 flash partition 2", by qspy */
. Offset = sz_32m,/* default is sz_8m, by qspy */
. Size = sz_32m,/* default is sz_2m, qspy fix it to 30 m */
}/*,
[4] = {
. Name = "S3C2410 flash partition 4 ",
. Offset = sz_1m * 10,
. Size = sz_4m,
},
[5] = {
. Name = "S3C2410 flash partition 5 ",
. Offset = sz_1m * 14,
. Size = sz_1m * 10,
},
[6] = {
. Name = "S3C2410 flash partition 6 ",
. Offset = sz_1m * 24,
. Size = sz_1m * 24,
},
[7] = {
. Name = "S3C2410 flash partition 7 ",
. Offset = sz_1m * 48,
. Size = sz_16m,
}*/
};
7. Disable ECC verification
File: Drivers/MTD/NAND/S3C2410. c
Function: s3c2410_nand_init_chip
/* Chip-> ECC. mode = nand_ecc_soft ;*/
Chip-> ECC. mode = nand_ecc_none;
8. Configure the kernel
$ Make xconfig
The following items must be modified:
A. Start
| --- Boot options
| --- Default kernel command string: [root =/dev/mtdblock2
Rootfstype = cramfs init =/linuxrc console = ttysac1, 115200 devfs = Mount
Mem = 64]
Analysis:
/Dev/mtdblock2: indicates the root file system of the 2nd partitions in the MTD partition.
Rootfstype = cramfs: The partition type is cramfs. This does not have to be added.
Init =/linuxrc: The first script started is linuxrc in the root directory.
Console = ttysac1, 115200: Serial Port 1 is used for serial port debugging, And the baud rate is set to 115200. Now, the ttys0 method has been abandoned.
Devfs = mount: The/sbin/init file system can be automatically mounted./Dev is the devfs file system.
Mem = 64: the memory size is 64 MB.
B. Added support for the devfs file system.
| --- File systems
| --- Pseudo filesystems
| ---/Dev File System Support
| --- Automatically mount at boot
| --- Debug devfs
These items are mandatory.
C. Chip and system type
| --- System type
| --- S3C2410 machines
| --- Smdk2410/a9m2410
When 2440 is supported, this item is also required. Otherwise, the compilation will fail.
-----------------------------------------------------
Problems:
1. garbled characters during startup
Information:
NAND Flash status = C0
Set boot Params = root =/dev/mtdblock2 init =/linuxrc load_ramdisk = 0 console = ttysac1, 115200 mem = 65536 K devfs = mount display = shp480
Load kernel...
8 ?? Objective C? Comment 'd? G # comment '{{ comment \ 'then
Resolution: clock problem. Change the clock frequency to 12 Mb.
2. File System cramfs mounting failed
IP 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 registered
Net: Registered protocol family 1
Netwinder floating point emulator v0.97 (Double Precision)
Ms gmni has been set to 120
Io scheduler Noop registered
Io scheduler anticipatory registered (default)
Io scheduler deadline registered
Io scheduler CFQ registered
Console: switching to color frame buffer device 30x40
Fb0: s3c2410fb Frame Buffer Device
S3c2440-uart.0: s3c2410_serial0 at mmio 0x50000000 (IRQ = 70) is a S3C2440
S3c2440-uart.1: s3c2410_serial1 at mmio 0x50004000 (IRQ = 73) is a S3C2440
S3c2440-uart.2: maid at mmio 0x50008000 (IRQ = 76) is a S3C2440
BRD: module loaded
Usbcore: registered new interface driver UB
Dm9000 Ethernet driver, v1.30
Linux video capture interface: v2.00
Nftl DRIVER: nftlcore. C $ revision: 1.98 $, nftlmount. C $ revision: 1.41 $
S3c24xx NAND driver, (c) 2004 simtec Electronics
S3c2440-nand s3c2440-nand: tacls = 1, 10ns twrph0 = 4 40ns, twrph1 = 1 10ns
Nand device: Manufacturer ID: 0xec, chip ID: 0x76 (Samsung NAND 64mib, 3 V 8-bit)
S3c2410_nand_update_chip: Chip c3d7d4bc: 9
Scanning Device for Bad blocks
Bad eraseblock 357 at 0x00594000
Bad eraseblock 3335 at 0x0341c000
Bad eraseblock 3995 at 0x03e6c000
Creating 4 MTD partitions on "NAND 64mib, 3 V 8-bit ":
0x00000000-0x00030000: "Boot"
0x00030000-0x00200000: "kernel"
0x00200000-0x02000000: "rootfs"
0x02000000-0x04000000: "ext-fs1"
Usbmon: debugfs is not available
S3c2410-ohci s3c2410-ohci: s3c24xx OHCI
S3c2410-ohci s3c2410-ohci: new USB bus registered, assigned bus number 1
S3c2410-ohci s3c2410-ohci: IRQ 42, Io mem 0x49000000
USB usb1: configuration #1 chosen from 1 choice
Hub 1-. 0: USB hub found
Hub 1-0: 1. 0: 2 ports Detected
Initializing USB Mass Storage driver...
Usbcore: registered new interface driver USB-storage
USB Mass Storage support registered.
Mice: PS/2 mouse device common for all mice
I2C/dev entries driver
S3c2440-i2c s3c2440-i2c: slave address 0x10
S3c2440-i2c s3c2440-i2c: Bus frequency set to 390 kHz
S3c2440-i2c s3c2440-i2c: i2c-0: s3c I2C Adapter
S3C2410 watchdog timer, (c) 2004 simtec Electronics
S3c2410-wdt s3c2410-wdt: watchdog inactive, reset disabled, IRQ Enabled
Registered LED Device: led4
Registered LED Device: led5
Registered LED Device: led6
Registered LED Device: led7
TCP cubic registered
RPC: Registered UDP Transport module.
RPC: Registered TCP transport module.
End_request: I/O error, Dev mtdblock2, Sector 2
EXT2-fs: unable to read superblock
End_request: I/O error, Dev mtdblock2, sector 0
Buffer I/O error on device mtdblock2, Logical Block 0
End_request: I/O error, Dev mtdblock2, sector 0
Buffer I/O error on device mtdblock2, Logical Block 0
End_request: I/O error, Dev mtdblock2, Sector 8
Buffer I/O error on device mtdblock2, Logical Block 1
End_request: I/O error, Dev mtdblock2, Sector 8
Buffer I/O error on device mtdblock2, Logical Block 1
End_request: I/O error, Dev mtdblock2, Sector 16
Buffer I/O error on device mtdblock2, Logical Block 2
End_request: I/O error, Dev mtdblock2, Sector 16
Buffer I/O error on device mtdblock2, Logical Block 2
End_request: I/O error, Dev mtdblock2, sector 24
Buffer I/O error on device mtdblock2, logical block 3
End_request: I/O error, Dev mtdblock2, sector 24
Buffer I/O error on device mtdblock2, logical block 3
End_request: I/O error, Dev mtdblock2, sector 0
Fat: unable to read Boot Sector
VFS: 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 (31,2)
Possible problems:
A. MTD partition does not match bootloader
B. No support for the devfs File System
C. ECC verification is not disabled
3./linuxrc initialization failed
Linux video capture interface: v2.00
Nftl DRIVER: nftlcore. C $ revision: 1.98 $, nftlmount. C $ revision: 1.41 $
S3c24xx NAND driver, (c) 2004 simtec Electronics
S3c2440-nand s3c2440-nand: tacls = 1, 10ns twrph0 = 4 40ns, twrph1 = 1 10ns
Nand device: Manufacturer ID: 0xec, chip ID: 0x76 (Samsung NAND 64mib, 3 V 8-bit)
S3c2410_nand_update_chip: Chip c3d704bc: 9
Nand_ecc_none selected by board driver. This is not recommended !!
Scanning Device for Bad blocks
Bad eraseblock 357 at 0x00594000
Bad eraseblock 3335 at 0x0341c000
Bad eraseblock 3995 at 0x03e6c000
Creating 4 MTD partitions on "NAND 64mib, 3 V 8-bit ":
0x00000000-0x00030000: "Boot"
0x00030000-0x00200000: "kernel"
0x00200000-0x02000000: "rootfs"
0x02000000-0x04000000: "ext-fs1"
Usbmon: debugfs is not available
S3c2410-ohci s3c2410-ohci: s3c24xx OHCI
S3c2410-ohci s3c2410-ohci: new USB bus registered, assigned bus number 1
S3c2410-ohci s3c2410-ohci: IRQ 42, Io mem 0x49000000
USB usb1: configuration #1 chosen from 1 choice
Hub 1-. 0: USB hub found
Hub 1-0: 1. 0: 2 ports Detected
Initializing USB Mass Storage driver...
Usbcore: registered new interface driver USB-storage
USB Mass Storage support registered.
Mice: PS/2 mouse device common for all mice
I2C/dev entries driver
S3c2440-i2c s3c2440-i2c: slave address 0x10
S3c2440-i2c s3c2440-i2c: Bus frequency set to 390 kHz
S3c2440-i2c s3c2440-i2c: i2c-0: s3c I2C Adapter
S3C2410 watchdog timer, (c) 2004 simtec Electronics
S3c2410-wdt s3c2410-wdt: watchdog inactive, reset disabled, IRQ Enabled
Registered LED Device: led4
Registered LED Device: led5
Registered LED Device: led6
Registered LED Device: led7
TCP cubic registered
RPC: Registered UDP Transport module.
RPC: Registered TCP transport module.
VFS: mounted root (cramfs filesystem) readonly.
Freeing init memory: 124 K
Cramfs: Bad compressed blocksize 989432407
Cramfs: Bad compressed blocksize 4274059297
Failed to execute/linuxrc. Attempting defaults...
Kernel panic-not syncing: No init found. Try passing init = option to kernel.
Possible problems:
A. "Default kernel command string" is set incorrectly, for example, the specified start partition is incorrect.
B. The file system may be faulty.
The final problem may be caused by file system creation. As I have been using the file system that comes with the Development Board, I have never been able. There are many articles about busybox on the Internet. Maybe you can try this.


This article is from the chinaunix blog. If you want to view the original text, click:Http://blog.chinaunix.net/u2/77230/showart_1171688.html

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.