Re: How to re-launch menuconf
Posted: Tue Aug 13, 2013 7:58 am
Hi,
Yes I have it in .config, I tryied to run kernel_menuconfig and it is specified as * for run. That section is added by gargoyle / netfilter-match-modules / integrate_netfilter_modules.sh to .config and kernel .config is build from that. The problem is not in any .config, but in makefile or some *.mk file that not generates tkis 4 *.ko files for kmod modules in build_dir in custom-src. Main problem there is a patch 650 probably bekaus it not exists in ../target/ramips/linux/.../patches
650-custom_netfilter_match_modules.patch does not exists in my builds at all. Iam reviewing step by step scripts
5this script is preparing Makefiles creates .c and .h files for building *.ko and it adds to iptables module creation of that kmod-ipt-[4] files
For some reason it is not being created.
Please send me .config from target/custo/default and from kernel build dir.
Regards,
Robert
Yes I have it in .config, I tryied to run kernel_menuconfig and it is specified as * for run. That section is added by gargoyle / netfilter-match-modules / integrate_netfilter_modules.sh to .config and kernel .config is build from that. The problem is not in any .config, but in makefile or some *.mk file that not generates tkis 4 *.ko files for kmod modules in build_dir in custom-src. Main problem there is a patch 650 probably bekaus it not exists in ../target/ramips/linux/.../patches
650-custom_netfilter_match_modules.patch does not exists in my builds at all. Iam reviewing step by step scripts
Code: Select all
####################################################################################################
##### CREATE MAKEFILE THAT WILL DOWNLOAD LINUX SOURCE FOR TARGET SPECIFIED IN .config FILE #########
####################################################################################################
if [ "$patch_kernel" = 1 ] ; then
target_name=$(cat .config | egrep "CONFIG_TARGET_([^_]+)=y" | sed 's/^.*_//g' | sed 's/=y$//g' )
if [ -z "$target_name" ] ; then
test_names=$(cat .config | egrep "CONFIG_TARGET_.*=y" | sed 's/CONFIG_TARGET_//g' | sed 's/_.*$//g' )
for name in $test_names ; do
for kernel in 2.2 2.4 2.6 2.8 3.0 3.2 3.4 ; do #let's plan ahead!!!
if [ -d "target/linux/$name-$kernel" ] ; then
target_name="$name-$kernel"
fi
done
done
fi
board_var=$(cat target/linux/$target_name/Makefile | grep "BOARD.*:=")
kernel_var=$(cat target/linux/$target_name/Makefile | grep "KERNEL.*:=")
linux_ver_var=$(cat target/linux/$target_name/Makefile | grep "LINUX_VERSION.*:=")
defines=$(printf "$board_var\n$kernel_var\n$linux_ver_var\n")
cat << 'EOF' >nf-patch-build/linux-download-make
CP:=cp -fpR
TOPDIR:=..
INCLUDE_DIR:=$(TOPDIR)/include
SCRIPT_DIR:=$(TOPDIR)/scripts
DL_DIR:=$(TOPDIR)/dl
EOF
printf "$defines\n" >> nf-patch-build/linux-download-make
cat << 'EOF' >>nf-patch-build/linux-download-make
include $(INCLUDE_DIR)/kernel-version.mk
KERNEL_NAME:=$(shell echo "$(KERNEL)" | sed 's/ /\./g' | sed 's/\.$$//g' )
KERNEL_PATCHVER_NAME:=$(shell echo "$(KERNEL_PATCHVER)" | sed 's/ /\./g' | sed 's/\.$$//g' )
GENERIC_PLATFORM_DIR := $(TOPDIR)/target/linux/generic
PLATFORM_DIR:=$(TOPDIR)/target/linux/$(BOARD)
GENERIC_PATCH_DIR := $(GENERIC_PLATFORM_DIR)/patches-$(KERNEL_NAME)
GENERIC_FILES_DIR := $(GENERIC_PLATFORM_DIR)/files
GENERIC_LINUX_CONFIG:=$(firstword $(wildcard $(GENERIC_PLATFORM_DIR)/config-$(KERNEL_PATCHVER_NAME) $(GENERIC_PLATFORM_DIR)/config-default))
PATCH_DIR := $(PLATFORM_DIR)/patches$(shell [ -d "$(PLATFORM_DIR)/patches-$(KERNEL_PATCHVER_NAME)" ] && printf -- "-$(KERNEL_PATCHVER_NAME)" || true )
FILES_DIR := $(PLATFORM_DIR)/files$(shell [ -d "$(PLATFORM_DIR)/files-$(KERNEL_PATCHVER_NAME)" ] && printf -- "-$(KERNEL_PATCHVER_NAME)" || true )
LINUX_CONFIG:=$(firstword $(wildcard $(foreach subdir,$(PLATFORM_DIR) $(PLATFORM_SUBDIR),$(subdir)/config-$(KERNEL_PATCHVER_NAME) $(subdir)/config-default)) $(PLATFORM_DIR)/config-$(KERNEL_PATCHVER_NAME))
LINUX_DIR:=linux
PKG_BUILD_DIR:=$(LINUX_DIR)
TARGET_BUILD:=1
LINUX_SOURCE:=linux-$(LINUX_VERSION).tar.bz2
TESTING:=$(if $(findstring -rc,$(LINUX_VERSION)),/testing,)
ifeq ($(call qstrip,$(CONFIG_EXTERNAL_KERNEL_TREE))$(call qstrip,$(CONFIG_KERNEL_GIT_CLONE_URI)),)
ifeq ($(word 1,$(subst ., ,$(KERNEL_BASE))),3)
LINUX_SITE:=@KERNEL/linux/kernel/v3.x$(TESTING)
else
LINUX_SITE:=@KERNEL/linux/kernel/v$(KERNEL)$(TESTING)
endif
endif
define filter_series
sed -e s,\\#.*,, $(1) | grep -E \[a-zA-Z0-9\]
endef
all:
if [ ! -e "$(DL_DIR)/$(LINUX_SOURCE)" ] ; then $(SCRIPT_DIR)/download.pl $(DL_DIR) $(LINUX_SOURCE) $(LINUX_KERNEL_MD5SUM) $(LINUX_SITE) ; fi ;
cp $(DL_DIR)/$(LINUX_SOURCE) .
rm -rf linux linux-$(LINUX_VERSION)
tar xjf $(LINUX_SOURCE)
if [ ! -e "$(DL_DIR)/$(LINUX_SOURCE)" ] ; then mv $(LINUX_SOURCE) "$(DL_DIR)/" ; else rm $(LINUX_SOURCE) ; fi
mv linux-$(LINUX_VERSION) linux
rm -rf $(PKG_BUILD_DIR)/patches; mkdir -p $(PKG_BUILD_DIR)/patches
if [ -d $(GENERIC_FILES_DIR) ]; then $(CP) $(GENERIC_FILES_DIR)/* $(LINUX_DIR)/; fi
if [ -d $(FILES_DIR) ]; then \
$(CP) $(FILES_DIR)/* $(LINUX_DIR)/; \
find $(LINUX_DIR)/ -name \*.rej | xargs rm -f; \
fi
if [ -d "$(GENERIC_PATCH_DIR)" ] ; then $(SCRIPT_DIR)/patch-kernel.sh linux $(GENERIC_PATCH_DIR) ; fi
if [ -d "$(PATCH_DIR)" ] ; then $(SCRIPT_DIR)/patch-kernel.sh linux $(PATCH_DIR) ; fi
mkdir -p "$(GENERIC_PATCH_DIR)"
mkdir -p "$(PATCH_DIR)"
echo $(GENERIC_PATCH_DIR) > generic-patch-dir
echo $(GENERIC_LINUX_CONFIG) > generic-config-file
echo $(PATCH_DIR) > patch-dir
echo $(LINUX_CONFIG) > config-file
EOF
####################################################################################################
##### NOW CREATE MAKEFILE THAT WILL DOWNLOAD IPTABLES SOURCE #######################################
####################################################################################################
echo 'TOPDIR:=..' >> nf-patch-build/iptables-download-make
echo 'SCRIPT_DIR:=$(TOPDIR)/scripts' >> nf-patch-build/iptables-download-make
echo 'DL_DIR:=$(TOPDIR)/dl' >> nf-patch-build/iptables-download-make
egrep "CONFIG_LINUX_.*=y" .config | sed 's/=/:=/g' >> nf-patch-build/iptables-download-make
package_include_line_num=$(cat package/iptables/Makefile | egrep -n "include.*package.mk" | sed 's/:.*$//g' )
head -n $package_include_line_num package/iptables/Makefile | awk ' { if( ( $0 !~ /^include/ ) && ($0 !~ /^#/ )){ print $0 ; }} ' >> nf-patch-build/iptables-download-make
echo 'all:' >> nf-patch-build/iptables-download-make
echo ' if [ ! -e "$(DL_DIR)/$(PKG_SOURCE)" ] ; then $(SCRIPT_DIR)/download.pl $(DL_DIR) $(PKG_SOURCE) $(PKG_MD5SUM) $(PKG_SOURCE_URL) ; fi ; ' >> nf-patch-build/iptables-download-make
echo ' cp $(DL_DIR)/$(PKG_SOURCE) . ' >>nf-patch-build/iptables-download-make
echo ' tar xjf $(PKG_SOURCE)' >>nf-patch-build/iptables-download-make
echo ' rm *.bz2' >>nf-patch-build/iptables-download-make
echo ' mv iptables* iptables' >>nf-patch-build/iptables-download-make
echo ' $(SCRIPT_DIR)/patch-kernel.sh iptables $(TOPDIR)/package/iptables/patches/' >>nf-patch-build/iptables-download-make
echo ' echo $(TOPDIR)/package/iptables/patches/ > iptables-patch-dir' >>nf-patch-build/iptables-download-make
fi
cd nf-patch-build
####################################################################################################
##### Build Patches ###############################################################################
####################################################################################################
if [ "$patch_kernel" = 1 ] ; then
mv linux-download-make Makefile
make
mv linux linux.orig
cp -r linux.orig linux.new
mv iptables-download-make Makefile
make
mv iptables iptables.orig
cp -r iptables.orig iptables.new
generic_config_file=$(cat generic-config-file)
generic_patch_dir=$(cat generic-patch-dir)
config_file=$(cat config-file)
patch_dir=$(cat patch-dir)
iptables_patch_dir=$(cat iptables-patch-dir)
mkdir -p "$generic_patch_dir"
mkdir -p "$iptables_patch_dir"
mkdir -p "$patch_dir"
fi
for new_d in $new_module_dirs ; do
new_d="$module_dir/$new_d"
new_name=$(cat $new_d/name 2>/dev/null)
upper_name=$(echo "$new_name" | tr "[:lower:]" "[:upper:]")
lower_name=$(echo "$new_name" | tr "[:upper:]" "[:lower:]")
echo "found $upper_name module, patching..."
if [ "$patch_kernel" = 1 ] ; then
#copy files for netfilter module
cp -r $new_d/module/* linux.new/net/ipv4/netfilter/
cp -r $new_d/header/* linux.new/include/linux/netfilter_ipv4/
#update netfilter Makefile
match_comment_line_num=$(cat linux.new/net/ipv4/netfilter/Makefile | egrep -n "#.*[Mm][Aa][Tt][Cc][Hh]" | sed 's/:.*$//g' )
config_line='obj-$(CONFIG_IP_NF_MATCH_'$upper_name') += ipt_'$lower_name'.o'
insert_lines_at "$match_comment_line_num" "$config_line" "linux.new/net/ipv4/netfilter/Makefile" "1"
cp "linux.new/net/ipv4/netfilter/Makefile" ./test1
#update netfilter Config.in/Kconfig file
if [ -e linux.new/net/ipv4/netfilter/Kconfig ] ; then
end_line_num=$(cat linux.new/net/ipv4/netfilter/Kconfig | egrep -n "endmenu" | sed 's/:.*$//g' )
insert_line_num=$(($end_line_num-1))
config_lines=$(printf "%s\n" "config IP_NF_MATCH_$upper_name" " tristate \"$lower_name match support\"" " depends on IP_NF_IPTABLES" " help" " This option enables $lower_name match support." "" "")
insert_lines_at "$insert_line_num" "$config_lines" "linux.new/net/ipv4/netfilter/Kconfig" "1"
fi
if [ -e linux.new/net/ipv4/netfilter/Config.in ] ; then
match_comment_line_num=$(cat linux.new/net/ipv4/netfilter/Config.in | egrep -n "#.*[Mm][Aa][Tt][Cc][Hh]" | sed 's/:.*$//g' )
match_comment_line=" dep_tristate ' $lower_name match support' CONFIG_IP_NF_MATCH_$upper_name \$CONFIG_IP_NF_IPTABLES"
insert_lines_at "$match_comment_line_num" "$match_comment_line" "linux.new/net/ipv4/netfilter/Config.in" "1"
cp "linux.new/net/ipv4/netfilter/Config.in" ./test2
fi
#copy files for iptables extension
cp -r $new_d/extension/* iptables.new/extensions
cp -r $new_d/header/* iptables.new/include/linux/netfilter_ipv4/
#create test file, which is used by iptables Makefile
echo "#!/bin/sh" > "iptables.new/extensions/.$lower_name-test"
echo "[ -f \$KERNEL_DIR/include/linux/netfilter_ipv4/ipt_$lower_name.h ] && echo $lower_name" >> "iptables.new/extensions/.$lower_name-test"
chmod 777 "iptables.new/extensions/.$lower_name-test"
#update config templates -- just for simplicity do so for both 2.4-generic and 2.6-generic
for config in $generic_config_file $config_file ; do
echo "CONFIG_IP_NF_MATCH_$upper_name=m" >> $config
done
fi
if [ "$patch_openwrt" = "1" ] ; then
#add OpenWrt package definition for netfilter module
echo "" >>../package/kernel/modules/netfilter.mk
echo "" >>../package/kernel/modules/netfilter.mk
echo "define KernelPackage/ipt-$lower_name" >>../package/kernel/modules/netfilter.mk
echo " SUBMENU:=\$(NF_MENU)" >>../package/kernel/modules/netfilter.mk
echo " TITLE:=$lower_name" >>../package/kernel/modules/netfilter.mk
echo " KCONFIG:=\$(KCONFIG_IPT_$upper_name)" >>../package/kernel/modules/netfilter.mk
echo " FILES:=\$(LINUX_DIR)/net/ipv4/netfilter/*$lower_name*.\$(LINUX_KMOD_SUFFIX)" >>../package/kernel/modules/netfilter.mk
echo " AUTOLOAD:=\$(call AutoLoad,45,\$(notdir \$(IPT_$upper_name-m)))" >>../package/kernel/modules/netfilter.mk
echo " DEPENDS:= kmod-ipt-core" >>../package/kernel/modules/netfilter.mk
echo "endef" >>../package/kernel/modules/netfilter.mk
echo "\$(eval \$(call KernelPackage,ipt-$lower_name))" >>../package/kernel/modules/netfilter.mk
#add OpenWrt package definition for iptables extension
echo "" >>../package/iptables/Makefile
echo "" >>../package/iptables/Makefile
echo "define Package/iptables-mod-$lower_name" >>../package/iptables/Makefile
echo "\$(call Package/iptables/Module, +kmod-ipt-$lower_name)" >>../package/iptables/Makefile
echo " TITLE:=$lower_name" >>../package/iptables/Makefile
echo "endef" >>../package/iptables/Makefile
echo "\$(eval \$(call BuildPlugin,iptables-mod-$lower_name,\$(IPT_$upper_name-m)))" >>../package/iptables/Makefile
#update include/netfilter.mk with new module
echo "">>../include/netfilter.mk
echo "">>../include/netfilter.mk
echo "IPT_$upper_name-m :=">>../include/netfilter.mk
echo "IPT_$upper_name-\$(CONFIG_IP_NF_MATCH_$upper_name) += \$(P_V4)ipt_$lower_name">>../include/netfilter.mk
echo "IPT_BUILTIN += \$(IPT_$upper_name-y)">>../include/netfilter.mk
fi
done
if [ "$patch_kernel" = 1 ] ; then
#build netfilter patch file
rm -rf $patch_dir/650-custom_netfilter_match_modules.patch 2>/dev/null
cd linux.new
module_files=$(find net/ipv4/netfilter)
include_files=$(find include/linux/netfilter_ipv4)
test_files="$module_files $include_files"
cd ..
for t in $test_files ; do
if [ ! -d "linux.new/$t" ] ; then
if [ -e "linux.orig/$t" ] ; then
diff -u "linux.orig/$t" "linux.new/$t" >> $patch_dir/650-custom_netfilter_match_modules.patch
else
diff -u /dev/null "linux.new/$t" >> $patch_dir/650-custom_netfilter_match_modules.patch
fi
fi
done
#build iptables patch file
rm -f ../package/iptables/patches/650-custom_netfilter_match_modules.patch 2>/dev/null
cd iptables.new
extension_files=$(find extensions)
include_files=$(find include/linux/netfilter_ipv4)
cd ..
for t in $extension_files $include_files ; do
if [ ! -d "iptables.new/$t" ] ; then
if [ -e "iptables.orig/$t" ] ; then
diff -u "iptables.orig/$t" "iptables.new/$t" >>$iptables_patch_dir/650-custom_netfilter_match_modules.patch
else
diff -u /dev/null "iptables.new/$t" >>$iptables_patch_dir/650-custom_netfilter_match_modules.patch
fi
fi
done
fi
For some reason it is not being created.
Please send me .config from target/custo/default and from kernel build dir.
Regards,
Robert