This article refers to the address: http:// Abstract : This paper introduces the process of building a digital video playback system software platform using embedded Linux on PowerPC405, and discusses the construction process of several main parts such as cross compiler, bootloader, Linux kernel and root file system in embedded Linux system. . Introduction : Digital video playback devices have developed rapidly in recent years and come in a wide variety. The software system of a traditional video playback device (such as a DVD player) is generally a simple control loop system, without an operating system, and the function expansion and upgrade are limited. The portable digital video playback device studied in this paper is built on the embedded 32-bit PowerPC405 CPU, runs the Linux operating system, and uses a large-capacity hard disk as a storage medium with network functions. The PowerPC405 is a RISC processor from IBM that is specifically designed for embedded applications. Embedded Linux [1] is an open source operating system software with free features, support for many CPUs, reduction, support network, and rich software resources. The use of embedded Linux to build a software platform for digital video playback system makes the player low cost, easy to upgrade and manage, supports multiple interfaces such as USB, and thus facilitates the exchange of video programs, and represents a future development of the device. direction. This paper mainly discusses the main process of building bootloader and Linux kernel for embedded Linux system applied to digital video player and the problems that may be encountered, and the corresponding solutions are given. 1 digital video playback system block diagram (Figure 1-1 code stream playback system hardware block diagram) Figure 1-1 shows the system block diagram of the player. The core control system is Embedded PC based on PowerPC405. The program in the data storage system is processed and moved to the code stream control system through the application program. In the FPGA, the FPGA completes the decryption and sends it to the decoding system. After decompressing by the decoding system, the RGB signal is output to the display device for display. Among them, we should pay attention to the construction of the embedded Linux system in the core control system. The hierarchical structure of the embedded Linux system of the player is shown in Figure 1-2. After the hardware is powered on, the program pointer of the CPU first points to a specific memory address. The address generally stores the bootloader. The bootloader initializes the CPU and memory. After that, the Linux kernel is moved from the general ROM device and decompressed into the memory, and then the program pointer jumps to the beginning of the kernel in the memory, and the Linux kernel continues to complete the remaining system boot work. After the kernel reinitializes the system, it loads the root file system and runs the user application. The construction process of the entire embedded Linux system platform can refer to the startup process of the system. The main work to be done is to build the bootloader, the Linux kernel, and the root file system. (Figure 1-2 Software System Hierarchy Diagram) 2 preparation of the embedded Linux system platform To build an embedded Linux system platform, you must first prepare a cross-platform development tool chain. It runs on the local host, and the binary executable generated by the compiled link can run on the development board's CPU and operating system. There are many ways to build such a tool chain mainly including compiler gcc, linker ld, C library glibc, etc. You can download the source code manually from the relevant website, and the most convenient method is to use the perfect compiled development. Packages, such as the German ELDK development kit from Denx, see [2] for usage. 3 bootloader and Kernel choice Once you have prepared the development toolchain, you can start developing embedded Linux systems. The first is the choice of bootloader. 3.1 bootloader selection After the general PC starts, it enters the BIOS first, and after a certain system initialization through the BIOS, it then boots the operating system such as Windows or Linux. However, there is no BIOS in the embedded system, but it also needs a module with similar functions. This is the bootloader. (boot loader), its main function is to initialize hardware devices such as CPU and memory, and import the operating system. There are many types of bootloaders, such as blob, lilo, grub, U-BOOT, etc. At present, the most widely used in the embedded field is Denx's free open source software U-BOOT, which supports PowerPC, ARM, MIPS, x86 and other CPUs, more than 100 development boards, clear source code structure, easy porting, development documentation Rich, the problems that users may encounter during use can generally be solved quickly. Therefore, we use U-BOOT as the bootloader for the development board. According to different development boards, the size and model of the flash are different, the size of the memory is different, and the different startup methods make it necessary to make some corresponding modifications when using U-BOOT to adapt to the user's own development board, specific transplantation methods and common The problem can be found in [3] . 3.2 Linux kernel porting After the bootloader initializes the system hardware, the Linux kernel is imported into the memory from the external storage medium. Then, the control is given to the Linux kernel, and the kernel continues to complete the booting of the system. If the kernel does not support the development board used by the user, then the user needs to manually modify the Linux kernel and do some related porting work. The focus is on the processing of the hardware peripheral part of the development board, including the kernel-to-board hardware. Processing of basic information, initialization of on-board hardware devices, allocation of interrupts, etc. The most convenient way to port the Linux kernel at the development board level is to use the development board that is closest to the hardware platform used by the user as a template, and then make changes based on this. The development board we use is similar to the IBM walnut development board. The main peripherals, including the hard disk and USB device, are all transferred by PCI bus interface (PCI to IDE, PCI to USB), so the core migration work has two parts. One is the transfer of board hardware information between the bootloader and the kernel, and the other is the initialization of the PCI peripheral. 3.2.1 U-BOOT and Linux kernel cooperation After the U-BOOT initializes the hardware device, the kernel is loaded into the memory, and then the program pointer jumps to the location of the kernel, and some parameters are passed to the kernel for use, including the board_info data structure, including the board. CPU frequency, SDRAM and flash size, ip address, MAC address, etc., Linux will use these parameters to initialize the system. However, the development of the Linux kernel and U-BOOT is not the same organization. It is necessary to modify the relevant part of the Linux kernel to match the data transmitted by U-BOOT. For the PowerPC we use, U-BOOT utilizes five general-purpose registers (r3). , r4, r5, r6, r7) to pass the parameters, we need to modify the board_info data structure passed through the r3 register (defined in the Linux kernel arch / ppc / platforms / cs2000.h), and make it with U-BOOT source code The bd_info data structure defined in u-boot-1.1.1/include/asm-ppc/u-boot.h has the same content, so the kernel will not misinterpret the board_info data structure passed by U-BOOT. 3.2.2 Modification of PCI Peripheral Initialization Section The main process of the Linux kernel to initialize the PCI part is to scan the entire PCI bus, find all the devices connected to the bus, and allocate I/O space, memory space, and IRQ to each PCI device according to the information of each PCI device configuration space register. Interrupt number. For the x86 platform, this part of the work has actually been done in the BIOS part, the Linux kernel only needs to call the BIOS generated configuration, but for our embedded Linux system, there is no BIOS, this part of the working Linux kernel to do it yourself. For each different development board, the content that needs to be added to the standard PCI initialization code has two parts, one is the PCI device configuration space register access mode, and the other is the PCI interrupt configuration. According to the PCI protocol specification, the method of accessing a PCI device configuration space is to enable the device's configuration register group by first enabling the device's IDSEL pin. However, the PCI specification does not define the connection method of the IDSEL pin. Therefore, depending on the method of connecting the IDSEL pins of the PCI slave devices of each development board, the method of accessing the PCI device configuration space is different. (Figure 3-1) Two Connections for PCI Device IDSEL Pins Switch (dev_function) { Case PCI_DEV1: set_gpio1_high(); //Set the corresponding GPIO to high Case PCI_DEV2: set_gpio2_high(); Default:break; } Another PCI initialization code that needs to be modified is the interrupt number assignment for PCI devices. For embedded Linux without BIOS, the PCI device interrupt number assignment is determined by the kernel according to the board's hardware connection. Generally, an embedded device does not need to interrupt the path interconnect, and directly connects the /INT pin of the slot to the IRQ line of the CPU. There are many connection methods, such as connecting four interrupt pins of a slot to an IRQ, and the operating system controls the multiplexing relationship of the interrupts. Alternatively, only one IRQ line can be connected to one PCI interrupt pin. Therefore, the allocation of PCI IRQ part of this Linux code should be modified according to the actual interrupt connection method of each development board. In our development board, each PCI /INT pin is connected to a separate IRQ line. Based on this connection, we can construct the following table from the software: /* arch/ppc/platforms/our_board_name.c:ppc405_map_irq ()*/ Static char pci_irq_table[][4] = /* PCI /INT PIN->INTLINE * A B C D */ { {28, 29, 30, 30}, /* IDSEL 1 - PCI slot 1 */ {31, 31, 31, 31}, /* IDSEL 2 - PCI slot 2 */ }; The /INT A interrupt number of PCI slot 1 described in the above table is 28, and the origin of this 28th interrupt is that the /INT A of the slot is connected to the IRQ line of the CPU's 28th interrupt. By filling in the connection relationship between the interrupt line of all PCI slots and the CPU IRQ line, the interrupt number of each PCI device can be correctly assigned by the standard PCI initialization code in the kernel. Of course, in the IRQ initialization part of the board (arch/ppc/platforms/our_board_name.c:board_setup_irq()), the trigger mode, polarity, etc. of these allocated interrupt lines are also correctly set. The porting of the Linux kernel involves a lot of knowledge of the hardware. A clear understanding of the hardware schematic of the development board can have a multiplier effect on the porting work. Conclusion With the bootloader, the kernel, and then using Busybox [4][5] to build a simple root file system, the embedded Linux system platform has been built. The embedded Linux system platform built with the aforementioned process is small. It has strong functions and stable operation. It is very suitable for devices like digital video players that need long-term operation, and it has strong upgradeability. For some future application requirements, it can pass PCI, USB, Ethernet and other interfaces on the development board. The expansion can be said to lay a solid foundation for further enhancement of the device in the future. The innovation of this thesis is to upgrade the simple control system of traditional video playback equipment to embedded Linux system, and discuss the construction and transplantation of embedded Linux system in detail, especially according to the new connection method of PCI equipment. A new initialization algorithm has a strong application value. references 1 Chen Fu et al. Research and Implementation of Video Image Capture Based on Embedded System, Microcomputer Information, No. 12-2, 2005, P12-13, P70 Fiber Optic Equipment,Fiber Optic Cable Drum,Fiber Optic Cable Reels,Fiber Optic Retractable Cable Reel ShenZhen JunJin Technology Co.,Ltd , https://www.jjtcl.com
Keywords : PowerPC405; embedded Linux; digital video player; U-BOOT
As shown in Figure 3-1, for the general connection (a), the IDSEL pin of the PCI slave is connected to one of the address lines AD[11-31] ​​of the PCI bus through a resistor. During the address period of accessing the PCI bus, the address lines of AD[11-31] ​​are set to a high level one by one. If the read configuration register data is valid, it indicates that the address line is connected to the IDSEL of a certain device. If invalid, the description is invalid. not connected. The development board uses the (b) connection method in Figure 3-1 to connect the PCI slave device's IDSEL pin to a GPIO port of the CPU, so that it can flexibly control a device on the PCI bus by controlling the GPIO. Enable or disable. Under our hardware connection, when accessing the PCI slave device configuration space, it is necessary to set the GPIO connected to the device IDSEL pin to be high, and then read and write the configuration register bank. Therefore, for our development board, you need to insert the following code in the source code of the general read configuration register space (arch/ppc/kernel/indirect_pci.c) before reading and writing the configuration register:
2 http://
3 http://
4 http://
5 Karim Yaghmour, Building Embedded Linux System., O'Reilly, 2004