Session 1
Computer System
Transplantation Research and Implementation of Embedded Linux System Based on S3C2440
Fu-bing WANG1,â , Jun-ling GAO, Pan-pan LI, Sai WANG and Mei-Hua WANG
College of Electrical and Information Engineering, AnHui University of Science and
Technology, HuaiNan, AnHui, China E-mail:â [email protected] An embedded system under the development of the microprocessor is widely applied in the world. The basis of further research and development and application is the question of how to build a small, real-time, good performance of embedded operating system. This research paper describes the methods and process of latest u-boot-2015.07, latest stable version of the linux-4.2.1 kernel, yaffs2 file system and the root file system transplant to the target board based on S3C2440 processor. The results prove that post-transplant Linux runs well on the target board. Embedded system migration not only familiarizes us with in-depth Bootloader, Linux kernel, file system and other software, but also get to know the various hardware resources of the target board.
Keywords: Embedded Linux; Bootloader; Linux kernel; Yaffs2 file system; S3C2440 processor.
1.Introduction
Today, embedded systems have become an important part of the computer field, its various products have entered all aspects of live. Embedded systems are generally defined as: application-centric, computer technology, hardware and software can be tailored to meet the special computer system that strictly requires reliability, cost, size, power consumption. S3C2440 with ARM920T core, using 0.13um CMOS standard cell and memory cell macros. Low power consumption, simple, elegant, and fully static design is particularly suitable for cost and power sensitive applications.
Bootloader functions directly related to the CPU and the microprocessor type, so different CPU architectures require different Bootloader. In addition, Bootloader also depends on the specific configuration of the target board related equipment, we need to make the appropriate changes bootloader to use. Linux is a free to use and free dissemination of class Unix operating system, is a POSIX and UNIX based multi-user, multi-tasking, multi-threading and multi-CPU supported operating systems, as an embedded operating system is the best choice.
Yaffs2 is the NAND Flash File System developed by engineer Charles Manning Yaffs1 and yaffs2 main difference is that the size of the write PAGE, yaffs2 supports 2K per page, much higher than the yaffs of 512 Bytes, so more advantage for large capacity NAND flash. Since the target board uses the k9f2g08u0c, using yaffs2 as the file system.
This paper aims to transplant the new bootloader, Linux kernel and file system to keep pace with embedded industrial developments. As industrial developments shift towards the operation of embedded user layer application program, the application and function of embedded systems can be realized.
2.Materials Preparation and Compilation Environment Buildings
The latest u-boot-2015.07can be downloaded at http://www.denx.de/wiki/U-Boot, the latest stable version of the linux-4.2.1 kernel can be downloaded at https://www.kernel.org/,yaffs2 file system can be downloaded at www.yaffs.netMajor, Ubuntu12.04 operating system is used as host. After install the arm-linux-gcc-4.3.2 cross compiler, the environment basically be build.
3.Bootloader Function and Transplantation
The first program when the PC power on runs is called BIOS, its role is to initialize the hardware, establishment of memory space map, ready for the final call to the operating system kernel. Similarly, before calling the Linux kernel, it needs to make the appropriate preparations, then transplant u-boot is to carry out the preparatory work.
3.1.U-boot first stage modification
The config.mk file in the source of U-boot used âLDFLAGS_u-boot + = -pieâ this compiler option, resulting in a larger file code compiler out and more complex, so remove this compile option and locate the u-boot code directly in SDRAM address of 0x33f80000 and change the value of CONFIG_SYS_TEXT_BASE to 0x33f80000 in smdk2410.h file. Remove all the code in the middle of âmov r0,#0 â and âldr pc,=board_init_râ in crt0.S file.
To make the system start faster, start ICACHE and reset the clock parameters in Start. S file. As the U-boot is not supported from NAND Flash booting, add code in init. c file for NAND Flash booting support ,function void copy_to_sdram (unsigned char * scr, unsigned char * dest, unsigned int len) call function IsBootFromNorFlash (),determining whether Nor Flash starts, if not, call function nand_read_ll((unsigned int src),dest,len),then jump out to call function void clear_bss() to make sure the global variables can be used. In lowlevel_init.S file, depending on the target board SDRAM model DATASHEET to set 13 registers initialization parameters, then the SDRAM can be used. Start. S file has been re-set PLL before, so delete function correlated with PLL lock time in smdk2440.c files, the purpose is to start the system faster, delete as : writel (0xFFFFFF,&clk_power>locktime);
writel(M_MDIV<<12)+(M_PDIV<<4)+M_SDIV, &clk_power->mpllcon);
After the Start. S file in U-boot copy the entire U-boot code to SDRAM, then set the sp register, making the second stage of the C code can run, the entire U-boot memory usage shown in Figure 1:
Fig.1. U-boot memory usage
Now, the operating environment of the C function has been completely ready. By the following commandâldr pc,_start_armbootâto jump directly, it calls âstart_arm_bootâfunction in lib_arm / board.c.
3.2.U-boot second stage modification
Fig.2. The second stage of U-boot flow chart
Before starting the kernel, U-boot allows the user to decide whether to enter download mode, that is, into U-boot control interface. The second stage of u-boot flow chart shows in Figure 2. First, initialize related hardware devices. The main thing is to set the system clock, initializing serial ports. board_init function sets MPLL, changing the system clock, it is the target dependent function. board_init function also stores machine Type ID : gt ->bd ->bi_arch_number=MACH_TYPE_SMDK2440; Serial port initialization function is mainly serial_init, it sets UART control register, which is CPU related function. Implemented in the âcup/arm920t/ s3c24x0/ serial. c.â Second, detect system memory map. For the target board the memory distribution is clear, set the code is as follows: int dram_init (void){gd- >bd->bi_dram[0].start=0x30000000;gd->bd->bi_dram[0]. 0x30000000;gd->bd->bi_dram[0].size=0x4000000;return 0;}. Third, set boot parameter for kernel. U-boot through list of tags pass parameters to kernel,I add the following two configuration items in the configuration file âinclude/configs/smdk2440.hâ.asâ#defineCONFIG_ETUP_MEMORY_TAGS 1 #define CONFIG_CMDLINE_TAG 1â.For the architecture of ARM CPU, by âdo_boot_linuxâ function in the lib_arm/armlinux.c to start the kernel. Finally, the kernel is called by following function âtheKernel(0,bd->bi_arch_number,bd->bi_bootparams); â.
4.Linux Kernel Transplantation
Linux boot process can be divided into two parts: architecture/board related boot process, the subsequent common boot process.ARM processor boot Linux kernel process is shown in Figure 3.
Fig.3. ARM pr...