ALT Linux kernel packages development
 help / color / mirror / Atom feed
From: Alexander Bokovoy <a.bokovoy@sam-solutions.net>
To: devel-kernel@altlinux.ru
Subject: Re: [d-kernel] kernel policy (final?)
Date: Tue, 13 May 2003 18:30:04 +0300
Message-ID: <20030513153004.GA11776@sam-solutions.net> (raw)
In-Reply-To: <20030513150450.GA12432@basalt.office.altlinux.org>

On Tue, May 13, 2003 at 07:04:50PM +0400, Dmitry V. Levin wrote:
> При наличии /usr/include/linux-default/include следует использовать его,
> если все остальные методы не прошли.
Согласен.

Теперь еще одно предложение для Policy. Касается оно дополнительных
модулей, не входящих в основное ядро. Идея исходит от RedHat и мне она
видится здравой. Я ее немного развил и вот что получилось:

1. Все дополнительные модули, не входящие в основное ядро, размещаются в
linux/drivers/addon/<имя модуля>/

2. Каждый такой модуль содержит дополнительный файл
   linux/drivers/addon/<имя модуля>/Config.in.in с необходимой
   строчкой для linux/drivers/addon/Config.in, например:
   
*** linux/drivers/addon/iscsi-cisco/Config.in.in:
-->8---------------------------------------->8------------------------------------->8------
dep_tristate '   iSCSI support (scsi-over-network), from CISCO' CONFIG_SCSI_ISCSI_CISCO $CONFIG_SCSI m
--8<----------------------------------------8<-------------------------------------8<------  

   Также, каждый модуль имеет свой собственный Makefile. Например, для
   приведенного выше iscsi-cisco он может быть таким:
   
*** linux/drivers/addon/iscsi-cisco/Makefile:
-->8---------------------------------------->8------------------------------------->8------
#
# Makefile for the Cisco iSCSI client
#
# Note! Dependencies are done automagically by 'make dep', which also
# removes any old dependencies. DON'T put your own dependencies here
# unless it's something special (ie not a .c file).
#
# Note 2! The CFLAGS definitions are now in the main makefile...

O_TARGET := iscsi_mod.o

EXTRA_CFLAGS := -I../../scsi -DLINUX

ifeq ($(wildcard $(TOPDIR)/kernel/ksyms.c),$(TOPDIR)/kernel/ksyms.c)
  # check for the presence of certain kernel symbols, and compile accordingly

  SET_USER_NICE:=$(shell grep '^[ \t]*EXPORT_SYMBOL(set_user_nice)' $(TOPDIR)/kernel/ksyms.c 2>/dev/null )
  ifneq ($(SET_USER_NICE),)
     EXTRA_FLAGS += -DHAS_SET_USER_NICE=1
  endif

  REPARENT_TO_INIT:=$(shell grep '^[ \t]*EXPORT_SYMBOL(reparent_to_init)' $(TOPDIR)/kernel/ksyms.c 2>/dev/null )
  ifneq ($(REPARENT_TO_INIT),)
    EXTRA_FLAGS += -DHAS_REPARENT_TO_INIT=1
  endif
endif


obj-y	:= iscsi.o iscsi-probe.o iscsi-login.o iscsiAuthClient.o iscsiAuthClientGlue.o md5.o iscsi-crc.o
obj-m   := $(O_TARGET)

include $(TOPDIR)/Rules.make
--8<----------------------------------------8<-------------------------------------8<------

   Понятное дело, что Makefile у каждого будет такой Makefile различаться,
   важно, что каждый модуль будет собираться по стандартной ядерной схеме.

3. Небольшой скрипт будет проходить по подкаталогам первого уровня в
   linux/drivers/addon/ и генерировать
   linux/drivers/addon/{Config.in,Makefile} следующего содержания:

*** linux/drivers/addon/Config.in:
-->8---------------------------------------->8------------------------------------->8------

#
# device driver configuration for add-on drivers
#
mainmenu_option next_comment
comment 'Additional device driver support'

<СЮДА ВСТАВЛЯЮТСЯ Config.in.in из поддиректорий>

endmenu
--8<----------------------------------------8<-------------------------------------8<------

*** linux/drivers/addon/Makefile:
-->8---------------------------------------->8------------------------------------->8------

# File: drivers/addon/Makefile
#
# Makefile for the device drivers that are not in the main tree but added 
# to the Red Hat linux kernel
#

obj-y           :=
obj-m           :=
obj-n           :=
obj-            :=

mod-subdirs     := <СПИСОК КАТАЛОГОВ>

O_TARGET := addon.o

# All of the (potential) objects that export symbols.
# This list comes from 'grep -l EXPORT_SYMBOL *.[hc]'.

export-objs     :=
list-multi	:=


<СЮДА ВСТАВЛЯЕТСЯ СТРОКИ С ПЕРЕЧИСЛЕНИЕМ КАТАЛОГОВ ВИДА:>
subdir-$(CONFIG_SCSI_ISCSI_CISCO) += iscsi-cisco


include $(TOPDIR)/Rules.make

clean:
	rm -f core *.o *.a *.s *~
--8<----------------------------------------8<-------------------------------------8<------

4.  linux/drivers/addon/Config.in включается в linux/arch/<АРХИТЕКТУРА>/config.in

5.  linux/drivers/addon добавляется в список поддерживаемых в процессе
    сборки целей в linux/drivers/Makefile (subdir-y += addon).

Преимущества схемы:

	- централизованное управление всеми добавками через "Additional
	  device drivers support" в системе конфигурации ядра
	
	- легкость интеграции -- для большинства незатрагивающих другие
	  подсистемы ядра модулей не надо ничего патчить, только приложить
	  два тривиальных Config.in.in и Makefile

	- автоматизация процесса интеграции модулей -- не нужно патчить
	  соответствующие Config.in и Makefile в подсистемах ядра


-- 
/ Alexander Bokovoy
---
I like your game but we have to change the rules.


  reply	other threads:[~2003-05-13 15:30 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-05-12 18:28 Peter Novodvorsky
2003-05-13 10:09 ` aen
2003-05-13 13:28 ` Ed V. Bartosh
2003-05-13 14:41   ` Dmitry V. Levin
2003-05-13 13:50     ` Ed V. Bartosh
2003-05-13 15:04       ` Dmitry V. Levin
2003-05-13 15:30         ` Alexander Bokovoy [this message]
2003-05-13 15:37           ` Alexander Bokovoy
2003-05-13 16:30           ` aen
2003-05-13 16:10             ` Alexander Bokovoy
2003-05-13 16:41               ` Ed V. Bartosh
2003-05-13 17:53                 ` Alexander Bokovoy
2003-05-13 15:58         ` Michael Shigorin
2003-05-13 16:08           ` Dmitry V. Levin
2003-05-13 16:47             ` Michael Shigorin
2003-05-13 16:12           ` Alexander Bokovoy
2003-05-13 16:47             ` Michael Shigorin
2003-05-21 11:34         ` [d-kernel] adjusting kernel headers Dmitry V. Levin
2003-05-21 12:39           ` Alexander Bokovoy
2003-05-21 13:01             ` Dmitry V. Levin
2003-05-21 14:33               ` Ed V. Bartosh
2003-05-21 15:47                 ` Peter Novodvorsky
2003-05-21 15:02                   ` Ed V. Bartosh
2003-05-21 16:07                     ` Peter Novodvorsky
2003-05-21 15:19                       ` Ed V. Bartosh
2003-05-21 14:30           ` Ed V. Bartosh
2003-05-21 15:48             ` Peter Novodvorsky
2003-05-21 15:17               ` Ed V. Bartosh
2003-05-21 16:29                 ` Peter Novodvorsky
2003-05-21 15:36                   ` Ed V. Bartosh
2003-05-21 20:24                     ` Michael Shigorin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20030513153004.GA11776@sam-solutions.net \
    --to=a.bokovoy@sam-solutions.net \
    --cc=devel-kernel@altlinux.ru \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

ALT Linux kernel packages development

This inbox may be cloned and mirrored by anyone:

	git clone --mirror http://lore.altlinux.org/devel-kernel/0 devel-kernel/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 devel-kernel devel-kernel/ http://lore.altlinux.org/devel-kernel \
		devel-kernel@altlinux.org devel-kernel@altlinux.ru devel-kernel@altlinux.com
	public-inbox-index devel-kernel

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://lore.altlinux.org/org.altlinux.lists.devel-kernel


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git