Home  >  Article  >  Operation and Maintenance  >  5 pieces of advice that novices must listen to after joining the Linux driver position

5 pieces of advice that novices must listen to after joining the Linux driver position

嵌入式Linux充电站
嵌入式Linux充电站forward
2023-07-31 15:50:191175browse

1. Don’t just use printk

In addition to printk, there are many in the kernel For printing functions such as pr_info and pr_err, you must learn to control the printing level and use different printing functions for different scenarios.

2. Novices should not change defconfig directly

The kernel has a default configuration filexxx_defconfig, If you want to modify some kernel configurations, as a novice, do not modify xxx_defconfig directly.

The safe way is to execute make menucofigusual menu to configure, and finally overwrite the .config filexxx_defconfig, and then upload thisxxx_defconfig.

3. Do not map each physical address directly

The operation register under Linux must be mapped first, but usually only the base is mapped Address is operated by base address plus offset.

Don’t directly map the physical address of each register, because for a certain driver, although there are many registers, the base addresses are all the same.

4. Don’t learn uboot

Even if you are a Linux driver, uboot You must know how to start kernel, what parameters are passed, what addresses are involved, and how to write the driver of uboot.

5. If you don’t understand memory, it’s not enough to talk about drivers

Be sure to read more about memory knowledge. All operations under Linux are virtual addresses, and what is written into the register is the physical address. How to know the physical address corresponding to the virtual address? What is the difference between allocating DMA consistent memory and allocating normal memory?

The address written in the register manual is the physical address, so I remembered it .

dma memory problems, cache consistency problems, etc., you can't escape these .

The above is the detailed content of 5 pieces of advice that novices must listen to after joining the Linux driver position. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:嵌入式Linux充电站. If there is any infringement, please contact admin@php.cn delete