Compiler version used for compiling the version of the kernel: ARM-LINUX-GCC 3.4.1
1. Get linux-2.6.32.2
2. Unzip the kernel
3. Switch to the kernel directory that you just unzipped:
CD linux-2.6.32.2
4. Modify Makefile
Modify the following:
Before modification:
ARCH = $ (subarch)
Cross_compile? =
After modification:
ARCH? = Arm
Cross_compile? = arm-linux-
5. Use the following command to generate the. config
Make S3c2410_defconfig
6. Modify the platform input clock, because the qq2440 input clock is 12MHz of passive crystal, so modify the following contents of the Arch/arm/mach-s3c2440/mach-smdk2440.c file:
Before modification:
static void __init smdk2440_map_io (void)
{
S3c24xx_init_io (Smdk2440_iodesc, Array_size (SMDK2440_IODESC));
S3c24xx_init_clocks (16934400);
S3c24xx_init_uarts (Smdk2440_uartcfgs, Array_size (SMDK2440_UARTCFGS));
}
After modification:
static void __init smdk2440_map_io (void)
{
S3c24xx_init_io (Smdk2440_iodesc, Array_size (SMDK2440_IODESC));
S3c24xx_init_clocks (12000000);//Modify the original data to 12000000
S3c24xx_init_uarts (Smdk2440_uartcfgs, Array_size (SMDK2440_UARTCFGS));
}
7. Modify the MTD partition information to modify the following contents of the Arch/arm/plat-s3c24xx/common-smdk.c file:
Before modification:
static struct Mtd_partition smdk_default_nand_part[] = {
[0] = {
. Name = "Boot Agent",
. Size = sz_16k,
. Offset = 0,
},
[1] = {
. Name = "S3C2410 Flash partition 1",
. Offset = 0,
. Size = sz_2m,
},
[2] = {
. Name = "S3C2410 Flash partition 2",
. offset = sz_4m,
. Size = sz_4m,
},
[3] = {
. Name = "S3C2410 Flash partition 3",
. offset = sz_8m,
. Size = sz_2m,
},
[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,
}
};
After modification:
static struct Mtd_partition smdk_default_nand_part[] = {
[0] = {
. Name = "Bootloader",
. Size = 0x00000000,
. offset = 0x00030000,
},
[1] = {
. Name = "Kernel",
. offset = 0x00050000,
. Size = 0x00200000,
},
[2] = {
. Name = "Root",
. offset = 0x00250000,
. Size = 0x03dac000,
}
};
8. Modify the s3c2440 machine code and modify the contents of the Arch/arm/tools/mach-types file as follows:
Before modification:
s3c2440 arch_s3c2440 s3c2440 362
After modification:
s3c2440 arch_s3c2440 s3c2440 782
9. Patch the kernel to the YAFFS2 file system so that the kernel can support the YAFFS2 file system
9.1 Get YAFFS2 source code from git repository, get the command of source code as follows:
git clone git://www.aleph1.co.uk/yaffs2
9.2 Insert the kernel patch into the kernel using the following methods:
A. Enter the YAFFS2 directory first:
CD YAFFS2
There is a script patch-ker.sh under the B.YAFFS2 directory, then the script can be executed:
./patch-ker.sh./patch-ker.sh c M... /linux-2.6.32.2
10. Kernel Configuration:
Use the following command to configure the operation:
Make Menuconfig
The configuration items that need to be modified are as follows:
10.1[*] Enable loadable Module Support--->
[*] Module unloading
10.2System Type--->
S3C2410 Machines--->
[*] smdk2410/a9m2410, the other under this entry is not selected
s3c2440 Machines--->
[*] SMDK2440
[*] SMDK2440 with s3c2440 CPU module, which is not selected under this entry
The entries under the remaining machines options are not selected (s3c2400,s3c2412,s3c2442,s3c2443 are not selected)
10.3Boot Options--->
NOINITRD Root=/dev/mtdblock2 INIT=/LINUXRC console=ttysac0
10.4Userspace binary Formats--->
[*] Kernel support for ELF binaries, the remaining options are not selected
10.5File Systems--->
[*] Miscellaneous filesystems--->
<*> YAFFS2 File System support
[*] Lets Yaffs does its own ECC
10.6-*-Native Language Support--->
<*> Codepage 437 (states, Canada)
<*> Simplified Chinese charset (CP936, GB2312)
<*> Traditional Chinese CharSet (BIG5)
<*> NLS ISO 8859-1 (Latin 1; Western European Languages)
<*> NLS UTF-8
11. Start compiling the kernel:
Make Zimage-j5
11.1 Errors are as follows:
In file included from Fs/yaffs2/yaffs_guts.c:18:
Fs/yaffs2/yaffs_endian.h:32:error:parse error Before "swap_loff_t"
Fs/yaffs2/yaffs_endian.h:32:error:parse error Before "Lval"
Fs/yaffs2/yaffs_endian.h:33:warning:return type defaults to ' int '
Fs/yaffs2/yaffs_endian.h:33:warning:function declaration isn ' t a prototype
fs/yaffs2/yaffs_endian.h:in function ' swap_loff_t ':
Fs/yaffs2/yaffs_endian.h:34:error: ' Lval ' undeclared (first use of this function)
Fs/yaffs2/yaffs_endian.h:34:error: (Each undeclared identifier was reported only once
Fs/yaffs2/yaffs_endian.h:34:error:for each function it appears in.)
Fs/yaffs2/yaffs_endian.h:37:error: ' y_loff_t ' undeclared (first use of this function)
Fs/yaffs2/yaffs_endian.h:38:error:parse error Before "Vall"
Fs/yaffs2/yaffs_endian.h:38:warning:statement with no effect
CC FS/PROC/UPTIME.O
MAKE[2]: * * [FS/YAFFS2/YAFFS_GUTS.O] Error 1
MAKE[2]: * * is waiting for unfinished tasks ....
CC FS/PROC/VERSION.O
In file included from Fs/yaffs2/yaffs_checkptrw.c:16:
Fs/yaffs2/yaffs_endian.h:32:error:parse error Before "swap_loff_t"
Fs/yaffs2/yaffs_endian.h:32:error:parse error Before "Lval"
Fs/yaffs2/yaffs_endian.h:33:warning:return type defaults to ' int '
Fs/yaffs2/yaffs_endian.h:33:warning:function declaration isn ' t a prototype
fs/yaffs2/yaffs_endian.h:in function ' swap_loff_t ':
Fs/yaffs2/yaffs_endian.h:34:error: ' Lval ' undeclared (first use of this function)
Fs/yaffs2/yaffs_endian.h:34:error: (Each undeclared identifier was reported only once
Fs/yaffs2/yaffs_endian.h:34:error:for each function it appears in.)
Fs/yaffs2/yaffs_endian.h:37:error: ' y_loff_t ' undeclared (first use of this function)
Fs/yaffs2/yaffs_endian.h:38:error:parse error Before "Vall"
Fs/yaffs2/yaffs_endian.h:38:warning:statement with no effect
MAKE[2]: * * [FS/YAFFS2/YAFFS_CHECKPTRW.O] Error 1
MAKE[1]: * * [FS/YAFFS2] Error 2
MAKE[1]: * * is waiting for unfinished tasks ....
Countermeasures: It appears that the latest YAFFS2 cannot be used, so the contents of the FS/YAFFS2 folder are copied to linux-2.6.32.2/fs/from another kernel linux-2.35.7
Porting linux-2.6.32.2 to qq2440