User Tools

Site Tools


FIXME This page is not fully translated, yet. Please help completing the translation.
(remove this paragraph once the translation is finished)





grep -lri mt300a target/













  • …board.d/ 定义设备专用的默认硬件的脚本,如LED和网络接口。
  • …hotplug.d/ 定义设备专用的,在插入热插拔设备时自动运行的脚本
  • …init.d/ 定义设备专用的在启动时自动运行的脚本
  • …uci-defaults/ 定义设备专用的UCI默认设置
  • … 定义设备显示的错误代码




  • …<arch_name>.sh阅读友好的设备名转化为脚本安全的设备名的脚本
  • …preinit/ 通用<arch_name>预初始化脚本
  • …upgrade/ 通用<arch_name>升级脚本


该文件夹对应固件中的/sbin文件夹, 一般为通用的<arch_name> sbin脚本和工具.


设备树源文件(Device tree source files, 简写为dts).







使新设备出现在make menuconfig中

在编辑了上述的文件后, 你需要对Makefile使用touch命令

touch target/linux/*/Makefile


子目录 patches-xxx 是对一个 目标版本xxx 的内核补丁.

0xx - upstream backports
1xx - code awaiting upstream merge
2xx - kernel build / config / header patches
3xx - architecture specific patches
4xx - mtd related patches (subsystem and drivers)
5xx - filesystem related patches
6xx - generic network patches
7xx - network / phy driver patches
8xx - other drivers
9xx - uncategorized other patches

All patches must be written in a way that they are potentially upstreamable, meaning:

- they must contain a proper subject
- they must contain a proper commit message explaining what they change
- they must contain a valid Signed-off-by line

Testing images

Test firmware images without writing them to flash by using ramdisk images.

In make menuconfig select Target Images and then you can select the ramdisk option.

This will create an image with kernel + initramfs, that will have initramfs in the name. The resulting image can be loaded in the device through the bootloader's tftp function and should boot to a prompt without relying on flash/filesystem support.


Getting a shell on the target device

In order to collect relevant data for a port of LEDE to the device of interest one wants shell access. Most devices though do not offer a way to get a shell with telnet or ssh.

With netgear-telnetenable many Netgear devices can be opened up for telnet access. Also see GitHub: insanid/NetgearTelnetEnable. When such means cannot be used, one could try to flash an image build from the sources published by the vendor with telnetd enabled.

With nmrpflash many Netgear devices can be flashed. Devices that are compatible with this tool become effectively unbrickable.

Collecting relevant data

On WikiDevi lots of information can be found, e.g. the FCC ID is very useful when searching for documentation, datasheets and internal photo's (to be able to distinguish used chips without having to open the casing).

Typically one can use the following commands:

dmesg                          # log buffer might be to small, see note 1.
cat /proc/cmdline
cat /proc/cpuinfo
cat /proc/meminfo
cat /proc/devices
ls /sys/devices/platform
cat /proc/mtd
cat /sys/class/mtd/mtd*/offset # Linux 4.1 and newer, see note 2.
ifconfig -a
ls /sys/class/net
brctl show

Note 1: Often the log buffer is to small and the earliest messages may be missing from the information retrieved with dmesg. If one build a stock image from the sources the vendor has published, a larger buffer size can be set within the kernel config.

Note 2:

Another useful tool for getting information for setting LEDs might be gpiodump, a MT7620 GPIOMODE register dumper (RAMIPS).

Getting collected data from a device

Sometimes no normal means such as scp or ftp are available for retrieving files from a device. Still one could use httpd and busybox its mount command to do so. How? Assume the files with relevant data on the device with IP address are stored under /tmp and pages of the web interface are served from /www. On the device do:

cp important-data.txt /tmp
mount -o bind /tmp /www

After that the data on the host connected to the device do:

This website uses cookies. By using the website, you agree with storing cookies on your computer. Also you acknowledge that you have read and understand our Privacy Policy. If you do not agree leave the website.More information about cookies
zh/docs/guide-developer/adding_new_device.txt · Last modified: 2019/07/10 06:25 by chenjd