Linux MIGRATION PROCESS

Source: Internet
Author: User

Some time ago, I migrated linux2.6 to an arm11 Development Board at the company. The following is a rough description of the general process of Linux porting.

 

The migration of uboot at the beginning is not enough. There are two methods for uboot to enter Linux. One is to use uimage. You can APPEND command line parameters during boot, but the operation is troublesome. Another simple method is to use TFTP to load the Linux kernel to 0x80008000 (default start address), and then use the go command to directly jump. The second method is used. The disadvantage is that you need to modify the command line parameters. config file, and then force re-compile setup. C (you can delete setup. o force re-compile ). In addition, the values of R0 and R1 registers must be set when Linux is guided by arm, respectively for your CPU (as if yes, but you do not remember it) and the board type, otherwise, errors may occur in the Assembly section at the beginning of Linux.

 

In addition, there are two methods to boot Linux: zimage and image. In my opinion, image migration is easier at the beginning. Although TFTP is a little more time-consuming during download, it reduces the middle decompression steps and reduces the chance of errors, accelerate development.

 

After redirecting to Linux, JTAG debugging is required because it is a piece of assembly code at the beginning. For example, you can set a hardware breakpoint at 0x80008000. The main task of assembly code is to add the ing of the serial port I/O address in the memory ing table, so that the serial port output debugging information can be operated. Then, use the C language to write a printk function in the start_kernel file, called temp_print. For specific code, refer to the implementation of printk. This phase is quite painful because it is very troublesome to debug the Assembly using JTAG. Once temp_print is successfully output and Linux enters the C code starting with start_kernel, You can discard the JTAG and use the serial port for output debugging.

 

The next step is the output of the embedded printk, because the debugging information of the Linux kernel itself is output through printk. Here we mainly want to set the Linux Command Line startup parameters, including console and earlyconsole, set them to the serial port number you need to output, and check the serial port driver code, such as 8250. C and 8250_early.c files.

 

After the printk is successfully output, the system clock is interrupted. This requires you to be familiar with the processing code for clock interruptions in Linux. You also need to take a look at the relevant information on the Internet. It should not be difficult to understand.

 

Then you can debug the Flash Driver and network card. You only need to support one of the two to run the root file system. Generally, Nic is simpler and more flexible. After the NIC is started, set the NFS root file system in the command line parameters, and place the file system on a Linux server for NFS export. In this way, a simple Linux system is successfully transplanted.

 

After Linux runs, add flash, LCD and other drivers as needed. A complete system can be built step by step.

 

The following describes the problems I encountered during debugging:

When debugging the onenand driver, note whether the onenand and Linux are connected through a 16-bit data line or a 32-bit data line. If it is a 16-bit data line connection, the memcpy function in the driver code will fail, because memcpy copies data in the 32 mode by default. You can rewrite a memory copy function, which uses the unsigned short method to copy data.

 

When debugging the NIC Driver, pay attention to the actual use of the NIC interrupt polarity. Although Linux has a driver for most NICs, the polarity of the interrupt may be reversed. In addition, the disconnection in the NIC is usually connected to the CPU gpio (for example, I used smc91c111). Here we need to adjust the disconnected gpio occupation number in the code based on the actual connection of the Board. Ensure that the gpio line usage conflicts are prevented.

 

In linux2.6, an Eabi compilation is added, which is often used on Android. If the kernel is compiled using the Eabi method, you must ensure that your root file system is also compiled using the Eabi method. Otherwise, the kernel will encounter errors when you enter/bin/sh, and there will be no prompts.

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.