Hello, everyone, I am Sao hung Chi, thank you for participating in the OpenWrt development class. To introduce myself first, I have been engaged in the work of router development from 08 years to now (firmware customization, technical consulting, development training), and as the owner of Anywlan and entshan wireless. The first answer is to answerMany people wonder why OpenWrt development training? The reason is simple: with the rise of smart home and Internet of things, OpenWrt’s heat is increasing, but there are no high quality, systematic OpenWrt development tutorials on the market, so I started to do OpeNWrt’s idea of developing video. A lot of people would feel that I was just like my motto, “technology needs to be precipitated, growth needs pain, success needs to be persisted, and I need dedication”. I know that dedication is the duty of being a great God, and it is not as likely to throw away the dedication of the God and the ordinary people.
OpenWrtThe main purpose of the development of the class is to make up for the lack of the knowledge system, save the time for everyone to find out, and then participate in the development of the OpenWrt faster. In the course of teaching, you are welcome to interact with me. Since it is an introductory course, we will try our best to help you with plain language.Understand OpenWrt.
Tutorial Part: (need to prepare router main picture, Flash, RAM picture)
The content of this talk is: the composition of software and hardware of router. In fact, there is no difference between the hardware architecture of the router and the PC architecture. The concepts of CPU, RAM and ROM are interlinked. The router’s CPU is SOC, which is highly integrated. It usually integrates switch chips, WIFI chips, and some even integrate.Flash and RAM.
The RAM of routers usually uses DDR2 or DDR3, which is later than 1-2 generations because of cost considerations. For example, when the computer is using DDR4, the router has just used DDR3 particles. Early players change to memory routers, usually SDRAM. In those days, there was supernatural welding.The changing skills. The router’s ROM usually has SPI Flash, NAND FLash, NOR Flash, ROM’s capacity is generally 8-32M. SPI Flash and NAND FLash are read by sector, NOR FLasH can be addressable by address, so there are many pins in NOR Flash, because there are address lines. In the early days, because the RAM chip was too expensive, the router generally used NOR Flash, because the NOR FLash architecture is similar to the memory, and the code can be directly in NOR FLa.Execution on SH can save a lot of costs. Because SPI Flash is limited by SPI bus mode (Dan Shuanggong) and working speed, it has low read and write speed, small capacity and slow response. The future trend is NAND Flash, which has large capacity, fast speed and fast response.
The software of routers is generally composed of bootloader and firmware, similar to PC’s BIOS and operating system. First, explain why bootloader is needed because there is no code in memory after CPU is powered on. You need to rely on bootloader to make FlashThe code is transferred to memory, which is also the concept of loader, Porter. In order to satisfy everyone’s thirst for knowledge, I will explain the principle of CPU startup from the point of internal realization of chip. After CPU is powered on, it will first execute CPU internal curing microcode, copy the XX byte from FLash to XX.Address the memory, and execute the code of the XX address. This process is invisible to software and is implemented inside CPU. The firmware is well understood. In brief, it is the operating system, which determines the function of the router and the soul of the router. For example, Tomato, OpenWrtDD-WRT, this kind of firmware. In the later tutorial, we will focus on the composition and implementation of firmware.