I'm trying to add Makefiles to enabe MD/Raid and mdadm. (As I find the idea of running my tiny fileserver of the same build system as my routers rather appealing)
mdadm I got right (I think):
include $(TOPDIR)/rules.mk
include $(INCLUDE_DIR)/kernel.mk
PKG_NAME:=mdadm
PKG_VERSION:=2.6.3
PKG_RELEASE:=1
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tgz
PKG_SOURCE_URL:=http://www.cse.unsw.edu.au/~neilb/source/mdadm
PKG_MD5SUM:=0797caab07dce50cb71d6dd99d8da487
include $(INCLUDE_DIR)/package.mk
define Package/$(PKG_NAME)
SECTION:=utils
CATEGORY:=Utilities
TITLE:=MD admin tools
URL:=http://neil.brown.name/blog/mdadm
endef
define Package/$(PKG_NAME)/description
Manages Mulitple Devices (sofware raid)
endef
define Package/$(PKG_NAME)/install
$(INSTALL_DIR) $(1)/usr/sbin
$(INSTALL_BIN) $(PKG_BUILD_DIR)/mdadm $(1)/usr/sbin/
endef
$(eval $(call BuildPackage,$(PKG_NAME)))
But I think I might need a bit of input on how to get the MD and Raid stuff to work as you guys would expect?
so far I have
define KernelPackage/md
SUBMENU:=$(BLOCK_MENU)
TITLE:=Multiple devices driver support (RAID and LVM)
KCONFIG:=CONFIG_MD
FILES:=\
$(LINUX_DIR)/drivers/md/md.$(LINUX_KMOD_SUFFIX) \
$(LINUX_DIR)/drivers/md/bitmap.$(LINUX_KMOD_SUFFIX) \
AUTOLOAD:=$(call AutoLoad,30,md)
endef
define KernelPackage/md/description
Support multiple ...
endef
$(eval $(call KernelPackage,md))
define KernelPackage/md-raid
SUBMENU:=$(BLOCK_MENU)
TITLE:=RAID support
KCONFIG:=CONFIG_BLK_DEV_MD
DEPENDS:=kmod-md
endef
define KernelPackage/md-raid/description
This driver lets ...
endef
$(eval $(call KernelPackage,md-raid))
define KernelPackage/md-linear
SUBMENU:=$(BLOCK_MENU)
DEPENDS:=kmod-md-raid
TITLE:=Linear (append) mode
KCONFIG:=CONFIG_MD_LINEAR
FILES:=$(LINUX_DIR)/drivers/md/linear.$(LINUX_KMOD_SUFFIX)
AUTOLOAD:=$(call AutoLoad,30,linear)
endef
define KernelPackage/md-linear/description
If you say Y here ...
endef
$(eval $(call KernelPackage,md-linear))
define KernelPackage/md-raid0
SUBMENU:=$(BLOCK_MENU)
DEPENDS:=kmod-md-raid
TITLE:=RAID-0 (striping) mode
KCONFIG:=CONFIG_MD_RAID0
FILES:=$(LINUX_DIR)/drivers/md/raid0.$(LINUX_KMOD_SUFFIX)
AUTOLOAD:=$(call AutoLoad,30,raid0)
endef
define KernelPackage/md-raid0/description
If you say Y here ..
endef
$(eval $(call KernelPackage,md-raid0))
define KernelPackage/md-raid1
SUBMENU:=$(BLOCK_MENU)
DEPENDS:=kmod-md-raid
TITLE:=RAID-1 (mirroring) mode
KCONFIG:=CONFIG_MD_RAID1
FILES:=$(LINUX_DIR)/drivers/md/raid1.$(LINUX_KMOD_SUFFIX)
AUTOLOAD:=$(call AutoLoad,30,raid1)
endef
define KernelPackage/md-raid1/description
A RAID-1 set ...
endef
$(eval $(call KernelPackage,md-raid1))
define KernelPackage/md-raid456
SUBMENU:=$(BLOCK_MENU)
DEPENDS:=kmod-md-raid
TITLE:=RAID-4/RAID-5/RAID-6 mode
KCONFIG:=CONFIG_MD_RAID456
FILES:=$(LINUX_DIR)/drivers/md/raid456.$(LINUX_KMOD_SUFFIX)
AUTOLOAD:=$(call AutoLoad,30,raid456)
endef
define KernelPackage/md-raid456/description
A RAID-5 set of ...
endef
$(eval $(call KernelPackage,md-raid456))
define KernelPackage/md-raid5rs
SUBMENU:=$(BLOCK_MENU)
DEPENDS:=kmod-md-raid456
TITLE:=Support adding drives to a raid-5 array
KCONFIG:=CONFIG_MD_RAID5_RESHAPE
endef
define KernelPackage/md-raid5rs/description
A RAID-5 set c...
endef
$(eval $(call KernelPackage,md-raid5rs))
Prefixing the packages with 'md-' was to get to group up with the main MD entry. Is there another way to achieve grouping without calling it md-raid5?
The option to enable reshaping on raid5 - is there another way of adding this? As it doesnt generate any files, having it as a module seems kind of wrong?
And what kind of dependencies should I set for MD? In the kernel config it depends on the block layer - but it isnt an option in OpenWRT. And using ide-core or scsi-core makes both a necessity witch isnt true?
Lastly, regarding autoloading - when would it be apropriate to load the modules? I went for the same as NBD, but is this the best option?
Thanks for your input guys!