Skip to contentSkip to conversation

Patch to make shbang scripts a configuration option

PATCH Mark Veltzer 1 participant 1 message Sep 13, 2002

Subsystems (10)
Documentation Arm (32-bit) VFS MIPS +6 more subsystems
lore
Share & tools
lore
#0 lore raw

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi!

This patch adds a tri state option in configuration so that kernels could be created without scripts support (shbang first line).

Why would you want that ? Embedded systems which only run a few binaries and would like to save a little RAM. The default is 'Y' and the configure.help states that you should put a 'Y' if unsure.

The patch is for 2.4.19.

This is my first patch to the kernel so please don't flame me too hard...

Any comments are welcome.

Mark
- --
Name: Mark Veltzer
Email: mailto:[email protected]
Homepage: http://www.veltzer.org
Get my public key at http://www.veltzer.org/ascx/public_key.asc
Add my public key using gpg --keyserver wwwkeys.pgp.net --recv-keys C71E5D38. -----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (GNU/Linux)
Comment: For info see http://www.gnupg.org

iD8DBQE9gU0hxlxDIcceXTgRAhZYAJ9/L70P9jwiRu3+RkwiB0xsq6YW9wCg1GZ3 Sw8qCaI5zFyu8yRGrNi/WJo=
=Ia4L
-----END PGP SIGNATURE-----

Documentation/Configure.help +9 -0
diff -urN linux-2.4.19/Documentation/Configure.help linux-2.4.19-shbang/Documentation/Configure.help
@@ -3813,6 +3813,15 @@
   Not necessary unless you're using a very out-of-date binutils
   version.  You probably want KCORE_ELF.
 
+Kernel support for Shbang scripts
+CONFIG_BINFMT_SHBANG
+  Shbang scripts are text files which have a "#![interpreter]" prefix
+  and which can be run by the kernel. Most systems need this type of
+  support since a lot of the system is made up of these types of
+  scripts. Say N here only if you are making a very weird type of
+  system (embedded perhaps) and you are sure that your system doesnt
+  have any shbang script. If unsure - say Y here.
+
 Kernel support for ELF binaries
 CONFIG_BINFMT_ELF
   ELF (Executable and Linkable Format) is a format for libraries and
arch/alpha/config.in +1 -0
diff -urN linux-2.4.19/arch/alpha/config.in linux-2.4.19-shbang/arch/alpha/config.in
@@ -288,6 +288,7 @@
 fi
 
 tristate 'Kernel support for ELF binaries' CONFIG_BINFMT_ELF
+tristate 'Kernel support for SHBANG binaries' CONFIG_BINFMT_SHBANG
 tristate 'Kernel support for MISC binaries' CONFIG_BINFMT_MISC
 tristate 'Kernel support for Linux/Intel ELF binaries' CONFIG_BINFMT_EM86
 source drivers/parport/Config.in
arch/alpha/defconfig +1 -0
diff -urN linux-2.4.19/arch/alpha/defconfig linux-2.4.19-shbang/arch/alpha/defconfig
@@ -71,6 +71,7 @@
 # CONFIG_KCORE_AOUT is not set
 # CONFIG_BINFMT_AOUT is not set
 CONFIG_BINFMT_ELF=y
+CONFIG_BINFMT_SHBANG=y
 # CONFIG_BINFMT_MISC is not set
 # CONFIG_BINFMT_EM86 is not set
 
arch/arm/config.in +1 -0
diff -urN linux-2.4.19/arch/arm/config.in linux-2.4.19-shbang/arch/arm/config.in
@@ -435,6 +435,7 @@
 	 A.OUT		CONFIG_KCORE_AOUT" ELF
 tristate 'Kernel support for a.out binaries' CONFIG_BINFMT_AOUT
 tristate 'Kernel support for ELF binaries' CONFIG_BINFMT_ELF
+tristate 'Kernel support for SHBANG binaries' CONFIG_BINFMT_SHBANG
 tristate 'Kernel support for MISC binaries' CONFIG_BINFMT_MISC
 dep_bool 'Power Management support (experimental)' CONFIG_PM $CONFIG_EXPERIMENTAL
 dep_tristate 'RISC OS personality' CONFIG_ARTHUR $CONFIG_CPU_32
arch/arm/defconfig +1 -0
diff -urN linux-2.4.19/arch/arm/defconfig linux-2.4.19-shbang/arch/arm/defconfig
@@ -85,6 +85,7 @@
 # CONFIG_KCORE_AOUT is not set
 CONFIG_BINFMT_AOUT=y
 CONFIG_BINFMT_ELF=y
+CONFIG_BINFMT_SHBANG=y
 # CONFIG_BINFMT_MISC is not set
 # CONFIG_PM is not set
 # CONFIG_ARTHUR is not set
arch/cris/config.in +1 -0
diff -urN linux-2.4.19/arch/cris/config.in linux-2.4.19-shbang/arch/cris/config.in
@@ -31,6 +31,7 @@
 bool 'Sysctl support' CONFIG_SYSCTL
 
 tristate 'Kernel support for ELF binaries' CONFIG_BINFMT_ELF
+tristate 'Kernel support for SHBANG binaries' CONFIG_BINFMT_SHBANG
 
 bool 'Use kernel gdb debugger' CONFIG_ETRAX_KGDB
 
arch/cris/defconfig +1 -0
diff -urN linux-2.4.19/arch/cris/defconfig linux-2.4.19-shbang/arch/cris/defconfig
@@ -18,6 +18,7 @@
 # CONFIG_BSD_PROCESS_ACCT is not set
 # CONFIG_SYSCTL is not set
 CONFIG_BINFMT_ELF=y
+CONFIG_BINFMT_SHBANG=y
 # CONFIG_ETRAX_KGDB is not set
 # CONFIG_ETRAX_WATCHDOG is not set
 
arch/i386/config.in +1 -0
diff -urN linux-2.4.19/arch/i386/config.in linux-2.4.19-shbang/arch/i386/config.in
@@ -268,6 +268,7 @@
 fi
 tristate 'Kernel support for a.out binaries' CONFIG_BINFMT_AOUT
 tristate 'Kernel support for ELF binaries' CONFIG_BINFMT_ELF
+tristate 'Kernel support for SHBANG binaries' CONFIG_BINFMT_SHBANG
 tristate 'Kernel support for MISC binaries' CONFIG_BINFMT_MISC
 
 bool 'Power Management support' CONFIG_PM
arch/i386/defconfig +1 -0
diff -urN linux-2.4.19/arch/i386/defconfig linux-2.4.19-shbang/arch/i386/defconfig
@@ -107,6 +107,7 @@
 CONFIG_BINFMT_AOUT=y
 CONFIG_BINFMT_ELF=y
 CONFIG_BINFMT_MISC=y
+CONFIG_BINFMT_SHBANG=y
 CONFIG_PM=y
 # CONFIG_APM is not set
 
arch/ia64/config.in +1 -0
diff -urN linux-2.4.19/arch/ia64/config.in linux-2.4.19-shbang/arch/ia64/config.in
@@ -104,6 +104,7 @@
 bool 'BSD Process Accounting' CONFIG_BSD_PROCESS_ACCT
 bool 'Sysctl support' CONFIG_SYSCTL
 tristate 'Kernel support for ELF binaries' CONFIG_BINFMT_ELF
+tristate 'Kernel support for SHBANG binaries' CONFIG_BINFMT_SHBANG
 tristate 'Kernel support for MISC binaries' CONFIG_BINFMT_MISC
 
 if [ "$CONFIG_IA64_HP_SIM" = "n" ]; then
arch/ia64/defconfig +1 -0
diff -urN linux-2.4.19/arch/ia64/defconfig linux-2.4.19-shbang/arch/ia64/defconfig
@@ -55,6 +55,7 @@
 # CONFIG_BSD_PROCESS_ACCT is not set
 CONFIG_SYSCTL=y
 CONFIG_BINFMT_ELF=y
+CONFIG_BINFMT_SHBANG=y
 # CONFIG_BINFMT_MISC is not set
 # CONFIG_ACPI_DEBUG is not set
 # CONFIG_ACPI_BUSMGR is not set
arch/m68k/config.in +1 -0
diff -urN linux-2.4.19/arch/m68k/config.in linux-2.4.19-shbang/arch/m68k/config.in
@@ -99,6 +99,7 @@
 fi
 tristate 'Kernel support for a.out binaries' CONFIG_BINFMT_AOUT
 tristate 'Kernel support for ELF binaries' CONFIG_BINFMT_ELF
+tristate 'Kernel support for SHBANG binaries' CONFIG_BINFMT_SHBANG
 tristate 'Kernel support for MISC binaries' CONFIG_BINFMT_MISC
 
 if [ "$CONFIG_AMIGA" = "y" ]; then
arch/m68k/defconfig +1 -0
diff -urN linux-2.4.19/arch/m68k/defconfig linux-2.4.19-shbang/arch/m68k/defconfig
@@ -46,6 +46,7 @@
 # CONFIG_KCORE_AOUT is not set
 CONFIG_BINFMT_AOUT=y
 CONFIG_BINFMT_ELF=y
+CONFIG_BINFMT_SHBANG=y
 # CONFIG_BINFMT_MISC is not set
 CONFIG_ZORRO=y
 # CONFIG_AMIGA_PCMCIA is not set
arch/mips/config.in +1 -0
diff -urN linux-2.4.19/arch/mips/config.in linux-2.4.19-shbang/arch/mips/config.in
@@ -458,6 +458,7 @@
 define_bool CONFIG_BINFMT_AOUT n
 define_bool CONFIG_BINFMT_ELF y
 tristate 'Kernel support for MISC binaries' CONFIG_BINFMT_MISC
+tristate 'Kernel support for SHBANG binaries' CONFIG_BINFMT_SHBANG
 
 dep_bool 'Power Management support (EXPERIMENTAL)' CONFIG_PM $CONFIG_EXPERIMENTAL $CONFIG_MIPS_AU1000
 endmenu
arch/mips/defconfig +1 -0
diff -urN linux-2.4.19/arch/mips/defconfig linux-2.4.19-shbang/arch/mips/defconfig
@@ -106,6 +106,7 @@
 # CONFIG_KCORE_AOUT is not set
 # CONFIG_BINFMT_AOUT is not set
 CONFIG_BINFMT_ELF=y
+CONFIG_BINFMT_SHBANG=y
 # CONFIG_BINFMT_MISC is not set
 # CONFIG_PM is not set
 
arch/mips64/config.in +1 -0
diff -urN linux-2.4.19/arch/mips64/config.in linux-2.4.19-shbang/arch/mips64/config.in
@@ -183,6 +183,7 @@
 define_bool CONFIG_KCORE_ELF y
 define_bool CONFIG_KCORE_AOUT n
 tristate 'Kernel support for 64-bit ELF binaries' CONFIG_BINFMT_ELF
+tristate 'Kernel support for SHBANG binaries' CONFIG_BINFMT_SHBANG
 bool 'Kernel support for Linux/MIPS 32-bit binary compatibility' CONFIG_MIPS32_COMPAT
 define_bool CONFIG_BINFMT_ELF32 $CONFIG_MIPS32_COMPAT
 tristate 'Kernel support for MISC binaries' CONFIG_BINFMT_MISC
arch/mips64/defconfig +1 -0
diff -urN linux-2.4.19/arch/mips64/defconfig linux-2.4.19-shbang/arch/mips64/defconfig
@@ -72,6 +72,7 @@
 CONFIG_KCORE_ELF=y
 # CONFIG_KCORE_AOUT is not set
 CONFIG_BINFMT_ELF=y
+CONFIG_BINFMT_SHBANG=y
 CONFIG_MIPS32_COMPAT=y
 CONFIG_BINFMT_ELF32=y
 # CONFIG_BINFMT_MISC is not set
arch/parisc/config.in +1 -0
diff -urN linux-2.4.19/arch/parisc/config.in linux-2.4.19-shbang/arch/parisc/config.in
@@ -67,6 +67,7 @@
 bool 'Sysctl support' CONFIG_SYSCTL
 tristate 'Kernel support for SOM binaries' CONFIG_BINFMT_SOM
 tristate 'Kernel support for ELF binaries' CONFIG_BINFMT_ELF
+tristate 'Kernel support for SHBANG binaries' CONFIG_BINFMT_SHBANG
 tristate 'Kernel support for MISC binaries' CONFIG_BINFMT_MISC
 if [ "$CONFIG_EXPERIMENTAL" = "y" ]; then
   tristate 'Kernel support for JAVA binaries (obsolete)' CONFIG_BINFMT_JAVA
arch/parisc/defconfig +1 -0
diff -urN linux-2.4.19/arch/parisc/defconfig linux-2.4.19-shbang/arch/parisc/defconfig
@@ -39,6 +39,7 @@
 CONFIG_SYSCTL=y
 CONFIG_BINFMT_SOM=y
 CONFIG_BINFMT_ELF=y
+CONFIG_BINFMT_SHBANG=y
 # CONFIG_BINFMT_MISC is not set
 # CONFIG_BINFMT_JAVA is not set
 
arch/ppc/config.in +1 -0
diff -urN linux-2.4.19/arch/ppc/config.in linux-2.4.19-shbang/arch/ppc/config.in
@@ -167,6 +167,7 @@
 define_bool CONFIG_BINFMT_ELF y
 define_bool CONFIG_KERNEL_ELF y
 tristate 'Kernel support for MISC binaries' CONFIG_BINFMT_MISC
+tristate 'Kernel support for SHBANG binaries' CONFIG_BINFMT_SHBANG
 
 source drivers/pci/Config.in
 
arch/ppc/defconfig +1 -0
diff -urN linux-2.4.19/arch/ppc/defconfig linux-2.4.19-shbang/arch/ppc/defconfig
@@ -54,6 +54,7 @@
 # CONFIG_BSD_PROCESS_ACCT is not set
 CONFIG_KCORE_ELF=y
 CONFIG_BINFMT_ELF=y
+CONFIG_BINFMT_SHBANG=y
 CONFIG_KERNEL_ELF=y
 CONFIG_BINFMT_MISC=m
 CONFIG_PCI_NAMES=y
arch/ppc64/config.in +1 -0
diff -urN linux-2.4.19/arch/ppc64/config.in linux-2.4.19-shbang/arch/ppc64/config.in
@@ -71,6 +71,7 @@
 fi
 
 bool 'Kernel Support for 64 bit ELF binaries' CONFIG_BINFMT_ELF
+tristate 'Kernel support for SHBANG binaries' CONFIG_BINFMT_SHBANG
 
 tristate 'Kernel support for 32 bit binaries' CONFIG_BINFMT_ELF32
 
arch/ppc64/defconfig +1 -0
diff -urN linux-2.4.19/arch/ppc64/defconfig linux-2.4.19-shbang/arch/ppc64/defconfig
@@ -47,6 +47,7 @@
 # CONFIG_BSD_PROCESS_ACCT is not set
 CONFIG_KCORE_ELF=y
 CONFIG_BINFMT_ELF=y
+CONFIG_BINFMT_SHBANG=y
 CONFIG_BINFMT_ELF32=y
 # CONFIG_BINFMT_MISC is not set
 CONFIG_PCI_NAMES=y
arch/s390/config.in +1 -0
diff -urN linux-2.4.19/arch/s390/config.in linux-2.4.19-shbang/arch/s390/config.in
@@ -51,6 +51,7 @@
 bool 'Sysctl support' CONFIG_SYSCTL
 define_bool CONFIG_KCORE_ELF y
 tristate 'Kernel support for ELF binaries' CONFIG_BINFMT_ELF
+tristate 'Kernel support for SHBANG binaries' CONFIG_BINFMT_SHBANG
 tristate 'Kernel support for MISC binaries' CONFIG_BINFMT_MISC
 bool 'Show crashed user process info' CONFIG_PROCESS_DEBUG
 bool 'Pseudo page fault support' CONFIG_PFAULT
arch/s390/defconfig +1 -0
diff -urN linux-2.4.19/arch/s390/defconfig linux-2.4.19-shbang/arch/s390/defconfig
@@ -41,6 +41,7 @@
 CONFIG_SYSCTL=y
 CONFIG_KCORE_ELF=y
 CONFIG_BINFMT_ELF=y
+CONFIG_BINFMT_SHBANG=y
 # CONFIG_BINFMT_MISC is not set
 # CONFIG_PROCESS_DEBUG is not set
 CONFIG_PFAULT=y
arch/s390x/config.in +1 -0
diff -urN linux-2.4.19/arch/s390x/config.in linux-2.4.19-shbang/arch/s390x/config.in
@@ -52,6 +52,7 @@
 bool 'Sysctl support' CONFIG_SYSCTL
 define_bool CONFIG_KCORE_ELF y
 tristate 'Kernel support for ELF binaries' CONFIG_BINFMT_ELF
+tristate 'Kernel support for SHBANG binaries' CONFIG_BINFMT_SHBANG
 tristate 'Kernel support for MISC binaries' CONFIG_BINFMT_MISC
 bool 'Show crashed user process info' CONFIG_PROCESS_DEBUG
 bool 'Pseudo page fault support' CONFIG_PFAULT
arch/s390x/defconfig +1 -0
diff -urN linux-2.4.19/arch/s390x/defconfig linux-2.4.19-shbang/arch/s390x/defconfig
@@ -42,6 +42,7 @@
 CONFIG_SYSCTL=y
 CONFIG_KCORE_ELF=y
 CONFIG_BINFMT_ELF=y
+CONFIG_BINFMT_SHBANG=y
 # CONFIG_BINFMT_MISC is not set
 # CONFIG_PROCESS_DEBUG is not set
 CONFIG_PFAULT=y
arch/sh/config.in +1 -0
diff -urN linux-2.4.19/arch/sh/config.in linux-2.4.19-shbang/arch/sh/config.in
@@ -211,6 +211,7 @@
 	 A.OUT		CONFIG_KCORE_AOUT" ELF
 fi
 tristate 'Kernel support for ELF binaries' CONFIG_BINFMT_ELF
+tristate 'Kernel support for SHBANG binaries' CONFIG_BINFMT_SHBANG
 tristate 'Kernel support for MISC binaries' CONFIG_BINFMT_MISC
 
 source drivers/parport/Config.in
arch/sh/defconfig +1 -0
diff -urN linux-2.4.19/arch/sh/defconfig linux-2.4.19-shbang/arch/sh/defconfig
@@ -48,6 +48,7 @@
 CONFIG_KCORE_ELF=y
 # CONFIG_KCORE_AOUT is not set
 CONFIG_BINFMT_ELF=y
+CONFIG_BINFMT_SHBANG=y
 # CONFIG_BINFMT_MISC is not set
 
 #
arch/sparc/config.in +1 -0
diff -urN linux-2.4.19/arch/sparc/config.in linux-2.4.19-shbang/arch/sparc/config.in
@@ -70,6 +70,7 @@
 fi
 tristate 'Kernel support for a.out binaries' CONFIG_BINFMT_AOUT
 tristate 'Kernel support for ELF binaries' CONFIG_BINFMT_ELF
+tristate 'Kernel support for SHBANG binaries' CONFIG_BINFMT_SHBANG
 tristate 'Kernel support for MISC binaries' CONFIG_BINFMT_MISC
 bool 'SunOS binary emulation' CONFIG_SUNOS_EMUL
 source drivers/parport/Config.in
arch/sparc/defconfig +1 -0
diff -urN linux-2.4.19/arch/sparc/defconfig linux-2.4.19-shbang/arch/sparc/defconfig
@@ -51,6 +51,7 @@
 CONFIG_KCORE_ELF=y
 CONFIG_BINFMT_AOUT=y
 CONFIG_BINFMT_ELF=y
+CONFIG_BINFMT_SHBANG=y
 CONFIG_BINFMT_MISC=m
 CONFIG_SUNOS_EMUL=y
 
arch/sparc64/config.in +1 -0
diff -urN linux-2.4.19/arch/sparc64/config.in linux-2.4.19-shbang/arch/sparc64/config.in
@@ -73,6 +73,7 @@
    bool '  Kernel support for 32-bit (ie. SunOS) a.out binaries' CONFIG_BINFMT_AOUT32
 fi
 tristate 'Kernel support for 64-bit ELF binaries' CONFIG_BINFMT_ELF
+tristate 'Kernel support for SHBANG binaries' CONFIG_BINFMT_SHBANG
 tristate 'Kernel support for MISC binaries' CONFIG_BINFMT_MISC
 bool 'SunOS binary emulation' CONFIG_SUNOS_EMUL
 if [ "$CONFIG_EXPERIMENTAL" = "y" ]; then
arch/sparc64/defconfig +1 -0
diff -urN linux-2.4.19/arch/sparc64/defconfig linux-2.4.19-shbang/arch/sparc64/defconfig
@@ -55,6 +55,7 @@
 CONFIG_BINFMT_ELF32=y
 # CONFIG_BINFMT_AOUT32 is not set
 CONFIG_BINFMT_ELF=y
+CONFIG_BINFMT_SHBANG=y
 CONFIG_BINFMT_MISC=m
 # CONFIG_SUNOS_EMUL is not set
 CONFIG_SOLARIS_EMUL=m
fs/Makefile +1 -2
diff -urN linux-2.4.19/fs/Makefile linux-2.4.19-shbang/fs/Makefile
@@ -73,8 +73,7 @@
 obj-$(CONFIG_BINFMT_EM86)	+= binfmt_em86.o
 obj-$(CONFIG_BINFMT_MISC)	+= binfmt_misc.o
 
-# binfmt_script is always there
-obj-y				+= binfmt_script.o
+obj-$(CONFIG_BINFMT_SHBNAG)	+= binfmt_script.o
 
 obj-$(CONFIG_BINFMT_ELF)	+= binfmt_elf.o