-$(LINUX_DIR)/.patched: $(LINUX_DIR)/.unpacked
- [ -d ../generic-$(KERNEL)/patches ] && $(PATCH) $(LINUX_DIR) ../generic-$(KERNEL)/patches
- [ -d ./patches ] && $(PATCH) $(LINUX_DIR) ./patches
- @$(CP) config $(LINUX_DIR)/.config
- touch $@
+ifneq ($(CONFIG_TARGET_ROOTFS_INITRAMFS),y)
+ define Kernel/SetInitramfs
+ echo "r6040 parent=wlan0" > $(BUILD_DIR)/root/etc/modules.d/99-r6040
+ rm -f $(BUILD_DIR)/root/sbin/init
+ ln -s /etc/preinit $(BUILD_DIR)/root/sbin/init
+ sed -i 's,exec /sbin/init,exec /bin/busybox init,g' $(BUILD_DIR)/root/etc/preinit
+ sed -i 's,/sbin/init,/bin/busybox init,g' $(BUILD_DIR)/root/init
+ sed -i 's,eth0,eth1,g' $(BUILD_DIR)/root/etc/config/network
+ endef
+endif
+
+# include the profiles
+-include profiles/*.mk
+
+$(eval $(call BuildKernel))