Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
Next revisionBoth sides next revision
ru:docs:guide-developer:adding_new_device [2019/12/27 15:46] – [Search by grep locally] mkobyakovru:docs:guide-developer:adding_new_device [2019/12/30 10:20] – [Testing images] mkobyakov
Line 3: Line 3:
 ====== Добавление нового устройства ====== ====== Добавление нового устройства ======
  
-Хорошим всесторонним советом было бы начать с просмотра недавних коммитов о добавлении нового устройства,чтобы увидеть, какие файлы были изменены и как. Многие файлы стараются быть как можно более понятными, в большинстве случаев достаточно просто открыть их, чтобы понять их функцию.+Хорошим всесторонним советом было бы начать с просмотра недавних комментариев о добавлении нового устройства,чтобы увидеть, какие файлы были изменены и как. Многие файлы стараются быть как можно более понятными, в большинстве случаев достаточно просто открыть их, чтобы понять их функцию.
  
 ===== Учитесь на примере ===== ===== Учитесь на примере =====
Line 24: Line 24:
 </code> </code>
  
-==== Search by Git commit ====+==== Поиск по git commit ====
  
-[[https://git.openwrt.org/?p=openwrt%2Fopenwrt.git&a=search&h=HEAD&st=commit&s=add+support+for|Browse the source filtered by "add support for"]] and checkout the ''diff'' for newly added device+[[https://git.openwrt.org/?p=openwrt%2Fopenwrt.git&a=search&h=HEAD&st=commit&s=add+support+for|Просмотрите источник, отфильтрованный по ссылке добавить поддержку для"]] и проверьте "diff" для недавно добавленного устройства 
 +===== Важный файлы =====
  
-===== Important files ===== +Это общая карта расположения наиболее важных файлов:
- +
-This is a general map of where most important files are located:+
  
 ==== /target/linux/<arch_name>/base-files/etc/… ==== ==== /target/linux/<arch_name>/base-files/etc/… ====
  
-This folder contains files and folders that will be integrated in the firmware’s /etc folder.+Эта папка содержит файлы и папки, которые будут интегрированы в папку firmware /etc.
  
-These are its subfolders and files:+Это его вложенные папки и файлы:
  
-  * **…board.d/** scripts for defining device-specific default hardwarelike leds and network interfaces+  * **…board.d/** скрипты для определения аппаратного обеспечения по умолчанию для конкретного устройстванапример светодиодов и сетевых интерфейсов
-  * **…hotplug.d/** scripts for defining device-specific actions to be done automatically on hotplugging of devices +  * **…hotplug.d/** скрипты для определения специфичных для устройства действий, которые должны выполняться автоматически при горячем подключении устройств 
-  * **…init.d/** scripts for defining device-specific actions to be done automatically on boot +  * **…init.d/** скрипты для определения специфичных для устройства действий, которые будут выполняться автоматически при загрузке 
-  * **…uci-defaults/** files for defining device-specific uci configuration defaults +  * **…uci-defaults/** файлы для определения параметров конфигурации uci для конкретного устройства по умолчанию 
-  * **…diag.sh** defines what is the led to use for error codes for each board +  * **…diag.sh** определяет, какой светодиод использовать для кодов ошибок для каждой платы 
- +   
-//Note that some of these functions are now done in the DTS for the board.//+//Обратите внимание, что некоторые из этих функций теперь выполняются в DTS для устройства.//
 ==== /target/linux/<arch_name>/base-files/lib/… ==== ==== /target/linux/<arch_name>/base-files/lib/… ====
  
-This folder contains files and folders that will be integrated in the firmware’s /lib folder. +Эта папка содержит файлы и папки, которые будут интегрированы в папку firmware /lib.
- +
-These are its subfolders and files:+
  
-  * **…<arch_name>.sh** human-readable full board name associated to script-safe board name +Это его вложенные папки и файлы:
-  * **…preinit/** common <arch_name> preinit startup scripts +
-  * **…upgrade/** common <arch_name> upgrade scripts+
  
 +  * **…<arch_name>.sh** читаемое человеком полное имя платы, связанное с именем безопасной для скрипта платы
 +  * **…preinit/** общие < имя_архива> предустановленные сценарии запуска
 +  * **…upgrade/** общие скрипты обновления <имя_архива> 
 ==== /target/linux/<arch_name>/base-files/sbin ==== ==== /target/linux/<arch_name>/base-files/sbin ====
  
-This folder contains files and folders that will be integrated in the firmware’s /sbin folderusually common <arch_name> sbin scripts and tools.+Эта папка содержит файлы и папки, которые будут интегрированы в папку firmware /sbin, обычно общие < arch_name> сценарии и инструменты sbin.
  
 ==== /target/linux/<arch_name>/dts/ ==== ==== /target/linux/<arch_name>/dts/ ====
  
-Device tree source filesor dts for short.+Исходные файлы дерева устройствили сокращенно dts.
  
-//Certain architectures have the DTS directory deeper down. ARM devicesfor exampletypically have it located at ''files-X.yy/arch/arm/boot/dts/''//+//Некоторые архитектуры имеют каталог DTS глубже внизУстройства ARM, напримеробычно имеют его расположение на''files-X.yy/arch/arm/boot/dts/''//
  
-//If the DTS or DTSI file is already present in upstream Linux, they will usually not be present in the OpenWrt sourceConfiguring for the target and running ''make target/linux/{clean,prepare}'' will download and patch Linux, allowing the resulting file to be found in the ''build_dir''//+//Если файл DTS или DTSI уже присутствует в вышестоящем Linux, они обычно не будут присутствовать в исходном коде OpenWrt. Настройка для целевого объекта и запуск''make target/linux/{clean,prepare}'' будет скачиваться и исправляться Linux, что позволит найти полученный файл в ''build_dir''//
 ==== /target/linux/<arch_name>/image/ ==== ==== /target/linux/<arch_name>/image/ ====
  
-Configuration needed to build device-specific flashable images.+Конфигурация, необходимая для создания специфичных для устройства флэш-образов.
  
 ==== /target/linux/<arch_name>/<board_name>/ ==== ==== /target/linux/<arch_name>/<board_name>/ ====
  
-Board-specific configuration.+Конфигурация для конкретной платы.
  
 ==== /target/linux/<arch_name>/modules.mk ==== ==== /target/linux/<arch_name>/modules.mk ====
  
-Arch-specific kernel module config file for menuconfig+Arch- специфичный файл конфигурации ядра для менюконфиг 
 += = = = Создание нового устройства в make menuconfig ====
  
-==== Making new device appear in make menuconfig ==== +После редактирования файловуказанных выше, вы должны ввести команду
- +
-After edit the files aboveyou need to touch the makefiles+
  
   touch target/linux/*/Makefile   touch target/linux/*/Makefile
  
-===== Patches ===== +===== Патчи ===== 
-The patches-* subdirectories contain the kernel patches applied for every target.\\  +Подкаталоги patches-* содержат патчи ядра, применяемые для каждого целевого объекта.\\  
-All patches should be named 'NNN-lowercase_shortname.patch' and sorted into the following categories:+Все патчи должны быть названы 'NNN-lowercase_short name.patch" и отсортированы по следующим категориям:
  
-**0xx** - upstream backports\\ +**0xx** - бэкпортов вверх \\ 
-**1xx** - code awaiting upstream merge\\ +**1xx** - код, ожидающий слияния в восходящем потоке\\ 
-**2xx** - kernel build config header patches\\ +**2xx* * - патчи для сборки ядра конфигурации заголовков\\ 
-**3xx** - architecture specific patches\\ +**3xx* * - патчи, специфичные для архитектуры\\ 
-**4xx** - mtd related patches (subsystem and drivers)\\ +**4xx* * - патчи, связанные с mtd (подсистема и драйверы)\\ 
-**5xx** - filesystem related patches\\ +****5xx* * - патчи, связанные с файловой системой\\ 
-**6xx** - generic network patches\\ +**6xx* * - общие сетевые патчи\\ 
-**7xx** - network / phy driver patches\\ +**7xx* * - патчи сетевых / phy драйверов\\ 
-**8xx** - other drivers\\ +**8xx** - другие драйверы\\ 
-**9xx** - uncategorized other patches\\+**9xx* * - другие патчи без категорий\\
  
 <WRAP center round tip 80%> <WRAP center round tip 80%>
-All patches must be written in a way that they are potentially upstreamablemeaning:+Все патчи должны быть написаны таким образомчтобы они были потенциально доступны для распространения, т. е.:
  
   - they must contain a **proper subject**   - they must contain a **proper subject**
Line 107: Line 104:
 </WRAP> </WRAP>
  
-===== Testing images ===== += = = = = Тестирование изображений ==== =  
-Test firmware images without writing them to flash by using ramdisk images.+Тестовые изображения прошивки без записи их в Flash при использовании RAMDisk изображений.
  
-In **make menuconfig** select **Target Images** and then you can select the **ramdisk** option. +В * * make menuconfig * * выберите * * целевые изображения**, а затем вы можете выбрать опцию * * ramdisk**.
- +
-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.+
  
 +Это создаст образ с ядром + initramfs, который будет иметь **initramfs** в имени. Полученный образ может быть загружен в устройство через функцию bootloader tftp и должен загрузиться в приглашение, не полагаясь на поддержку flash/файловой системы.
 ===== Tips and tricks ===== ===== Tips and tricks =====
 ==== Getting a shell on the target device ==== ==== Getting a shell on the target device ====
Line 146: Line 142:
 With [[https://github.com/jclehner/nmrpflash|nmrpflash]] many Netgear devices can be flashed. Devices that are compatible with this tool become effectively unbrickable. With [[https://github.com/jclehner/nmrpflash|nmrpflash]] many Netgear devices can be flashed. Devices that are compatible with this tool become effectively unbrickable.
  
-==== Collecting relevant data ==== += = = = Сбор соответствующих данных ==== 
-On [[https://wikidevi.com/wiki/Main_Page|WikiDevi]] lots of information can be founde.g. the FCC ID is very useful when searching for documentationdatasheets and internal photo'(to be able to distinguish used chips without having to open the casing).+На [[https://wikidevi.com/wiki/Main_Page/WikiDevi]] можно найти много информациинапример, идентификатор FCC очень полезен при поиске документацииописаний и внутренних фотографий (чтобы иметь возможность различать используемые чипы без необходимости открывать корпус).
  
-Typically one can use the following commands:+Обычно можно использовать следующие команды:
  
 <code bash> <code bash>
Line 166: Line 162:
 </code> </code>
  
-**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 publisheda larger buffer size can be set within the kernel config. +** Примечание 1: * * часто буфер журнала слишком мал, и самые ранние сообщения могут отсутствовать в информации, полученной с помощью "dmesg"Если вы создаете исходное изображение из источниковопубликованных поставщиком, то в конфигурации ядра можно установить больший размер буфера.
- +
-**Note 2:** [[http://lxr.free-electrons.com/source/Documentation/ABI/testing/sysfs-class-mtd]]+
  
-Another useful tool for getting information for setting LEDs might be [[https://github.com/jclehner/gpiodump-mt7620|gpiodump]], a MT7620 GPIOMODE register dumper (RAMIPS).+** Примечание 2:* * [[http://lxr.free-electrons.com/source/Documentation/ABI/testing/sysfs-class-mtd]]
  
 +Еще одним полезным инструментом для получения информации для настройки светодиодов может быть [[https://github.com/jclehner/gpiodump-mt7620/gpiodump]], Дампер регистра MT7620 GPIOMODE (RAMIPS).
 ==== Getting collected data from a device ==== ==== Getting collected data from a device ====
 Because of the limited space, common file transfer utilities such as rsync/curl/ssh/scp/ftp/http/tftp may not be available, a stripped down version/applet may be available from busybox. Because of the limited space, common file transfer utilities such as rsync/curl/ssh/scp/ftp/http/tftp may not be available, a stripped down version/applet may be available from busybox.
  • Last modified: 2020/01/01 13:36
  • by mkobyakov