Zwischencommit fuer LFS. Bis Kernel.

git-svn-id: http://svn.ipfire.org/svn/ipfire/trunk@311 ea5c0bd1-69bd-2848-81d8-4f18e57aeed8
This commit is contained in:
ms
2006-10-09 12:16:52 +00:00
parent d316437b8d
commit f59e1e8879
10 changed files with 1634 additions and 1505 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -1,3 +1,53 @@
------------------------------------------------------------------------
r310 | ms | 2006-10-09 00:55:09 +0200 (Mon, 09 Oct 2006) | 2 lines
Zwischencommit fuer LFS.
------------------------------------------------------------------------
r309 | ms | 2006-10-08 21:29:44 +0200 (Sun, 08 Oct 2006) | 2 lines
Zwischencommit fuer LFS. Man, Sysklogd und Shadow.
------------------------------------------------------------------------
r308 | ms | 2006-10-08 21:16:18 +0200 (Sun, 08 Oct 2006) | 2 lines
Zwischencommit fuer LFS. Groff und IPRoute2.
------------------------------------------------------------------------
r307 | ms | 2006-10-08 21:01:51 +0200 (Sun, 08 Oct 2006) | 2 lines
Zwischencommit fuer LFS. Grub und Gettext.
------------------------------------------------------------------------
r306 | ms | 2006-10-08 20:05:04 +0200 (Sun, 08 Oct 2006) | 2 lines
Zwischencommit fuer LFS.
------------------------------------------------------------------------
r305 | ms | 2006-10-08 16:39:28 +0200 (Sun, 08 Oct 2006) | 2 lines
Zwischencommit fuer LFS.
------------------------------------------------------------------------
r304 | ms | 2006-10-06 11:08:18 +0200 (Fri, 06 Oct 2006) | 2 lines
Zwischencommit fuer LFS. GCC und Binutils fixed.
------------------------------------------------------------------------
r303 | ms | 2006-10-04 16:35:14 +0200 (Wed, 04 Oct 2006) | 2 lines
Binutilserror behoben.
------------------------------------------------------------------------
r302 | ms | 2006-10-02 22:48:09 +0200 (Mon, 02 Oct 2006) | 2 lines
Zwischencommit LFS - Stoppt bei Stage2 - Binutils.
------------------------------------------------------------------------
r301 | ms | 2006-10-01 21:57:04 +0200 (Sun, 01 Oct 2006) | 2 lines
Zwischencommit für LFS.
------------------------------------------------------------------------
r300 | ms | 2006-10-01 17:04:23 +0200 (Sun, 01 Oct 2006) | 2 lines

156
lfs/linux
View File

@@ -26,8 +26,8 @@
include Config
VER = 2.4.33
PATCHLEVEL = 2.4.33.3
VER = 2.6.16
PATCHLEVEL = 2.6.16.27
THISAPP = linux-$(VER)
DL_FILE = $(THISAPP).tar.gz
@@ -38,8 +38,6 @@ CXXFLAGS =
# Normal build or /tools build.
#
ifeq "$(ROOT)" ""
ifeq "$(LFS_PASS)" "ipfire"
ifeq "$(SMP)" ""
TARGET = $(DIR_INFO)/linux-$(PATCHLEVEL)-ipfire
endif
@@ -49,42 +47,36 @@ endif
ifeq "$(SMP)" "installer"
TARGET = $(DIR_INFO)/linux-$(PATCHLEVEL)-ipfire-installer
endif
else
TARGET = $(DIR_INFO)/linux-$(PATCHLEVEL)
endif
else
TARGET = $(DIR_INFO)/linux-$(PATCHLEVEL)-tools
endif
###############################################################################
# Top-level Rules
###############################################################################
objects =$(DL_FILE) \
openswan-1.0.10rc2.tar.gz \
openswan-2.4.6.kernel-2.6-natt.patch.gz \
iptables-1.3.5.tar.bz2 \
patch-o-matic-ng-20060206.tar.bz2 \
kbc_option_2420.patch \
net4801.kernel.patch_2.4.31 \
netfilter-layer7-v2.1.tar.gz \
patch-$(PATCHLEVEL).bz2
patch-$(PATCHLEVEL).gz
$(DL_FILE) = $(DL_FROM)/$(DL_FILE)
patch-$(PATCHLEVEL).bz2 = $(DL_FROM)/patch-$(PATCHLEVEL).bz2
openswan-1.0.10rc2.tar.gz = $(URL_IPFIRE)/openswan-1.0.10rc2.tar.gz
$(DL_FILE) = $(DL_FROM)/$(DL_FILE)
patch-$(PATCHLEVEL)gz = $(DL_FROM)/patch-$(PATCHLEVEL).bz2
openswan-2.4.6.kernel-2.6-natt.patch.gz = $(URL_IPFIRE)/openswan-2.4.6.kernel-2.6-natt.patch.gz
patch-o-matic-ng-20060206.tar.bz2 = $(URL_IPFIRE)/patch-o-matic-ng-20060206.tar.bz2
iptables-1.3.5.tar.bz2 = $(URL_IPFIRE)/iptables-1.3.5.tar.bz2
kbc_option_2420.patch = $(URL_IPFIRE)/kbc_option_2420.patch
net4801.kernel.patch_2.4.31 = $(URL_IPFIRE)/net4801.kernel.patch_2.4.31
iptables-1.3.5.tar.bz2 = $(URL_IPFIRE)/iptables-1.3.5.tar.bz2
kbc_option_2420.patch = $(URL_IPFIRE)/kbc_option_2420.patch
net4801.kernel.patch_2.4.31 = $(URL_IPFIRE)/net4801.kernel.patch_2.4.31
netfilter-layer7-v2.1.tar.gz = $(URL_IPFIRE)/netfilter-layer7-v2.1.tar.gz
$(DL_FILE)_MD5 = 4d258d4267de64f0a22e23f6ab026990
patch-$(PATCHLEVEL).bz2_MD5 = 3597da59e82a495d97e1f0ecd8fc5d4d
openswan-1.0.10rc2.tar.gz_MD5 = 20d51ff963da78f826f4e0f0ebc4bcef
patch-o-matic-ng-20060206.tar.bz2_MD5 = eca9893afb753e331caddfe63142b566
iptables-1.3.5.tar.bz2_MD5 = 00fb916fa8040ca992a5ace56d905ea5
kbc_option_2420.patch_MD5 = 6d37870344f7fcf97ace1fbf43323c60
net4801.kernel.patch_2.4.31_MD5 = c7d64e3caedb2f2b10e1c11db7f73a04
netfilter-layer7-v2.1.tar.gz_MD5 = 551626a158c2a2cbfd937d27ecc7fac1
$(DL_FILE)_MD5 = 50695965725367f39007023feac5e256
patch-$(PATCHLEVEL).gz_MD5 = 4b09dd018286850c20c0f051ced7b583
openswan-2.4.6.kernel-2.6-natt.patch.gz_MD5 = 398110db4372ea3acc45bd66d6d86eac
patch-o-matic-ng-20060206.tar.bz2_MD5 = eca9893afb753e331caddfe63142b566
iptables-1.3.5.tar.bz2_MD5 = 00fb916fa8040ca992a5ace56d905ea5
kbc_option_2420.patch_MD5 = 6d37870344f7fcf97ace1fbf43323c60
net4801.kernel.patch_2.4.31_MD5 = c7d64e3caedb2f2b10e1c11db7f73a04
netfilter-layer7-v2.1.tar.gz_MD5 = 551626a158c2a2cbfd937d27ecc7fac1
install : $(TARGET)
@@ -114,59 +106,50 @@ $(subst %,%_MD5,$(objects)) :
$(TARGET) : $(patsubst %,$(DIR_DL)/%,$(objects))
@$(PREBUILD)
@rm -rf $(DIR_APP) $(DIR_SRC)/linux && cd $(DIR_SRC) && tar zxf $(DIR_DL)/$(DL_FILE)
cd $(DIR_APP) && bzcat $(DIR_DL)/patch-$(PATCHLEVEL).bz2 | patch -p1
cd $(DIR_APP) && zcat $(DIR_DL)/patch-$(PATCHLEVEL).gz | patch -p1
cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux-2.6.16.27-utf8_input-1.patch
# Remove patch level in EXTRAVERSION.
# We want to avoid the need to supply a full kernel
# (installed in a different place) if only one part could be updated
cd $(DIR_APP) && sed -i -e 's/EXTRAVERSION\ =.*/EXTRAVERSION\ =/' Makefile
cd $(DIR_SRC) && ln -sf linux-$(VER) linux
cd $(DIR_APP) && sed -i -e 's/-Werror//' drivers/scsi/aic7xxx/Makefile
# add IDE SiS 965L support to SiS driver. Request sf#1517522
cd $(DIR_SRC) && patch -p0 < $(DIR_SRC)/src/patches/linux-sis-965l.patch
# Openswan
cd $(DIR_SRC) && rm -rf openswan-*
cd $(DIR_SRC) && tar xfz $(DIR_DL)/openswan-1.0.10.tar.gz
cd $(DIR_SRC)/openswan-1.0.10 && patch -Np1 < $(DIR_SRC)/src/patches/openswan-1.0.1-plutoctl.patch
cd $(DIR_SRC)/openswan-1.0.10 && patch -Np1 < $(DIR_SRC)/src/patches/openswan-1.0.6-numif.patch
cd $(DIR_SRC)/openswan-1.0.10 && sed -i 's+^KERNELSRC.*$$+KERNELSRC=$(ROOT)/usr/src/linux-$(VER)+' Makefile.inc
cd $(DIR_SRC)/openswan-1.0.10 && sed -i -e 's/local\/sbin/local\/sbin:\/tools\/bin/' utils/patcher
cd $(DIR_SRC)/openswan-1.0.10 && make insert
# Openswan-2
# cd $(DIR_SRC) && zcat $(DIR_DL)/openswan-2.4.6.kernel-2.6-natt.patch.gz | patch -Np0
# Patch-o-matic
cd $(DIR_SRC) && rm -rf iptables-*
cd $(DIR_SRC) && tar xfj $(DIR_DL)/iptables-1.3.5.tar.bz2
cd $(DIR_SRC) && tar xfj $(DIR_DL)/iptables-1.3.5.tar.bz2
cd $(DIR_SRC) && ln -sf iptables-1.3.5 iptables
cd $(DIR_SRC) && rm -rf patch-o-matic*
cd $(DIR_SRC) && tar xfj $(DIR_DL)/patch-o-matic-ng-20060206.tar.bz2
cd $(DIR_SRC)/patch-o-matic* && yes 'y' | ./runme --kernel-path=$(ROOT)/usr/src/linux/ --iptables-path=$(ROOT)/usr/src/iptables/ pending
cd $(DIR_SRC)/patch-o-matic* && yes 'y' | ./runme --kernel-path=$(ROOT)/usr/src/linux/ --iptables-path=$(ROOT)/usr/src/iptables/ base
cd $(DIR_SRC)/patch-o-matic* && yes 'y' | ./runme --kernel-path=$(ROOT)/usr/src/linux/ --iptables-path=$(ROOT)/usr/src/iptables/ h323-conntrack-nat
cd $(DIR_SRC)/patch-o-matic* && yes 'y' | ./runme --kernel-path=$(ROOT)/usr/src/linux/ --iptables-path=$(ROOT)/usr/src/iptables/ cuseeme-nat
cd $(DIR_SRC)/patch-o-matic* && yes 'y' | ./runme --kernel-path=$(ROOT)/usr/src/linux/ --iptables-path=$(ROOT)/usr/src/iptables/ mms-conntrack-nat
cd $(DIR_SRC)/patch-o-matic* && yes 'y' | ./runme --kernel-path=$(ROOT)/usr/src/linux/ --iptables-path=$(ROOT)/usr/src/iptables/ pptp-conntrack-nat
cd $(DIR_SRC)/patch-o-matic* && yes 'y' | ./runme --kernel-path=$(ROOT)/usr/src/linux/ --iptables-path=$(ROOT)/usr/src/iptables/ rtsp-conntrack
cd $(DIR_SRC)/patch-o-matic* && yes 'y' | ./runme --kernel-path=$(ROOT)/usr/src/linux/ --iptables-path=$(ROOT)/usr/src/iptables/ quake3-conntrack-nat
cd $(DIR_SRC)/patch-o-matic* && yes 'y' | ./runme --kernel-path=$(ROOT)/usr/src/linux/ --iptables-path=$(ROOT)/usr/src/iptables/ sip-conntrack-nat
cd $(DIR_SRC)/patch-o-matic* && yes 'y' | ./runme --kernel-path=$(ROOT)/usr/src/linux/ --iptables-path=$(ROOT)/usr/src/iptables/ ip_queue_vwmark
cd $(DIR_SRC)/patch-o-matic* && yes 'y' | ./runme --kernel-path=$(ROOT)/usr/src/linux/ --iptables-path=$(ROOT)/usr/src/iptables/ ipp2p
cd $(DIR_SRC)/patch-o-matic* && yes 'y' | ./runme --kernel-path=$(ROOT)/usr/src/linux/ --iptables-path=$(ROOT)/usr/src/iptables/ ipsec-01-output-hooks
cd $(DIR_SRC)/patch-o-matic* && yes 'y' | ./runme --kernel-path=$(ROOT)/usr/src/linux/ --iptables-path=$(ROOT)/usr/src/iptables/ ipsec-02-input-hooks
cd $(DIR_SRC)/patch-o-matic* && yes 'y' | ./runme --kernel-path=$(ROOT)/usr/src/linux/ --iptables-path=$(ROOT)/usr/src/iptables/ ipsec-03-policy-lookup
cd $(DIR_SRC)/patch-o-matic* && yes 'y' | ./runme --kernel-path=$(ROOT)/usr/src/linux/ --iptables-path=$(ROOT)/usr/src/iptables/ ipsec-04-policy-checks
cd $(DIR_SRC)/patch-o-matic* && yes 'y' | ./runme --kernel-path=$(ROOT)/usr/src/linux/ --iptables-path=$(ROOT)/usr/src/iptables/ TARPIT
# cd $(DIR_SRC)/patch-o-matic* && yes 'y' | ./runme --kernel-path=$(DIR_APP) --iptables-path=$(ROOT)/usr/src/iptables/ pending
# cd $(DIR_SRC)/patch-o-matic* && yes 'y' | ./runme --kernel-path=$(DIR_APP) --iptables-path=$(ROOT)/usr/src/iptables/ base
# cd $(DIR_SRC)/patch-o-matic* && yes 'y' | ./runme --kernel-path=$(DIR_APP) --iptables-path=$(ROOT)/usr/src/iptables/ h323-conntrack-nat
# cd $(DIR_SRC)/patch-o-matic* && yes 'y' | ./runme --kernel-path=$(DIR_APP) --iptables-path=$(ROOT)/usr/src/iptables/ cuseeme-nat
# cd $(DIR_SRC)/patch-o-matic* && yes 'y' | ./runme --kernel-path=$(DIR_APP) --iptables-path=$(ROOT)/usr/src/iptables/ mms-conntrack-nat
# cd $(DIR_SRC)/patch-o-matic* && yes 'y' | ./runme --kernel-path=$(DIR_APP) --iptables-path=$(ROOT)/usr/src/iptables/ pptp-conntrack-nat
# cd $(DIR_SRC)/patch-o-matic* && yes 'y' | ./runme --kernel-path=$(DIR_APP) --iptables-path=$(ROOT)/usr/src/iptables/ rtsp-conntrack
# cd $(DIR_SRC)/patch-o-matic* && yes 'y' | ./runme --kernel-path=$(DIR_APP) --iptables-path=$(ROOT)/usr/src/iptables/ quake3-conntrack-nat
# cd $(DIR_SRC)/patch-o-matic* && yes 'y' | ./runme --kernel-path=$(DIR_APP) --iptables-path=$(ROOT)/usr/src/iptables/ sip-conntrack-nat
# cd $(DIR_SRC)/patch-o-matic* && yes 'y' | ./runme --kernel-path=$(DIR_APP) --iptables-path=$(ROOT)/usr/src/iptables/ ip_queue_vwmark
# cd $(DIR_SRC)/patch-o-matic* && yes 'y' | ./runme --kernel-path=$(DIR_APP) --iptables-path=$(ROOT)/usr/src/iptables/ ipp2p
# cd $(DIR_SRC)/patch-o-matic* && yes 'y' | ./runme --kernel-path=$(DIR_APP) --iptables-path=$(ROOT)/usr/src/iptables/ ipsec-01-output-hooks
# cd $(DIR_SRC)/patch-o-matic* && yes 'y' | ./runme --kernel-path=$(DIR_APP) --iptables-path=$(ROOT)/usr/src/iptables/ ipsec-02-input-hooks
# cd $(DIR_SRC)/patch-o-matic* && yes 'y' | ./runme --kernel-path=$(DIR_APP) --iptables-path=$(ROOT)/usr/src/iptables/ ipsec-03-policy-lookup
# cd $(DIR_SRC)/patch-o-matic* && yes 'y' | ./runme --kernel-path=$(DIR_APP) --iptables-path=$(ROOT)/usr/src/iptables/ ipsec-04-policy-checks
# cd $(DIR_SRC)/patch-o-matic* && yes 'y' | ./runme --kernel-path=$(DIR_APP) --iptables-path=$(ROOT)/usr/src/iptables/ TARPIT
#imq-patch
cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux-2.4.28-imq2.diff
# imq-patch
cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux-2.6.16-imq2.diff
#layer7-patch
cd $(DIR_SRC) && tar xzf $(DIR_DL)/netfilter-layer7-v2.1.tar.gz
cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/netfilter-layer7-v2.1/kernel-2.4-layer7-2.1.patch
cd $(DIR_SRC) && tar xzf $(DIR_DL)/netfilter-layer7-v2.6.tar.gz
cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/netfilter-layer7-v2.6/for_older_kernels/kernel-2.6.13-2.6.16-layer7-2.2.patch
# ip_conntrack permissions from 440 to 444
cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/ip_conntrack_standalone-patch-for-ipfire.patch
# cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/ip_conntrack_standalone-patch-for-ipfire.patch
ifeq "$(SMP)" ""
# Only do this once on the non-SMP pass
@@ -174,34 +157,32 @@ ifeq "$(SMP)" ""
endif
# Olitec isdn gazel patch
cd $(DIR_APP) && patch -Np0 < $(DIR_SRC)/src/patches/linux-2.4.23-olitec-isdn.patch
# cd $(DIR_APP) && patch -Np0 < $(DIR_SRC)/src/patches/linux-2.4.23-olitec-isdn.patch
# Fix /proc/stat output
cd $(DIR_APP) && patch -Np2 < $(DIR_SRC)/src/patches/linux-2.4.26-proc-stat.patch
# cd $(DIR_APP) && patch -Np2 < $(DIR_SRC)/src/patches/linux-2.4.26-proc-stat.patch
# Fix libata-core.c
# cd $(DIR_APP) && patch -Np0 < $(DIR_SRC)/src/patches/linux-2.4.26-scsi.patch
# frandom patch
cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux-2.4.27-frandom-2.patch
# cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux-2.4.27-frandom-2.patch
# Propolice
cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux-2.4.27-ssp-1.patch
# cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux-2.4.27-ssp-1.patch
# Support ppp-2.4.3 multilink behavior (terminate when no channel is connected)
# need updated libpcap older than 0.8.3
# cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/ppp_generic-ppp-2.4.3_multilink.patch
# R8169 clone D-link GSE-528T
cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux-2.4.29_r8169clone.patch
# cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux-2.4.29_r8169clone.patch
# bootsplash
cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/bootsplash-3.0.7-2.4.31-vanilla.diff
# cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/bootsplash-3.0.7-2.4.31-vanilla.diff
# Cleanup kernel source
cd $(DIR_APP) && make mrproper
ifeq "$(ROOT)" ""
ifeq "$(LFS_PASS)" "ipfire"
ifeq "$(SMP)" ""
cp $(DIR_SRC)/config/kernel/kernel.config.$(MACHINE) $(DIR_APP)/.config
endif
@@ -216,33 +197,25 @@ endif
cd $(DIR_APP) && make CC="$(KGCC)" oldconfig
cd $(DIR_APP) && make CC="$(KGCC)" dep
cd $(DIR_APP) && make CC="$(KGCC)" clean
if [ "$(MACHINE)" = "i386" -a "$(SMP)" = "" ]; then \
cd $(DIR_APP) && make -j 3 CC="$(KGCC)" bzImage; \
if [ "$(SMP)" = "" ]; then \
cd $(DIR_APP) && make $(MAKETUNING) CC="$(KGCC)" bzImage; \
cd $(DIR_APP) && cp arch/$(MACHINE)/boot/bzImage /boot/vmlinuz-$(VER); \
cd $(DIR_APP) && cp System.map /boot/System.map-$(VER); \
ln -sf vmlinuz-$(VER) /boot/vmlinuz; \
ln -sf System.map-$(VER) /boot/System.map; \
cd $(DIR_APP) && make CC="$(KGCC)" modules; \
cd $(DIR_APP) && make CC="$(KGCC)" modules_install; \
elif [ "$(MACHINE)" = "i386" -a "$(SMP)" = "1" ]; then \
elif [ "$(SMP)" = "1" ]; then \
cd $(DIR_APP) && sed -i -e 's/EXTRAVERSION\ =/EXTRAVERSION\ =\ -smp/' Makefile; \
cd $(DIR_APP) && make -j 3 CC="$(KGCC)" bzImage; \
cd $(DIR_APP) && make $(MAKETUNING) CC="$(KGCC)" bzImage; \
cd $(DIR_APP) && cp arch/$(MACHINE)/boot/bzImage /boot/vmlinuz-$(VER)-smp; \
cd $(DIR_APP) && cp System.map /boot/System.map-$(VER)-smp; \
ln -sf vmlinuz-$(VER)-smp /boot/vmlinuz-smp; \
cd $(DIR_APP) && make CC="$(KGCC)" modules; \
cd $(DIR_APP) && make CC="$(KGCC)" modules_install; \
elif [ "$(MACHINE)" = "i386" -a "$(SMP)" = "installer" ]; then \
cd $(DIR_APP) && make -j 3 CC="$(KGCC)" bzImage; \
elif [ "$(SMP)" = "installer" ]; then \
cd $(DIR_APP) && make $(MAKETUNING) CC="$(KGCC)" bzImage; \
cd $(DIR_APP) && cp arch/$(MACHINE)/boot/bzImage /boot/vmlinuz-installer; \
elif [ "$(MACHINE)" = "alpha" ]; then \
cd $(DIR_APP) && make -j 3 CC="$(KGCC)" vmlinux; \
cd $(DIR_APP) && gzip -9c vmlinux > /boot/vmlinuz-$(VER); \
cd $(DIR_APP) && cp System.map /boot/System.map-$(VER); \
ln -sf vmlinuz-$(VER) /boot/vmlinuz; \
ln -sf System.map-$(VER) /boot/System.map; \
cd $(DIR_APP) && make CC="$(KGCC)" modules; \
cd $(DIR_APP) && make CC="$(KGCC)" modules_install; \
fi
# remove symlinked pcmcia directory
ifeq "$(SMP)" ""
@@ -275,23 +248,6 @@ ifeq "$(SMP)" ""
cd $(DIR_APP) && make mandocs
-mkdir -p /usr/share/man/man9/
cd $(DIR_APP) && cp -af Documentation/man/* /usr/share/man/man9/
endif
else
cd $(DIR_APP) && make include/linux/version.h
cd $(DIR_APP) && make symlinks
cd $(DIR_APP) && cp -HRf include/asm /usr/include
cd $(DIR_APP) && cp -Rf include/asm-generic /usr/include
cd $(DIR_APP) && cp -Rf include/linux /usr/include
touch /usr/include/linux/autoconf.h
endif
else
cd $(DIR_APP) && make include/linux/version.h
cd $(DIR_APP) && make symlinks
-mkdir -p /tools/include/asm
cd $(DIR_APP) && cp -f include/asm/* /tools/include/asm
cd $(DIR_APP) && cp -Rf include/asm-generic /tools/include
cd $(DIR_APP) && cp -Rf include/linux /tools/include
cd $(DIR_APP) && touch /tools/include/linux/autoconf.h
endif
@rm -rf $(DIR_SRC)/patch-o-matic* $(DIR_SRC)/iptables*
@$(POSTBUILD)

65
make.sh
View File

@@ -320,39 +320,39 @@ buildipfire() {
ipfiremake unzip
ipfiremake linux PASS=ipfire SMP=installer
ipfiremake linux PASS=ipfire SMP=1
ipfiremake 3cp4218 SMP=1
ipfiremake amedyn SMP=1
ipfiremake cxacru SMP=1
ipfiremake eagle SMP=1
ipfiremake cnx_pci SMP=1
ipfiremake fcdsl SMP=1
ipfiremake fcdsl2 SMP=1
ipfiremake fcdslsl SMP=1
ipfiremake fcdslusb SMP=1
ipfiremake fcdslslusb SMP=1
ipfiremake fcpci SMP=1
ipfiremake fcclassic SMP=1
ipfiremake pulsar SMP=1
ipfiremake unicorn SMP=1
ipfiremake promise-sata-300-tx SMP=1
# ipfiremake 3cp4218 SMP=1
# ipfiremake amedyn SMP=1
# ipfiremake cxacru SMP=1
# ipfiremake eagle SMP=1
# ipfiremake cnx_pci SMP=1
# ipfiremake fcdsl SMP=1
# ipfiremake fcdsl2 SMP=1
# ipfiremake fcdslsl SMP=1
# ipfiremake fcdslusb SMP=1
# ipfiremake fcdslslusb SMP=1
# ipfiremake fcpci SMP=1
# ipfiremake fcclassic SMP=1
# ipfiremake pulsar SMP=1
# ipfiremake unicorn SMP=1
# ipfiremake promise-sata-300-tx SMP=1
ipfiremake linux PASS=ipfire
ipfiremake 3cp4218
ipfiremake amedyn
ipfiremake cxacru
ipfiremake eciadsl
ipfiremake eagle
ipfiremake speedtouch
ipfiremake cnx_pci
ipfiremake fcdsl
ipfiremake fcdsl2
ipfiremake fcdslsl
ipfiremake fcdslusb
ipfiremake fcdslslusb
ipfiremake fcpci
ipfiremake fcclassic
ipfiremake pulsar
ipfiremake unicorn
ipfiremake promise-sata-300-tx
# ipfiremake 3cp4218
# ipfiremake amedyn
# ipfiremake cxacru
# ipfiremake eciadsl
# ipfiremake eagle
# ipfiremake speedtouch
# ipfiremake cnx_pci
# ipfiremake fcdsl
# ipfiremake fcdsl2
# ipfiremake fcdslsl
# ipfiremake fcdslusb
# ipfiremake fcdslslusb
# ipfiremake fcpci
# ipfiremake fcclassic
# ipfiremake pulsar
# ipfiremake unicorn
# ipfiremake promise-sata-300-tx
ipfiremake pcmcia-cs
ipfiremake expat
ipfiremake gdbm
@@ -992,6 +992,7 @@ uploadsrc)
echo -e "Uploading cache to ftp server:"
ncftpls -u $IPFIRE_FTP_USER_INT -p $IPFIRE_FTP_PASS_INT ftp://$IPFIRE_FTP_URL_INT$IPFIRE_FTP_PATH_INT/ > /var/tmp/ftplist
for i in *; do
if [ "$i" == "toolchains" ]; then continue; fi
grep -q $i /var/tmp/ftplist
if [ "$?" -ne "0" ]; then
echo -ne "$i"

View File

@@ -0,0 +1,230 @@
Submitted By: DJ Lucas (dj at linuxfromscratch dot org)
Date: 2005-06-18
Initial Package Version: 3.0.2
Origin: Jim Gifford, Bruce Dubbs, DJ Lucas
Description: Fixes client script to use iproute2 (added flush to previous
unversioned patches)
Upstream Status: Not submitted
--- dhcp-3.0.2-orig/client/scripts/linux 2002-11-14 19:09:09.000000000 -0600
+++ dhcp-3.0.2/client/scripts/linux 2005-06-18 22:54:59.000000000 -0500
@@ -1,26 +1,15 @@
#!/bin/bash
# dhclient-script for Linux. Dan Halbert, March, 1997.
# Updated for Linux 2.[12] by Brian J. Murrell, January 1999.
-# No guarantees about this. I'm a novice at the details of Linux
-# networking.
+
+# Updated to iproute2 by Jim Gifford (scripts@jg555.com)
# Notes:
# 0. This script is based on the netbsd script supplied with dhcp-970306.
-
-# 1. ifconfig down apparently deletes all relevant routes and flushes
-# the arp cache, so this doesn't need to be done explicitly.
-
-# 2. The alias address handling here has not been tested AT ALL.
-# I'm just going by the doc of modern Linux ip aliasing, which uses
-# notations like eth0:0, eth0:1, for each alias.
-
-# 3. I have to calculate the network address, and calculate the broadcast
-# address if it is not supplied. This might be much more easily done
-# by the dhclient C code, and passed on.
-
-# 4. TIMEOUT not tested. ping has a flag I don't know, and I'm suspicious
-# of the $1 in its args.
+# 1. This script was modified to work with iproute2
+# 2. cidr_convert based on a script by Kevin Fleming (kpfleming@linuxfromscratch.org)
+# 3. Updated to delete addresses when taking an interface down (bdubbs@linuxfromscratch.org)
make_resolv_conf() {
if [ "x$new_domain_name" != x ] && [ x"$new_domain_name_servers" != x ]; then
@@ -32,6 +21,30 @@
fi
}
+dec2binary()
+{
+ local n=$1
+ local ret=""
+ while [ $n != 0 ]; do
+ ret=$[$n%2]$ret
+ n=$[$n>>1]
+ done
+ echo $ret
+}
+
+mask_to_binary()
+{
+ echo `dec2binary $1``dec2binary $2``dec2binary $3``dec2binary $4`
+}
+
+cidr_convert()
+{
+ netmask=$1
+ local mask=`mask_to_binary ${netmask//./ }`
+ mask=${mask%%0*}
+ cidr=${#mask}
+}
+
# Must be used on exit. Invokes the local dhcp client exit hooks, if any.
exit_with_hooks() {
exit_status=$1
@@ -53,11 +66,6 @@
fi
fi
-release=`uname -r`
-release=`expr $release : '\(.*\)\..*'`
-relminor=`echo $release |sed -e 's/[0-9]*\.\([0-9][0-9]*\)\(\..*\)*$/\1/'`
-relmajor=`echo $release |sed -e 's/\([0-9][0-9]*\)\..*$/\1/'`
-
if [ x$new_broadcast_address != x ]; then
new_broadcast_arg="broadcast $new_broadcast_address"
fi
@@ -65,13 +73,12 @@
old_broadcast_arg="broadcast $old_broadcast_address"
fi
if [ x$new_subnet_mask != x ]; then
- new_subnet_arg="netmask $new_subnet_mask"
+ cidr_convert $new_subnet_mask
+ new_subnet_arg="$cidr"
fi
if [ x$old_subnet_mask != x ]; then
- old_subnet_arg="netmask $old_subnet_mask"
-fi
-if [ x$alias_subnet_mask != x ]; then
- alias_subnet_arg="netmask $alias_subnet_mask"
+ cidr_convert $old_subnet_mask
+ old_subnet_arg="$cidr"
fi
if [ x$reason = xMEDIUM ]; then
@@ -82,17 +89,10 @@
if [ x$reason = xPREINIT ]; then
if [ x$alias_ip_address != x ]; then
# Bring down alias interface. Its routes will disappear too.
- ifconfig $interface:0- inet 0
- fi
- if [ $relmajor -lt 2 ] || ( [ $relmajor -eq 2 ] && [ $relminor -eq 0 ] )
- then
- ifconfig $interface inet 0.0.0.0 netmask 0.0.0.0 \
- broadcast 255.255.255.255 up
- # Add route to make broadcast work. Do not omit netmask.
- route add default dev $interface netmask 0.0.0.0
- else
- ifconfig $interface 0 up
+ ip link set $interface down
+ ip addr del $alias_ip_address dev $interface
fi
+ ip link set $interface up
# We need to give the kernel some time to get the interface up.
sleep 1
@@ -115,83 +115,51 @@
fi
fi
- if [ x$old_ip_address != x ] && [ x$alias_ip_address != x ] && \
- [ x$alias_ip_address != x$old_ip_address ]; then
- # Possible new alias. Remove old alias.
- ifconfig $interface:0- inet 0
- fi
if [ x$old_ip_address != x ] && [ x$old_ip_address != x$new_ip_address ]; then
- # IP address changed. Bringing down the interface will delete all routes,
+ # IP address changed. Bring down the interface, delete all routes,
# and clear the ARP cache.
- ifconfig $interface inet 0 down
-
+ ip link set $interface down
+ ip addr flush dev $interface
fi
if [ x$old_ip_address = x ] || [ x$old_ip_address != x$new_ip_address ] || \
[ x$reason = xBOUND ] || [ x$reason = xREBOOT ]; then
- ifconfig $interface inet $new_ip_address $new_subnet_arg \
- $new_broadcast_arg
+ ip link set $interface up
+ ip addr add $new_ip_address/$new_subnet_arg $new_broadcast_arg \
+ label $interface dev $interface
# Add a network route to the computed network address.
- if [ $relmajor -lt 2 ] || \
- ( [ $relmajor -eq 2 ] && [ $relminor -eq 0 ] ); then
- route add -net $new_network_number $new_subnet_arg dev $interface
- fi
for router in $new_routers; do
- route add default gw $router
+ ip route add default via $router
done
fi
- if [ x$new_ip_address != x$alias_ip_address ] && [ x$alias_ip_address != x ];
- then
- ifconfig $interface:0- inet 0
- ifconfig $interface:0 inet $alias_ip_address $alias_subnet_arg
- route add -host $alias_ip_address $interface:0
- fi
make_resolv_conf
exit_with_hooks 0
fi
if [ x$reason = xEXPIRE ] || [ x$reason = xFAIL ] || [ x$reason = xRELEASE ] \
|| [ x$reason = xSTOP ]; then
- if [ x$alias_ip_address != x ]; then
- # Turn off alias interface.
- ifconfig $interface:0- inet 0
- fi
if [ x$old_ip_address != x ]; then
- # Shut down interface, which will delete routes and clear arp cache.
- ifconfig $interface inet 0 down
- fi
- if [ x$alias_ip_address != x ]; then
- ifconfig $interface:0 inet $alias_ip_address $alias_subnet_arg
- route add -host $alias_ip_address $interface:0
+ # Shut down interface, delete routes, and clear arp cache.
+ ip link set $interface down
+ ip addr flush dev $interface
fi
exit_with_hooks 0
fi
if [ x$reason = xTIMEOUT ]; then
- if [ x$alias_ip_address != x ]; then
- ifconfig $interface:0- inet 0
- fi
- ifconfig $interface inet $new_ip_address $new_subnet_arg \
- $new_broadcast_arg
+ ip link set $interface up
+ ip addr set $new_ip_address/$new_subnet_arg $new_broadcast_arg \
+ label $interface dev $interface
set $new_routers
- ############## what is -w in ping?
- if ping -q -c 1 $1; then
- if [ x$new_ip_address != x$alias_ip_address ] && \
- [ x$alias_ip_address != x ]; then
- ifconfig $interface:0 inet $alias_ip_address $alias_subnet_arg
- route add -host $alias_ip_address dev $interface:0
- fi
- if [ $relmajor -lt 2 ] || \
- ( [ $relmajor -eq 2 ] && [ $relminor -eq 0 ] ); then
- route add -net $new_network_number
- fi
- for router in $new_routers; do
- route add default gw $router
- done
- make_resolv_conf
- exit_with_hooks 0
- fi
- ifconfig $interface inet 0 down
+
+ for router in $new_routers; do
+ ip route add default via $router
+ done
+
+ make_resolv_conf
+ exit_with_hooks 0
+ ip link set $interface down
+ ip addr flush dev $interface
exit_with_hooks 1
fi

View File

@@ -0,0 +1,885 @@
diff -Nru linux-2.6.16/drivers/net/Kconfig linux-2.6.16-imq/drivers/net/Kconfig
--- linux-2.6.16/drivers/net/Kconfig 2006-03-20 05:53:29.000000000 +0000
+++ linux-2.6.16-imq/drivers/net/Kconfig 2006-03-25 20:57:14.000000000 +0000
@@ -93,6 +93,129 @@
To compile this driver as a module, choose M here: the module
will be called eql. If unsure, say N.
+config IMQ
+ tristate "IMQ (intermediate queueing device) support"
+ depends on NETDEVICES && NETFILTER
+ ---help---
+ The IMQ device(s) is used as placeholder for QoS queueing disciplines.
+ Every packet entering/leaving the IP stack can be directed through
+ the IMQ device where it's enqueued/dequeued to the attached qdisc.
+ This allows you to treat network devices as classes and distribute
+ bandwidth among them. Iptables is used to specify through which IMQ
+ device, if any, packets travel.
+
+ More information at: http://www.linuximq.net/
+
+ To compile this driver as a module, choose M here: the module
+ will be called imq. If unsure, say N.
+
+choice
+ prompt "IMQ behavior (PRE/POSTROUTING)"
+ depends on IMQ
+ default IMQ_BEHAVIOR_BA
+ help
+
+ This settings defines how IMQ behaves in respect to its
+ hooking in PREROUTING and POSTROUTING.
+
+ IMQ can work in any of the following ways:
+
+ PREROUTING | POSTROUTING
+ -----------------|-------------------
+ #1 After NAT | After NAT
+ #2 After NAT | Before NAT
+ #3 Before NAT | After NAT
+ #4 Before NAT | Before NAT
+
+ The default behavior is to hook before NAT on PREROUTING
+ and after NAT on POSTROUTING (#3).
+
+ This settings are specially usefull when trying to use IMQ
+ to shape NATed clients.
+
+ More information can be found at: www.linuximq.net
+
+ If not sure leave the default settings alone.
+
+config IMQ_BEHAVIOR_AA
+ bool "IMQ AA"
+ help
+ This settings defines how IMQ behaves in respect to its
+ hooking in PREROUTING and POSTROUTING.
+
+ Choosing this option will make IMQ hook like this:
+
+ PREROUTING: After NAT
+ POSTROUTING: After NAT
+
+ More information can be found at: www.linuximq.net
+
+ If not sure leave the default settings alone.
+
+config IMQ_BEHAVIOR_AB
+ bool "IMQ AB"
+ help
+ This settings defines how IMQ behaves in respect to its
+ hooking in PREROUTING and POSTROUTING.
+
+ Choosing this option will make IMQ hook like this:
+
+ PREROUTING: After NAT
+ POSTROUTING: Before NAT
+
+ More information can be found at: www.linuximq.net
+
+ If not sure leave the default settings alone.
+
+config IMQ_BEHAVIOR_BA
+ bool "IMQ BA"
+ help
+ This settings defines how IMQ behaves in respect to its
+ hooking in PREROUTING and POSTROUTING.
+
+ Choosing this option will make IMQ hook like this:
+
+ PREROUTING: Before NAT
+ POSTROUTING: After NAT
+
+ More information can be found at: www.linuximq.net
+
+ If not sure leave the default settings alone.
+
+config IMQ_BEHAVIOR_BB
+ bool "IMQ BB"
+ help
+ This settings defines how IMQ behaves in respect to its
+ hooking in PREROUTING and POSTROUTING.
+
+ Choosing this option will make IMQ hook like this:
+
+ PREROUTING: Before NAT
+ POSTROUTING: Before NAT
+
+ More information can be found at: www.linuximq.net
+
+ If not sure leave the default settings alone.
+
+endchoice
+
+config IMQ_NUM_DEVS
+
+ int "Number of IMQ devices"
+ range 2 8
+ depends on IMQ
+ default "2"
+ help
+
+ This settings defines how many IMQ devices will be
+ created.
+
+ The default value is 2.
+
+ More information can be found at: www.linuximq.net
+
+ If not sure leave the default settings alone.
+
config TUN
tristate "Universal TUN/TAP device driver support"
select CRC32
diff -Nru linux-2.6.16/drivers/net/Makefile linux-2.6.16-imq/drivers/net/Makefile
--- linux-2.6.16/drivers/net/Makefile 2006-03-20 05:53:29.000000000 +0000
+++ linux-2.6.16-imq/drivers/net/Makefile 2006-03-25 21:04:53.000000000 +0000
@@ -125,6 +125,7 @@
endif
obj-$(CONFIG_DUMMY) += dummy.o
+obj-$(CONFIG_IMQ) += imq.o
obj-$(CONFIG_IFB) += ifb.o
obj-$(CONFIG_DE600) += de600.o
obj-$(CONFIG_DE620) += de620.o
diff -Nru linux-2.6.16/drivers/net/imq.c linux-2.6.16-imq/drivers/net/imq.c
--- linux-2.6.16/drivers/net/imq.c 1970-01-01 00:00:00.000000000 +0000
+++ linux-2.6.16-imq/drivers/net/imq.c 2006-03-25 20:57:14.000000000 +0000
@@ -0,0 +1,403 @@
+/*
+ * Pseudo-driver for the intermediate queue device.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version
+ * 2 of the License, or (at your option) any later version.
+ *
+ * Authors: Patrick McHardy, <kaber@trash.net>
+ *
+ * The first version was written by Martin Devera, <devik@cdi.cz>
+ *
+ * Credits: Jan Rafaj <imq2t@cedric.vabo.cz>
+ * - Update patch to 2.4.21
+ * Sebastian Strollo <sstrollo@nortelnetworks.com>
+ * - Fix "Dead-loop on netdevice imq"-issue
+ * Marcel Sebek <sebek64@post.cz>
+ * - Update to 2.6.2-rc1
+ *
+ * After some time of inactivity there is a group taking care
+ * of IMQ again: http://www.linuximq.net
+ *
+ *
+ * 2004/06/30 - New version of IMQ patch to kernels <=2.6.7 including
+ * the following changes:
+ *
+ * - Correction of ipv6 support "+"s issue (Hasso Tepper)
+ * - Correction of imq_init_devs() issue that resulted in
+ * kernel OOPS unloading IMQ as module (Norbert Buchmuller)
+ * - Addition of functionality to choose number of IMQ devices
+ * during kernel config (Andre Correa)
+ * - Addition of functionality to choose how IMQ hooks on
+ * PRE and POSTROUTING (after or before NAT) (Andre Correa)
+ * - Cosmetic corrections (Norbert Buchmuller) (Andre Correa)
+ *
+ *
+ * 2005/12/16 - IMQ versions between 2.6.7 and 2.6.13 were
+ * released with almost no problems. 2.6.14-x was released
+ * with some important changes: nfcache was removed; After
+ * some weeks of trouble we figured out that some IMQ fields
+ * in skb were missing in skbuff.c - skb_clone and copy_skb_header.
+ * These functions are correctly patched by this new patch version.
+ *
+ * Thanks for all who helped to figure out all the problems with
+ * 2.6.14.x: Patrick McHardy, Rune Kock, VeNoMouS, Max CtRiX,
+ * Kevin Shanahan, Richard Lucassen, Valery Dachev (hopefully
+ * I didn't forget anybody). I apologize again for my lack of time.
+ *
+ * More info at: http://www.linuximq.net/ (Andre Correa)
+ */
+
+#include <linux/config.h>
+#include <linux/module.h>
+#include <linux/kernel.h>
+#include <linux/moduleparam.h>
+#include <linux/skbuff.h>
+#include <linux/netdevice.h>
+#include <linux/rtnetlink.h>
+#include <linux/if_arp.h>
+#include <linux/netfilter.h>
+#include <linux/netfilter_ipv4.h>
+#if defined(CONFIG_IPV6) || defined (CONFIG_IPV6_MODULE)
+ #include <linux/netfilter_ipv6.h>
+#endif
+#include <linux/imq.h>
+#include <net/pkt_sched.h>
+
+static nf_hookfn imq_nf_hook;
+
+static struct nf_hook_ops imq_ingress_ipv4 = {
+ .hook = imq_nf_hook,
+ .owner = THIS_MODULE,
+ .pf = PF_INET,
+ .hooknum = NF_IP_PRE_ROUTING,
+#if defined(CONFIG_IMQ_BEHAVIOR_BA) || defined(CONFIG_IMQ_BEHAVIOR_BB)
+ .priority = NF_IP_PRI_MANGLE + 1
+#else
+ .priority = NF_IP_PRI_NAT_DST + 1
+#endif
+};
+
+static struct nf_hook_ops imq_egress_ipv4 = {
+ .hook = imq_nf_hook,
+ .owner = THIS_MODULE,
+ .pf = PF_INET,
+ .hooknum = NF_IP_POST_ROUTING,
+#if defined(CONFIG_IMQ_BEHAVIOR_AA) || defined(CONFIG_IMQ_BEHAVIOR_BA)
+ .priority = NF_IP_PRI_LAST
+#else
+ .priority = NF_IP_PRI_NAT_SRC - 1
+#endif
+};
+
+#if defined(CONFIG_IPV6) || defined (CONFIG_IPV6_MODULE)
+static struct nf_hook_ops imq_ingress_ipv6 = {
+ .hook = imq_nf_hook,
+ .owner = THIS_MODULE,
+ .pf = PF_INET6,
+ .hooknum = NF_IP6_PRE_ROUTING,
+#if defined(CONFIG_IMQ_BEHAVIOR_BA) || defined(CONFIG_IMQ_BEHAVIOR_BB)
+ .priority = NF_IP6_PRI_MANGLE + 1
+#else
+ .priority = NF_IP6_PRI_NAT_DST + 1
+#endif
+};
+
+static struct nf_hook_ops imq_egress_ipv6 = {
+ .hook = imq_nf_hook,
+ .owner = THIS_MODULE,
+ .pf = PF_INET6,
+ .hooknum = NF_IP6_POST_ROUTING,
+#if defined(CONFIG_IMQ_BEHAVIOR_AA) || defined(CONFIG_IMQ_BEHAVIOR_BA)
+ .priority = NF_IP6_PRI_LAST
+#else
+ .priority = NF_IP6_PRI_NAT_SRC - 1
+#endif
+};
+#endif
+
+#if defined(CONFIG_IMQ_NUM_DEVS)
+static unsigned int numdevs = CONFIG_IMQ_NUM_DEVS;
+#else
+static unsigned int numdevs = 2;
+#endif
+
+static struct net_device *imq_devs;
+
+static struct net_device_stats *imq_get_stats(struct net_device *dev)
+{
+ return (struct net_device_stats *)dev->priv;
+}
+
+/* called for packets kfree'd in qdiscs at places other than enqueue */
+static void imq_skb_destructor(struct sk_buff *skb)
+{
+ struct nf_info *info = skb->nf_info;
+
+ if (info) {
+ if (info->indev)
+ dev_put(info->indev);
+ if (info->outdev)
+ dev_put(info->outdev);
+ kfree(info);
+ }
+}
+
+static int imq_dev_xmit(struct sk_buff *skb, struct net_device *dev)
+{
+ struct net_device_stats *stats = (struct net_device_stats*) dev->priv;
+
+ stats->tx_bytes += skb->len;
+ stats->tx_packets++;
+
+ skb->imq_flags = 0;
+ skb->destructor = NULL;
+
+ dev->trans_start = jiffies;
+ nf_reinject(skb, skb->nf_info, NF_ACCEPT);
+ return 0;
+}
+
+static int imq_nf_queue(struct sk_buff *skb, struct nf_info *info, unsigned queue_num, void *data)
+{
+ struct net_device *dev;
+ struct net_device_stats *stats;
+ struct sk_buff *skb2 = NULL;
+ struct Qdisc *q;
+ unsigned int index = skb->imq_flags&IMQ_F_IFMASK;
+ int ret = -1;
+
+ if (index > numdevs)
+ return -1;
+
+ dev = imq_devs + index;
+ if (!(dev->flags & IFF_UP)) {
+ skb->imq_flags = 0;
+ nf_reinject(skb, info, NF_ACCEPT);
+ return 0;
+ }
+ dev->last_rx = jiffies;
+
+ if (skb->destructor) {
+ skb2 = skb;
+ skb = skb_clone(skb, GFP_ATOMIC);
+ if (!skb)
+ return -1;
+ }
+ skb->nf_info = info;
+
+ stats = (struct net_device_stats *)dev->priv;
+ stats->rx_bytes+= skb->len;
+ stats->rx_packets++;
+
+ spin_lock_bh(&dev->queue_lock);
+ q = dev->qdisc;
+ if (q->enqueue) {
+ q->enqueue(skb_get(skb), q);
+ if (skb_shared(skb)) {
+ skb->destructor = imq_skb_destructor;
+ kfree_skb(skb);
+ ret = 0;
+ }
+ }
+ if (spin_is_locked(&dev->xmit_lock))
+ netif_schedule(dev);
+ else
+
+ while (!netif_queue_stopped(dev) &&
+ qdisc_restart(dev)<0)
+ /* NOTHING */;
+
+ spin_unlock_bh(&dev->queue_lock);
+
+ if (skb2)
+ kfree_skb(ret ? skb : skb2);
+
+ return ret;
+}
+
+static struct nf_queue_handler nfqh = {
+ .name = "imq",
+ .outfn = imq_nf_queue,
+};
+
+static unsigned int imq_nf_hook(unsigned int hook, struct sk_buff **pskb,
+ const struct net_device *indev,
+ const struct net_device *outdev,
+ int (*okfn)(struct sk_buff *))
+{
+ if ((*pskb)->imq_flags & IMQ_F_ENQUEUE)
+ return NF_QUEUE;
+
+ return NF_ACCEPT;
+}
+
+
+static int __init imq_init_hooks(void)
+{
+ int err;
+
+ err = nf_register_queue_handler(PF_INET, &nfqh);
+ if (err > 0)
+ goto err1;
+ if ((err = nf_register_hook(&imq_ingress_ipv4)))
+ goto err2;
+ if ((err = nf_register_hook(&imq_egress_ipv4)))
+ goto err3;
+#if defined(CONFIG_IPV6) || defined (CONFIG_IPV6_MODULE)
+ if ((err = nf_register_queue_handler(PF_INET6, &nfqh)))
+ goto err4;
+ if ((err = nf_register_hook(&imq_ingress_ipv6)))
+ goto err5;
+ if ((err = nf_register_hook(&imq_egress_ipv6)))
+ goto err6;
+#endif
+
+ return 0;
+
+#if defined(CONFIG_IPV6) || defined (CONFIG_IPV6_MODULE)
+err6:
+ nf_unregister_hook(&imq_ingress_ipv6);
+err5:
+ nf_unregister_queue_handler(PF_INET6);
+err4:
+ nf_unregister_hook(&imq_egress_ipv6);
+#endif
+err3:
+ nf_unregister_hook(&imq_ingress_ipv4);
+err2:
+ nf_unregister_queue_handler(PF_INET);
+err1:
+ return err;
+}
+
+static void __exit imq_unhook(void)
+{
+ nf_unregister_hook(&imq_ingress_ipv4);
+ nf_unregister_hook(&imq_egress_ipv4);
+ nf_unregister_queue_handler(PF_INET);
+#if defined(CONFIG_IPV6) || defined (CONFIG_IPV6_MODULE)
+ nf_unregister_hook(&imq_ingress_ipv6);
+ nf_unregister_hook(&imq_egress_ipv6);
+ nf_unregister_queue_handler(PF_INET6);
+#endif
+}
+
+static int __init imq_dev_init(struct net_device *dev)
+{
+ dev->hard_start_xmit = imq_dev_xmit;
+ dev->type = ARPHRD_VOID;
+ dev->mtu = 1500;
+ dev->tx_queue_len = 30;
+ dev->flags = IFF_NOARP;
+ dev->priv = kmalloc(sizeof(struct net_device_stats), GFP_KERNEL);
+ if (dev->priv == NULL)
+ return -ENOMEM;
+ memset(dev->priv, 0, sizeof(struct net_device_stats));
+ dev->get_stats = imq_get_stats;
+
+ return 0;
+}
+
+static void imq_dev_uninit(struct net_device *dev)
+{
+ kfree(dev->priv);
+}
+
+static int __init imq_init_devs(void)
+{
+ struct net_device *dev;
+ int i,j;
+ j = numdevs;
+
+ if (!numdevs || numdevs > IMQ_MAX_DEVS) {
+ printk(KERN_ERR "IMQ: numdevs has to be betweed 1 and %u\n",
+ IMQ_MAX_DEVS);
+ return -EINVAL;
+ }
+
+ imq_devs = kmalloc(sizeof(struct net_device) * numdevs, GFP_KERNEL);
+ if (!imq_devs)
+ return -ENOMEM;
+ memset(imq_devs, 0, sizeof(struct net_device) * numdevs);
+
+ /* we start counting at zero */
+ numdevs--;
+
+ for (i = 0, dev = imq_devs; i <= numdevs; i++, dev++) {
+ SET_MODULE_OWNER(dev);
+ strcpy(dev->name, "imq%d");
+ dev->init = imq_dev_init;
+ dev->uninit = imq_dev_uninit;
+
+ if (register_netdev(dev) < 0)
+ goto err_register;
+ }
+ printk(KERN_INFO "IMQ starting with %u devices...\n", j);
+ return 0;
+
+err_register:
+ for (; i; i--)
+ unregister_netdev(--dev);
+ kfree(imq_devs);
+ return -EIO;
+}
+
+static void imq_cleanup_devs(void)
+{
+ int i;
+ struct net_device *dev = imq_devs;
+
+ for (i = 0; i <= numdevs; i++)
+ unregister_netdev(dev++);
+
+ kfree(imq_devs);
+}
+
+static int __init imq_init_module(void)
+{
+ int err;
+
+ if ((err = imq_init_devs())) {
+ printk(KERN_ERR "IMQ: Error trying imq_init_devs()\n");
+ return err;
+ }
+ if ((err = imq_init_hooks())) {
+ printk(KERN_ERR "IMQ: Error trying imq_init_hooks()\n");
+ imq_cleanup_devs();
+ return err;
+ }
+
+ printk(KERN_INFO "IMQ driver loaded successfully.\n");
+
+#if defined(CONFIG_IMQ_BEHAVIOR_BA) || defined(CONFIG_IMQ_BEHAVIOR_BB)
+ printk(KERN_INFO "\tHooking IMQ before NAT on PREROUTING.\n");
+#else
+ printk(KERN_INFO "\tHooking IMQ after NAT on PREROUTING.\n");
+#endif
+#if defined(CONFIG_IMQ_BEHAVIOR_AB) || defined(CONFIG_IMQ_BEHAVIOR_BB)
+ printk(KERN_INFO "\tHooking IMQ before NAT on POSTROUTING.\n");
+#else
+ printk(KERN_INFO "\tHooking IMQ after NAT on POSTROUTING.\n");
+#endif
+
+ return 0;
+}
+
+static void __exit imq_cleanup_module(void)
+{
+ imq_unhook();
+ imq_cleanup_devs();
+ printk(KERN_INFO "IMQ driver unloaded successfully.\n");
+}
+
+
+module_init(imq_init_module);
+module_exit(imq_cleanup_module);
+
+module_param(numdevs, int, 0);
+MODULE_PARM_DESC(numdevs, "number of IMQ devices (how many imq* devices will be created)");
+MODULE_AUTHOR("http://www.linuximq.net");
+MODULE_DESCRIPTION("Pseudo-driver for the intermediate queue device. See http://www.linuximq.net/ for more information.");
+MODULE_LICENSE("GPL");
diff -Nru linux-2.6.16/include/linux/imq.h linux-2.6.16-imq/include/linux/imq.h
--- linux-2.6.16/include/linux/imq.h 1970-01-01 00:00:00.000000000 +0000
+++ linux-2.6.16-imq/include/linux/imq.h 2006-03-25 20:57:14.000000000 +0000
@@ -0,0 +1,9 @@
+#ifndef _IMQ_H
+#define _IMQ_H
+
+#define IMQ_MAX_DEVS 16
+
+#define IMQ_F_IFMASK 0x7f
+#define IMQ_F_ENQUEUE 0x80
+
+#endif /* _IMQ_H */
diff -Nru linux-2.6.16/include/linux/netfilter_ipv4/ipt_IMQ.h linux-2.6.16-imq/include/linux/netfilter_ipv4/ipt_IMQ.h
--- linux-2.6.16/include/linux/netfilter_ipv4/ipt_IMQ.h 1970-01-01 00:00:00.000000000 +0000
+++ linux-2.6.16-imq/include/linux/netfilter_ipv4/ipt_IMQ.h 2006-03-25 20:57:14.000000000 +0000
@@ -0,0 +1,8 @@
+#ifndef _IPT_IMQ_H
+#define _IPT_IMQ_H
+
+struct ipt_imq_info {
+ unsigned int todev; /* target imq device */
+};
+
+#endif /* _IPT_IMQ_H */
diff -Nru linux-2.6.16/include/linux/netfilter_ipv6/ip6t_IMQ.h linux-2.6.16-imq/include/linux/netfilter_ipv6/ip6t_IMQ.h
--- linux-2.6.16/include/linux/netfilter_ipv6/ip6t_IMQ.h 1970-01-01 00:00:00.000000000 +0000
+++ linux-2.6.16-imq/include/linux/netfilter_ipv6/ip6t_IMQ.h 2006-03-25 20:57:14.000000000 +0000
@@ -0,0 +1,8 @@
+#ifndef _IP6T_IMQ_H
+#define _IP6T_IMQ_H
+
+struct ip6t_imq_info {
+ unsigned int todev; /* target imq device */
+};
+
+#endif /* _IP6T_IMQ_H */
diff -Nru linux-2.6.16/include/linux/skbuff.h linux-2.6.16-imq/include/linux/skbuff.h
--- linux-2.6.16/include/linux/skbuff.h 2006-03-20 05:53:29.000000000 +0000
+++ linux-2.6.16-imq/include/linux/skbuff.h 2006-03-25 20:57:14.000000000 +0000
@@ -275,6 +275,10 @@
#if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE)
struct sk_buff *nfct_reasm;
#endif
+#if defined(CONFIG_IMQ) || defined(CONFIG_IMQ_MODULE)
+ unsigned char imq_flags;
+ struct nf_info *nf_info;
+#endif
#ifdef CONFIG_BRIDGE_NETFILTER
struct nf_bridge_info *nf_bridge;
#endif
diff -Nru linux-2.6.16/net/core/skbuff.c linux-2.6.16-imq/net/core/skbuff.c
--- linux-2.6.16/net/core/skbuff.c 2006-03-20 05:53:29.000000000 +0000
+++ linux-2.6.16-imq/net/core/skbuff.c 2006-03-25 20:57:14.000000000 +0000
@@ -425,6 +425,10 @@
C(nfct_reasm);
nf_conntrack_get_reasm(skb->nfct_reasm);
#endif
+#if defined(CONFIG_IMQ) || defined(CONFIG_IMQ_MODULE)
+ C(imq_flags);
+ C(nf_info);
+#endif /*CONFIG_IMQ*/
#ifdef CONFIG_BRIDGE_NETFILTER
C(nf_bridge);
nf_bridge_get(skb->nf_bridge);
@@ -489,6 +493,10 @@
#if defined(CONFIG_IP_VS) || defined(CONFIG_IP_VS_MODULE)
new->ipvs_property = old->ipvs_property;
#endif
+#if defined(CONFIG_IMQ) || defined(CONFIG_IMQ_MODULE)
+ new->imq_flags = old->imq_flags;
+ new->nf_info = old->nf_info;
+#endif /*CONFIG_IMQ*/
#ifdef CONFIG_BRIDGE_NETFILTER
new->nf_bridge = old->nf_bridge;
nf_bridge_get(old->nf_bridge);
diff -Nru linux-2.6.16/net/ipv4/netfilter/Kconfig linux-2.6.16-imq/net/ipv4/netfilter/Kconfig
--- linux-2.6.16/net/ipv4/netfilter/Kconfig 2006-03-20 05:53:29.000000000 +0000
+++ linux-2.6.16-imq/net/ipv4/netfilter/Kconfig 2006-03-25 21:54:10.000000000 +0000
@@ -505,6 +505,17 @@
To compile it as a module, choose M here. If unsure, say N.
+config IP_NF_TARGET_IMQ
+ tristate "IMQ target support"
+ depends on IP_NF_MANGLE
+ help
+ This option adds a `IMQ' target which is used to specify if and
+ to which IMQ device packets should get enqueued/dequeued.
+
+ For more information visit: http://www.linuximq.net/
+
+ To compile it as a module, choose M here. If unsure, say N.
+
config IP_NF_TARGET_TOS
tristate "TOS target support"
depends on IP_NF_MANGLE
diff -Nru linux-2.6.16/net/ipv4/netfilter/Makefile linux-2.6.16-imq/net/ipv4/netfilter/Makefile
--- linux-2.6.16/net/ipv4/netfilter/Makefile 2006-03-20 05:53:29.000000000 +0000
+++ linux-2.6.16-imq/net/ipv4/netfilter/Makefile 2006-03-25 21:06:00.000000000 +0000
@@ -64,6 +64,7 @@
obj-$(CONFIG_IP_NF_TARGET_TOS) += ipt_TOS.o
obj-$(CONFIG_IP_NF_TARGET_ECN) += ipt_ECN.o
obj-$(CONFIG_IP_NF_TARGET_DSCP) += ipt_DSCP.o
+obj-$(CONFIG_IP_NF_TARGET_IMQ) += ipt_IMQ.o
obj-$(CONFIG_IP_NF_TARGET_MASQUERADE) += ipt_MASQUERADE.o
obj-$(CONFIG_IP_NF_TARGET_REDIRECT) += ipt_REDIRECT.o
obj-$(CONFIG_IP_NF_TARGET_NETMAP) += ipt_NETMAP.o
diff -Nru linux-2.6.16/net/ipv4/netfilter/ipt_IMQ.c linux-2.6.16-imq/net/ipv4/netfilter/ipt_IMQ.c
--- linux-2.6.16/net/ipv4/netfilter/ipt_IMQ.c 1970-01-01 00:00:00.000000000 +0000
+++ linux-2.6.16-imq/net/ipv4/netfilter/ipt_IMQ.c 2006-03-25 20:57:14.000000000 +0000
@@ -0,0 +1,80 @@
+/*
+ * This target marks packets to be enqueued to an imq device
+ */
+#include <linux/module.h>
+#include <linux/skbuff.h>
+#include <linux/netfilter_ipv4/ip_tables.h>
+#include <linux/netfilter_ipv4/ipt_IMQ.h>
+#include <linux/imq.h>
+
+static unsigned int imq_target(struct sk_buff **pskb,
+ const struct net_device *in,
+ const struct net_device *out,
+ unsigned int hooknum,
+ const void *targinfo,
+ void *userdata)
+{
+ struct ipt_imq_info *mr = (struct ipt_imq_info*)targinfo;
+
+ (*pskb)->imq_flags = mr->todev | IMQ_F_ENQUEUE;
+
+ return IPT_CONTINUE;
+}
+
+static int imq_checkentry(const char *tablename,
+ const struct ipt_entry *e,
+ void *targinfo,
+ unsigned int targinfosize,
+ unsigned int hook_mask)
+{
+ struct ipt_imq_info *mr;
+
+ if (targinfosize != IPT_ALIGN(sizeof(struct ipt_imq_info))) {
+ printk(KERN_WARNING "IMQ: invalid targinfosize\n");
+ return 0;
+ }
+ mr = (struct ipt_imq_info*)targinfo;
+
+ if (strcmp(tablename, "mangle") != 0) {
+ printk(KERN_WARNING
+ "IMQ: IMQ can only be called from \"mangle\" table, not \"%s\"\n",
+ tablename);
+ return 0;
+ }
+
+ if (mr->todev > IMQ_MAX_DEVS) {
+ printk(KERN_WARNING
+ "IMQ: invalid device specified, highest is %u\n",
+ IMQ_MAX_DEVS);
+ return 0;
+ }
+
+ return 1;
+}
+
+static struct ipt_target ipt_imq_reg = {
+ .name = "IMQ",
+ .target = imq_target,
+ .checkentry = imq_checkentry,
+ .me = THIS_MODULE
+};
+
+static int __init init(void)
+{
+ if (ipt_register_target(&ipt_imq_reg))
+ return -EINVAL;
+
+ return 0;
+}
+
+static void __exit fini(void)
+{
+ ipt_unregister_target(&ipt_imq_reg);
+}
+
+module_init(init);
+module_exit(fini);
+
+MODULE_AUTHOR("http://www.linuximq.net");
+MODULE_DESCRIPTION("Pseudo-driver for the intermediate queue device. See http://www.linuximq.net/ for more information.");
+MODULE_LICENSE("GPL");
diff -Nru linux-2.6.16/net/ipv6/netfilter/Kconfig linux-2.6.16-imq/net/ipv6/netfilter/Kconfig
--- linux-2.6.16/net/ipv6/netfilter/Kconfig 2006-03-20 05:53:29.000000000 +0000
+++ linux-2.6.16-imq/net/ipv6/netfilter/Kconfig 2006-03-25 21:54:48.000000000 +0000
@@ -183,6 +183,15 @@
To compile it as a module, choose M here. If unsure, say N.
+config IP6_NF_TARGET_IMQ
+ tristate "IMQ target support"
+ depends on IP6_NF_MANGLE
+ help
+ This option adds a `IMQ' target which is used to specify if and
+ to which imq device packets should get enqueued/dequeued.
+
+ To compile it as a module, choose M here. If unsure, say N.
+
config IP6_NF_TARGET_HL
tristate 'HL (hoplimit) target support'
depends on IP6_NF_MANGLE
diff -Nru linux-2.6.16/net/ipv6/netfilter/Makefile linux-2.6.16-imq/net/ipv6/netfilter/Makefile
--- linux-2.6.16/net/ipv6/netfilter/Makefile 2006-03-20 05:53:29.000000000 +0000
+++ linux-2.6.16-imq/net/ipv6/netfilter/Makefile 2006-03-25 21:07:08.000000000 +0000
@@ -15,6 +15,7 @@
obj-$(CONFIG_IP6_NF_MATCH_OWNER) += ip6t_owner.o
obj-$(CONFIG_IP6_NF_FILTER) += ip6table_filter.o
obj-$(CONFIG_IP6_NF_MANGLE) += ip6table_mangle.o
+obj-$(CONFIG_IP6_NF_TARGET_IMQ) += ip6t_IMQ.o
obj-$(CONFIG_IP6_NF_TARGET_HL) += ip6t_HL.o
obj-$(CONFIG_IP6_NF_QUEUE) += ip6_queue.o
obj-$(CONFIG_IP6_NF_TARGET_LOG) += ip6t_LOG.o
diff -Nru linux-2.6.16/net/ipv6/netfilter/ip6t_IMQ.c linux-2.6.16-imq/net/ipv6/netfilter/ip6t_IMQ.c
--- linux-2.6.16/net/ipv6/netfilter/ip6t_IMQ.c 1970-01-01 00:00:00.000000000 +0000
+++ linux-2.6.16-imq/net/ipv6/netfilter/ip6t_IMQ.c 2006-03-25 20:57:14.000000000 +0000
@@ -0,0 +1,80 @@
+/*
+ * This target marks packets to be enqueued to an imq device
+ */
+#include <linux/module.h>
+#include <linux/skbuff.h>
+#include <linux/netfilter_ipv6/ip6_tables.h>
+#include <linux/netfilter_ipv6/ip6t_IMQ.h>
+#include <linux/imq.h>
+
+static unsigned int imq_target(struct sk_buff **pskb,
+ unsigned int hooknum,
+ const struct net_device *in,
+ const struct net_device *out,
+ const void *targinfo,
+ void *userdata)
+{
+ struct ip6t_imq_info *mr = (struct ip6t_imq_info*)targinfo;
+
+ (*pskb)->imq_flags = mr->todev | IMQ_F_ENQUEUE;
+
+ return IP6T_CONTINUE;
+}
+
+static int imq_checkentry(const char *tablename,
+ const struct ip6t_entry *e,
+ void *targinfo,
+ unsigned int targinfosize,
+ unsigned int hook_mask)
+{
+ struct ip6t_imq_info *mr;
+
+ if (targinfosize != IP6T_ALIGN(sizeof(struct ip6t_imq_info))) {
+ printk(KERN_WARNING "IMQ: invalid targinfosize\n");
+ return 0;
+ }
+ mr = (struct ip6t_imq_info*)targinfo;
+
+ if (strcmp(tablename, "mangle") != 0) {
+ printk(KERN_WARNING
+ "IMQ: IMQ can only be called from \"mangle\" table, not \"%s\"\n",
+ tablename);
+ return 0;
+ }
+
+ if (mr->todev > IMQ_MAX_DEVS) {
+ printk(KERN_WARNING
+ "IMQ: invalid device specified, highest is %u\n",
+ IMQ_MAX_DEVS);
+ return 0;
+ }
+
+ return 1;
+}
+
+static struct ip6t_target ip6t_imq_reg = {
+ .name = "IMQ",
+ .target = imq_target,
+ .checkentry = imq_checkentry,
+ .me = THIS_MODULE
+};
+
+static int __init init(void)
+{
+ if (ip6t_register_target(&ip6t_imq_reg))
+ return -EINVAL;
+
+ return 0;
+}
+
+static void __exit fini(void)
+{
+ ip6t_unregister_target(&ip6t_imq_reg);
+}
+
+module_init(init);
+module_exit(fini);
+
+MODULE_AUTHOR("http://www.linuximq.net");
+MODULE_DESCRIPTION("Pseudo-driver for the intermediate queue device. See http://www.linuximq.net/ for more information.");
+MODULE_LICENSE("GPL");
diff -Nru linux-2.6.16/net/sched/sch_generic.c linux-2.6.16-imq/net/sched/sch_generic.c
--- linux-2.6.16/net/sched/sch_generic.c 2006-03-20 05:53:29.000000000 +0000
+++ linux-2.6.16-imq/net/sched/sch_generic.c 2006-03-25 20:57:14.000000000 +0000
@@ -29,6 +29,9 @@
#include <linux/netdevice.h>
#include <linux/skbuff.h>
#include <linux/rtnetlink.h>
+#if defined(CONFIG_IMQ) || defined(CONFIG_IMQ_MODULE)
+#include <linux/imq.h>
+#endif
#include <linux/init.h>
#include <linux/rcupdate.h>
#include <linux/list.h>
@@ -136,7 +139,13 @@
if (!netif_queue_stopped(dev)) {
int ret;
- if (netdev_nit)
+
+ if (netdev_nit
+#if defined(CONFIG_IMQ) || defined(CONFIG_IMQ_MODULE)
+ && !(skb->imq_flags & IMQ_F_ENQUEUE)
+#endif
+ )
+
dev_queue_xmit_nit(skb, dev);
ret = dev->hard_start_xmit(skb, dev);

View File

@@ -0,0 +1,380 @@
Submitted by: Alexander E. Patrakov <patrakov@ums.usu.ru>
Signed-off-by: Alexander E. Patrakov <patrakov@ums.usu.ru>
Date: 2005-10-18
Initial Package Version: 2.6.15
Upstream Status: Rejected: they say it modifies the meaning of an existing ioctl
Origin: http://chris.heathens.co.nz/linux/downloads/patches-2.6.4-cdh1.tar.gz
Porting to linux-2.6.16 by Alexander E. Patrakov
Description: This patch fixes dead keys and copy/paste of non-ASCII characters
in UTF-8 mode on Linux console.
See more details about the original patch at:
http://chris.heathens.co.nz/linux/utf8.html
diff -ur linux-2.6.15-rc6.orig/drivers/char/consolemap.c linux-2.6.15-rc6.my/drivers/char/consolemap.c
--- linux-2.6.15-rc6.orig/drivers/char/consolemap.c 2005-12-25 10:00:12.000000000 +0500
+++ linux-2.6.15-rc6.my/drivers/char/consolemap.c 2005-12-25 10:01:22.000000000 +0500
@@ -178,6 +178,7 @@
unsigned long refcount;
unsigned long sum;
unsigned char *inverse_translations[4];
+ u16 *inverse_trans_unicode;
int readonly;
};
@@ -208,6 +209,41 @@
}
}
+static void set_inverse_trans_unicode(struct vc_data *conp,
+ struct uni_pagedir *p)
+{
+ int i, j, k, glyph;
+ u16 **p1, *p2;
+ u16 *q;
+
+ if (!p) return;
+ q = p->inverse_trans_unicode;
+ if (!q) {
+ q = p->inverse_trans_unicode =
+ kmalloc(MAX_GLYPH * sizeof(u16), GFP_KERNEL);
+ if (!q)
+ return;
+ }
+ memset(q, 0, MAX_GLYPH * sizeof(u16));
+
+ for (i = 0; i < 32; i++) {
+ p1 = p->uni_pgdir[i];
+ if (!p1)
+ continue;
+ for (j = 0; j < 32; j++) {
+ p2 = p1[j];
+ if (!p2)
+ continue;
+ for (k = 0; k < 64; k++) {
+ glyph = p2[k];
+ if (glyph >= 0 && glyph < MAX_GLYPH
+ && q[glyph] < 32)
+ q[glyph] = (i << 11) + (j << 6) + k;
+ }
+ }
+ }
+}
+
unsigned short *set_translate(int m, struct vc_data *vc)
{
inv_translate[vc->vc_num] = m;
@@ -218,19 +254,29 @@
* Inverse translation is impossible for several reasons:
* 1. The font<->character maps are not 1-1.
* 2. The text may have been written while a different translation map
- * was active, or using Unicode.
+ * was active.
* Still, it is now possible to a certain extent to cut and paste non-ASCII.
*/
-unsigned char inverse_translate(struct vc_data *conp, int glyph)
+u16 inverse_translate(struct vc_data *conp, int glyph, int use_unicode)
{
struct uni_pagedir *p;
+ int m;
if (glyph < 0 || glyph >= MAX_GLYPH)
return 0;
- else if (!(p = (struct uni_pagedir *)*conp->vc_uni_pagedir_loc) ||
- !p->inverse_translations[inv_translate[conp->vc_num]])
+ else if (!(p = (struct uni_pagedir *)*conp->vc_uni_pagedir_loc))
return glyph;
- else
- return p->inverse_translations[inv_translate[conp->vc_num]][glyph];
+ else if (use_unicode) {
+ if (!p->inverse_trans_unicode)
+ return glyph;
+ else
+ return p->inverse_trans_unicode[glyph];
+ } else {
+ m = inv_translate[conp->vc_num];
+ if (!p->inverse_translations[m])
+ return glyph;
+ else
+ return p->inverse_translations[m][glyph];
+ }
}
static void update_user_maps(void)
@@ -244,6 +290,7 @@
p = (struct uni_pagedir *)*vc_cons[i].d->vc_uni_pagedir_loc;
if (p && p != q) {
set_inverse_transl(vc_cons[i].d, p, USER_MAP);
+ set_inverse_trans_unicode(vc_cons[i].d, p);
q = p;
}
}
@@ -354,6 +401,10 @@
kfree(p->inverse_translations[i]);
p->inverse_translations[i] = NULL;
}
+ if (p->inverse_trans_unicode) {
+ kfree(p->inverse_trans_unicode);
+ p->inverse_trans_unicode = NULL;
+ }
}
void con_free_unimap(struct vc_data *vc)
@@ -512,6 +563,7 @@
for (i = 0; i <= 3; i++)
set_inverse_transl(vc, p, i); /* Update all inverse translations */
+ set_inverse_trans_unicode(vc, p);
return err;
}
@@ -562,6 +614,7 @@
for (i = 0; i <= 3; i++)
set_inverse_transl(vc, p, i); /* Update all inverse translations */
+ set_inverse_trans_unicode(vc, p);
dflt = p;
return err;
}
@@ -618,6 +671,19 @@
p->readonly = rdonly;
}
+/* may be called during an interrupt */
+u32 conv_8bit_to_uni(unsigned char c)
+{
+ /*
+ * Always use USER_MAP. This function is used by the keyboard,
+ * which shouldn't be affected by G0/G1 switching, etc.
+ * If the user map still contains default values, i.e. the
+ * direct-to-font mapping, then assume user is using Latin1.
+ */
+ unsigned short uni = translations[USER_MAP][c];
+ return uni == (0xf000 | c) ? c : uni;
+}
+
int
conv_uni_to_pc(struct vc_data *conp, long ucs)
{
diff -ur linux-2.6.15-rc6.orig/drivers/char/keyboard.c linux-2.6.15-rc6.my/drivers/char/keyboard.c
--- linux-2.6.15-rc6.orig/drivers/char/keyboard.c 2005-12-25 10:00:12.000000000 +0500
+++ linux-2.6.15-rc6.my/drivers/char/keyboard.c 2005-12-25 10:01:22.000000000 +0500
@@ -34,6 +34,7 @@
#include <linux/init.h>
#include <linux/slab.h>
+#include <linux/consolemap.h>
#include <linux/kbd_kern.h>
#include <linux/kbd_diacr.h>
#include <linux/vt_kern.h>
@@ -329,10 +330,9 @@
* Many other routines do put_queue, but I think either
* they produce ASCII, or they produce some user-assigned
* string, and in both cases we might assume that it is
- * in utf-8 already. UTF-8 is defined for words of up to 31 bits,
- * but we need only 16 bits here
+ * in utf-8 already.
*/
-static void to_utf8(struct vc_data *vc, ushort c)
+static void to_utf8(struct vc_data *vc, uint c)
{
if (c < 0x80)
/* 0******* */
@@ -341,14 +341,33 @@
/* 110***** 10****** */
put_queue(vc, 0xc0 | (c >> 6));
put_queue(vc, 0x80 | (c & 0x3f));
- } else {
+ } else if (c < 0x10000) {
+ if (c >= 0xD800 && c < 0xE000)
+ return;
+ if (c == 0xFFFF)
+ return;
/* 1110**** 10****** 10****** */
put_queue(vc, 0xe0 | (c >> 12));
put_queue(vc, 0x80 | ((c >> 6) & 0x3f));
put_queue(vc, 0x80 | (c & 0x3f));
+ } else if (c < 0x110000) {
+ /* 11110*** 10****** 10****** 10****** */
+ put_queue(vc, 0xf0 | (c >> 18));
+ put_queue(vc, 0x80 | ((c >> 12) & 0x3f));
+ put_queue(vc, 0x80 | ((c >> 6) & 0x3f));
+ put_queue(vc, 0x80 | (c & 0x3f));
}
}
+static void put_8bit(struct vc_data *vc, u8 c)
+{
+ if (kbd->kbdmode != VC_UNICODE || c < 32 || c == 127)
+ /* Don't translate control chars */
+ put_queue(vc, c);
+ else
+ to_utf8(vc, conv_8bit_to_uni(c));
+}
+
/*
* Called after returning from RAW mode or when changing consoles - recompute
* shift_down[] and shift_state from key_down[] maybe called when keymap is
@@ -409,7 +428,7 @@
if (ch == ' ' || ch == d)
return d;
- put_queue(vc, d);
+ put_8bit(vc, d);
return ch;
}
@@ -419,7 +438,7 @@
static void fn_enter(struct vc_data *vc, struct pt_regs *regs)
{
if (diacr) {
- put_queue(vc, diacr);
+ put_8bit(vc, diacr);
diacr = 0;
}
put_queue(vc, 13);
@@ -628,7 +647,7 @@
diacr = value;
return;
}
- put_queue(vc, value);
+ put_8bit(vc, value);
}
/*
@@ -774,7 +793,7 @@
/* kludge */
if (up_flag && shift_state != old_state && npadch != -1) {
if (kbd->kbdmode == VC_UNICODE)
- to_utf8(vc, npadch & 0xffff);
+ to_utf8(vc, npadch);
else
put_queue(vc, npadch & 0xff);
npadch = -1;
diff -ur linux-2.6.15-rc6.orig/drivers/char/selection.c linux-2.6.15-rc6.my/drivers/char/selection.c
--- linux-2.6.15-rc6.orig/drivers/char/selection.c 2005-12-25 10:00:12.000000000 +0500
+++ linux-2.6.15-rc6.my/drivers/char/selection.c 2005-12-25 10:01:22.000000000 +0500
@@ -20,6 +20,7 @@
#include <asm/uaccess.h>
+#include <linux/kbd_kern.h>
#include <linux/vt_kern.h>
#include <linux/consolemap.h>
#include <linux/selection.h>
@@ -34,6 +35,7 @@
/* Variables for selection control. */
/* Use a dynamic buffer, instead of static (Dec 1994) */
struct vc_data *sel_cons; /* must not be disallocated */
+static int use_unicode;
static volatile int sel_start = -1; /* cleared by clear_selection */
static int sel_end;
static int sel_buffer_lth;
@@ -54,10 +56,11 @@
complement_pos(sel_cons, where);
}
-static unsigned char
+static u16
sel_pos(int n)
{
- return inverse_translate(sel_cons, screen_glyph(sel_cons, n));
+ return inverse_translate(sel_cons, screen_glyph(sel_cons, n),
+ use_unicode);
}
/* remove the current selection highlight, if any,
@@ -86,8 +89,8 @@
0xFF7FFFFF /* latin-1 accented letters, not division sign */
};
-static inline int inword(const unsigned char c) {
- return ( inwordLut[c>>5] >> (c & 0x1F) ) & 1;
+static inline int inword(const u16 c) {
+ return c > 0xff || (( inwordLut[c>>5] >> (c & 0x1F) ) & 1);
}
/* set inwordLut contents. Invoked by ioctl(). */
@@ -108,13 +111,36 @@
return (v > u) ? u : v;
}
+/* stores the char in UTF8 and returns the number of bytes used (1-3) */
+int store_utf8(u16 c, char *p)
+{
+ if (c < 0x80) {
+ /* 0******* */
+ p[0] = c;
+ return 1;
+ } else if (c < 0x800) {
+ /* 110***** 10****** */
+ p[0] = 0xc0 | (c >> 6);
+ p[1] = 0x80 | (c & 0x3f);
+ return 2;
+ } else {
+ /* 1110**** 10****** 10****** */
+ p[0] = 0xe0 | (c >> 12);
+ p[1] = 0x80 | ((c >> 6) & 0x3f);
+ p[2] = 0x80 | (c & 0x3f);
+ return 3;
+ }
+}
+
/* set the current selection. Invoked by ioctl() or by kernel code. */
int set_selection(const struct tiocl_selection __user *sel, struct tty_struct *tty)
{
struct vc_data *vc = vc_cons[fg_console].d;
int sel_mode, new_sel_start, new_sel_end, spc;
char *bp, *obp;
- int i, ps, pe;
+ int i, ps, pe, multiplier;
+ u16 c;
+ struct kbd_struct *kbd = kbd_table + fg_console;
poke_blanked_console();
@@ -158,7 +184,8 @@
clear_selection();
sel_cons = vc_cons[fg_console].d;
}
-
+ use_unicode = kbd && kbd->kbdmode == VC_UNICODE;
+
switch (sel_mode)
{
case TIOCL_SELCHAR: /* character-by-character selection */
@@ -240,7 +267,8 @@
sel_end = new_sel_end;
/* Allocate a new buffer before freeing the old one ... */
- bp = kmalloc((sel_end-sel_start)/2+1, GFP_KERNEL);
+ multiplier = use_unicode ? 3 : 1; /* chars can take up to 3 bytes */
+ bp = kmalloc((sel_end-sel_start)/2*multiplier+1, GFP_KERNEL);
if (!bp) {
printk(KERN_WARNING "selection: kmalloc() failed\n");
clear_selection();
@@ -251,8 +279,12 @@
obp = bp;
for (i = sel_start; i <= sel_end; i += 2) {
- *bp = sel_pos(i);
- if (!isspace(*bp++))
+ c = sel_pos(i);
+ if (use_unicode)
+ bp += store_utf8(c, bp);
+ else
+ *bp++ = c;
+ if (!isspace(c))
obp = bp;
if (! ((i + 2) % vc->vc_size_row)) {
/* strip trailing blanks from line and add newline,
diff -ur linux-2.6.15-rc6.orig/include/linux/consolemap.h linux-2.6.15-rc6.my/include/linux/consolemap.h
--- linux-2.6.15-rc6.orig/include/linux/consolemap.h 2005-12-25 10:00:13.000000000 +0500
+++ linux-2.6.15-rc6.my/include/linux/consolemap.h 2005-12-25 10:01:22.000000000 +0500
@@ -10,6 +10,7 @@
struct vc_data;
-extern unsigned char inverse_translate(struct vc_data *conp, int glyph);
+extern u16 inverse_translate(struct vc_data *conp, int glyph, int use_unicode);
extern unsigned short *set_translate(int m, struct vc_data *vc);
extern int conv_uni_to_pc(struct vc_data *conp, long ucs);
+extern u32 conv_8bit_to_uni(unsigned char c);