Linux-2.6.30.4 porting to 2440 Development Board

Source: Internet
Author: User

Experience on porting linux-2.6.30.4 to 2440 Development Board

1. Download The linux-2.6.30.4 source code and decompress it

Ftp://ftp.kernel.org/pub/linux/kernel/v2.6/linux-2.6.30.4.tar.gz

Tar zxvf linux-2.6.30.4.tar.gz

2. Add arm support to the system

$ Vim makefile

193 # arch? = $ (Subarch)

194 # cross_compile? =

195 arch = arm

196 cross_compile = arm-Linux-

3. modify the system clock

$ Vim ARCH/ARM/mach-s3c2440/mach-smdk2440.c

The external clock of the system is 12 MHz.

160 static void _ init smdk2440_map_io (void)

161 {

162s3c24xx_init_io (smdk2440_iodesc, array_size (smdk2440_iodesc ));

163 // s3c24xx_init_clocks (16934400 );

164 // edit

165 s3c24xx_init_clocks (12000000 );

166s3c24xx_init_uarts (smdk2440_uartcfgs, array_size (smdk2440_uartcfgs ));

167}

Note: If the system clock does not match, garbled characters may occur.

4. Create or obtain the Kernel configuration ticket. config

$ Make menuconfig

Note: A good practice is to first call the built-in configuration list. The configuration list is in the arch/ARM/configs directory, with the file name: s3c2410_defconfig. The configuration file contains almost the configuration items of the s3c24xx series CPU, you can modify the configuration items on this basis. The configuration item for x86 is in the arch/x86/configs directory, and the file name is i386_defconfig (32 is the CPU ).

Cp arch/ARM/configs/s3c2410_defconfig. config

5. Modify the machine code

[View machine code related files in Linux kernel source code :]

$ Vim ARCH/ARM/mach-s3c2440/mach-smdk2440.c

178 machine_start (S3C2440, "smdk2440 ")

179/* maintainer: Ben dooks <ben@fluff.org> */

180. phys_io = s3c2410_pa_uart,

181. io_pg_offst = (u32) s3c24xx_va_uart)> 18) & 0 xfffc,

182. boot_params = s3c2410_sdram_pa + 0x100,

183

184. init_irq = s3c24xx_init_irq,

185. map_io = smdk2440_map_io,

186. init_machine = smdk2440_machine_init,

187. Timer = & s3c24xx_timer,

188machine_end

 

Modify the machine code to make it the same as the machine code of bootloader. Here u-boot is used, and the machine code is 168.

$ Vim ARCH/ARM/tools/Mach-types

379 S3C2440 arch_s3c2440 s3c2440168

$ Vim ARCH/ARM/tools/makefile

7 include/ASM-arm/mach-types.h: $ (SRC)/Gen-Mach-types $ (SRC)/Mach-types

8 @ echo 'generating $ @'

9 @ mkdir-p $ (DIR $ @)

10 $ (q) $ (awk)-F $ ^ >$ @ | {Rm-F $ @;/bin/false ;}

$ Vim include/ASM/mach-types.h

375 # define mach_type_s3c2440168 // you have not found this

 

[Configuration file in U-boot]

$ Vim includes/ASM-arm/mach-types.h

377 # define mach_type_s3c2440 168

Summary: first, identify the machine type (such as S3C2440) from the Linux kernel source code, and then, according to the machine type machine code (such as 377 # define mach_type_s3c2440 168) given in U-boot) modify the kernel machine code. The process is as follows:

Kernel:

$ Vimarch/ARM/mach-s3c2440/mach-smdk2440.c

U-boot:

$ Viminclude/ASM-arm/mach-types.h

Kernel:

$ Vimarch/ARM/tools/Mach-types

Note: If the machine code is incorrect, the system prompts you to select a platform and the system crashes.

6. Compile the image

$ Make zimage

 

7. blackboard writing

Run the dnw tool to download the kernel image to the Development Board.

8. Problems Encountered

Problem:

Kernel panic-not syncing: attempted to kill Init!

Solution:

$ Make menuconfig

Select the following two items:

Kernel features --->

[*] Use the arm Eabi to compile the kernel

[*] Allow old Abi binaries to run with this kernel (experimental)

IX. nandflash driver porting

Linux contains the nandflash driver. You only need to modify the source code.

1, $ Vim ARCH/ARM/plat-s3c24xx/common-smdk.c

107/* NAND parititon from 2.4.18-swl5 */

108

109 static struct mtd_partitionsmdk_default_nand_part [] = {

110 # If defined (config_64mb_nand)

111 [0] = {

112. Name = "board_uboot ",

113. size = 0x00040000,

114. offset = 0x00000000,

115 },

116 [1] = {

117. Name = "board_kernel ",

118. size = 0x00200000,

119. offset = 0x00200000,

120 },

121 [2] = {

122. Name = "board_yaffs2 ",

123. size = 0x03bf8000,

124. offset = 0x00400000,

125}

126 # Elif defined (config_128mb_nand)

127 [0] = {

128. Name = "board_uboot ",

129. offset = 0x00000000,

130. size = 0x00040000,

131 },

132 [1] = {

133. Name = "board_kernel ",

134. offset = 0x00200000,

135. size = 0x00200000,

136 },

137 [2] = {

138. Name = "board_yaffs2"

139. offset = 0x00400000,

140. size = 0x07ba0000,

141}

142 # Elif defined (config_more_than_256mb_nand)

143 [0] = {

144. Name = "board_uboot ",

145. offset = 0x00000000,

146. size = 0x00040000,

147 },

148 [1] = {

149. Name = "board_kernel ",

150. offset = 0x00200000,

151. size = 0x00200000,

152 },

153 [2] = {

154. Name = "board_yaffs2 ",

155. offset = 0x00400000,

156. size = 0x0fb80000,

157}

158 # endif

159 };

2. $ vimdrivers/MTD/NAND/kconfig

166 choice

167 prompt "NAND Flash capacity select"

168 depends on MTD

169 help

170 board NAND Flash capacity select

171

172 config 64mb_nand

173 Boolean "64 mb nand for board"

174 depends on MTD

175 help

176 set 64 mb nand parts

177

178 config 128mb_nand

179 Boolean "128 mb nand for board"

180 depends on MTD

181 help

182 set 128 mb nand parts

183

184 config more_than_256mb_nand

185 Boolean "MB ~ 1 gb nand for board"

186 depends on MTD

187 help

188 set MB ~ 1 gb nand parts

189

190 endchoice

NOTE: If 64mb_nand is selected in make menuconfig, the format of. config is as follows:

Config _ 64mb_nand = y

This actually provides pre-compiled variables for C source files, such as # If defined (config_64mb_nand ).......

This process is to implement kernel customization, such as adding a NAND driver or removing a wireless driver...

10. Port the yaffs2 file system. 1. Obtain the source code of yaffs2.

Http://www.aleph1.co.uk/cgi-bin/viewcvs.cgi/

Www. aleph1.co. uk/home/aleph1/git/yaffs2

2. Add support for yaffs2 to the kernel

In the source code of the downloaded yaffs2, run:

./Patch-ker.sh C./linux-2.6.30.4 (two folders put together)

In this case, the "yaffs2" directory is added under the FS directory of the kernel, and The makefile and kconfig files under the FS/directory are also added with the configuration and compilation conditions of yaffs2.

3. Add support for yaffs2 in the configuration Sheet

$ Make menuconfig

File systems --->

[*] Miscellaneous filesystems --->

<*> Yaffs2 File System Support

NOTE: If no support for yaffs2 is added to the kernel, the following error occurs:

Listof all partitions:

01004096 ram0 (driver ?)

01014096 ram1 (driver ?)

01024096 ram2 (driver ?)

01034096 ram3 (driver ?)

01044096 ram4 (driver ?)

01054096 ram5 (driver ?)

01064096 ram6 (driver ?)

01074096 ram7 (driver ?)

01084096 ram8 (driver ?)

01094096 ram9 (driver ?)

010a 4096 ram10 (driver ?)

010b4096 ram11 (driver ?)

010c 4096 ram12 (driver ?)

010d4096 ram13 (driver ?)

010e4096 ram14 (driver ?)

010f 4096 ram15 (driver ?)

1f00 256 mtdblock0 (driver ?)

1f01 2048 mtdblock1 (driver ?)

1f02 63168 mtdblock2 (driver ?)

Nofilesystem cocould Mount root, tried: ext3 ext2 cramfs msdos vfat romfs

Kernel panic-not syncing: VFS: unable tomount root FS on unknown-block (31,2)

4. Run the yaffs2 port and re-compile the kernel.

11. Add tmpfs support to the kernel

If tmpfs support is not added, the/tmp Mount failure prompt will appear. The role of tmpfs is to be studied.

Mount: mounting tmpfs on/tmp failed: invalidargume

File System Configuration:

[Root @/] # Cat/etc/fstab

Proc/proc defaults 0 0

Tmpfs/tmp tmpfs defaults 0 0

Sysfs/sys sysfs defaults 0 0

Tmpfs/dev tmpfs defaults 0 0

Var/dev tmpfs defaults 0 0

File systems --->

Pseudo filesystems --->

[*] Virtual memory file system support (former shm fs)

[*] Tmpfs POSIX access control lists

12 Problems and Solutions

Drivers/RTC/hctosys. C: Unable to open RTC device (rtc0)

1. Kernel configuration options

--- Real timeclock
[*] Set system time from RTC on startup andresume
(Rtc0) RTC used to set the systemtime
[] RTC debugsupport
* ** RTC interfaces ***
[*]/Sys/class/RTC/rtcn (sysfs)
[*]/Dev/rtcn (characterdevices)
[] RTC uie emulation on devinterface
* ** On-cpu rtc drivers ***
<*> Samsung s3series SOC rtc

2. Linux kernel has supported the RTC of S3C2410, but not added to the platform device initialization array, so the system does not initialize this part at startup, You need to modify the file mach-smdk.c

Static struct platform_device * smdk2410_devices [] _ initdata = {
& Amp; initi_device_ohci,
& Amp; cloud_device_ LCD,
& Amp; cloud_device_wdt,
& Amp; cloud_device_i2c0,
& Amp; cloud_device_iis,
& Amp; initi_device_rtc, // Add code
};

3. Create a device node and run the following command in the file system/dev directory:

Sudo mknod rtc c 10 10 135

4. recompile the kernel and view the startup information.

S3c2410-rtcs3c2410-rtc: RTC disabled, re-enabling.

S3c2410-rtcs3c2410-rtc: RTC core: Registered s3c asrtc0

It indicates that the RTC driver can work properly.

Uncorrectable error: <3> end_request: I/O error, Dev mtdblock2, Sector 2

EXT3-fs: Unable to readsuperblock

Uncorrectable error: <3> end_request: I/O error, Dev mtdblock2, Sector 2

EXT2-fs: Unable to readsuperblock

Uncorrectable error: <3> end_request: I/O error, Dev mtdblock2, sector 0

Buffer I/O error ondevice mtdblock2, Logical Block 0

Uncorrectable error: <3> end_request: I/O error, Dev mtdblock2, sector 0

Buffer I/O error ondevice mtdblock2, Logical Block 0

Uncorrectable error: <3> end_request: I/O error, Dev mtdblock2, Sector 8

Buffer I/O error ondevice mtdblock2, Logical Block 1

Uncorrectable error: <3> end_request: I/O error, Dev mtdblock2, Sector 8

Buffer I/O error ondevice mtdblock2, Logical Block 1

Uncorrectable error: <3> end_request: I/O error, Dev mtdblock2, Sector 16

Buffer I/O error ondevice mtdblock2, Logical Block 2

Uncorrectable error: <3> end_request: I/O error, Dev mtdblock2, Sector 16

Buffer I/O error ondevice mtdblock2, Logical Block 2

Uncorrectable error: <3> end_request: I/O error, Dev mtdblock2, sector 24

Buffer I/O error ondevice mtdblock2, logical block 3

Uncorrectable error: <3> end_request: I/O error, Dev mtdblock2, sector 24

Buffer I/O error ondevice mtdblock2, logical block 3

Uncorrectable error: <3> end_request: I/O error, Dev mtdblock2, sector 0

Fat: unable to read bootsector

VFS: cannot open rootdevice "mtdblock2" or unknown-block (31,2)

Please append a correct "root =" Boot option; here are the available partitions:

1f00 256 mtdblock0 (driver ?)

1f01 2048 mtdblock1 (driver ?)

1f02 257536 mtdblock2 (driver ?)

Kernel panic-notsyncing: VFS: Unable to mount root FS on unknown-block (31,2)

MTD partition does not match bootloader

# Elif defined (config_more_than_256mb_nand)

[0] = {

. Name = "board_uboot ",

. Offset = 0x00000000,

. Size = 0x00080000,

},

[1] = {

. Name = "board_kernel ",

. Offset = 0x00240000,

. Size = 0x00200000,

},

[2] = {

. Name = "board_yaffs2 ",

. Offset = 0x00440000,

. Size = 0x0fb40000,

}

**************************************** **************************************** **************************************** **************************************

 

[0] and [1] partitions are inconsistent. The intermediate part of the surface causes stores the uboot parameters and boot screen ???Environment Variable

Uboot partition information:

0x0 to 0x40000 is the uboot partition, 256 K,
0x40000 to 0x4c000 are parameters partitions, 48 K,
0x50000 to 0x70000 are eboot partitions, 128 K,
0x70000 to 0x1f0000 is the logo partition, 1536 K,
0x1f0000 to 0x3f0000 are kernel partitions, 2 m,
0x3f0000 to 0x3ff8000 are root partitions, 60.03125 m

Nand partition information:

Static struct mtd_partition smdk_default_nand_part [] = {
[0] = {
. Name = "tq2440_uboot ",
. Size = 0x00040000,
. Offset = 0x00000000,
},
[1] = {
. Name = "tq2440_kernel ",
. Offset = 0x0004c000,
. Size = 0x00200000,
},
[2] = {
. Name = "tq2440_yaffs2 ",
. Offset = 0x0024c000,
. Size = 0x03db0000,
}
};

The partition of uboot is not associated with the partition of the file system. The only link is that the command should be guided according to the partition information of the file system during uboot boot. For example, to start mtdblock2, the command bootm0xxxxxxxx in bootcmd must be the same as the first address of mtdblock2 ....

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.