Skip to contentSkip to conversation

Support for SRM environment variables through procfs

PATCH New Jan-Benedict Glaw 1 participant 1 message Jun 18, 2001

Subsystems (3)
lore
Share & tools
lore

Jan-Benedict Glaw

author maintainer
#0 lore raw

PATCH 1/1 Support for SRM environment variables through procfs

Hi!

I've found a patch on Compaq's Jumpstart-CD which provides access to SRM'S environment variables. I've ported that patch to 2.4.x and here's the patch. Please test it. However, I've not got an Alpha system booting via SRM handy so this patch is untested:-(

MfG, JBG

Signature · 4 lines
Fehler eingestehen, Größe zeigen: Nehmt die Rechtschreibreform zurück!!!
/* Jan-Benedict Glaw <[email protected]> -- +49-172-7608481 */
keyID=0x8399E1BB fingerprint=250D 3BCF 7127 0D8C A444 A961 1DBD 5E75 8399 E1BB
     "insmod vi.o and there we go..." (Alexander Viro on linux-kernel)
Documentation/Configure.help +10 -0
diff -Nur linux-2.4.6-pre1/Documentation/Configure.help linux-2.4.6-pre1-srm/Documentation/Configure.help
@@ -17311,6 +17311,16 @@
 
   If you're not sure, say N.
 
+SRM environment variables in procfs
+CONFIG_SRM_ENV
+  If you enable this option, a subdirectory called srm_environment
+  will give you access to the most important SRM environment
+  variables. If you've got an Alpha style system supporting
+  SRC, then it is a good idea to say Yes or Module to this driver.
+
+  This driver is also available as a module and will be called
+  srm_env.o if you build it as a module.
+  
 Footbridge internal watchdog
 CONFIG_21285_WATCHDOG
   The Intel Footbridge chip contains a builtin watchdog circuit. Say Y 
arch/alpha/config.in +5 -1
diff -Nur linux-2.4.6-pre1/arch/alpha/config.in linux-2.4.6-pre1-srm/arch/alpha/config.in
@@ -179,7 +179,7 @@
 	-o "$CONFIG_ALPHA_TAKARA" = "y" -o "$CONFIG_ALPHA_EB164" = "y" \
 	-o "$CONFIG_ALPHA_ALCOR" = "y"  -o "$CONFIG_ALPHA_MIATA" = "y" \
 	-o "$CONFIG_ALPHA_LX164" = "y"  -o "$CONFIG_ALPHA_SX164" = "y" \
-	-o "$CONFIG_ALPHA_NAUTILUS" = "y" ]
+	-o "$CONFIG_ALPHA_NAUTILUS" = "y" -o "$CONFIG_ALPHA_NONAME" = "y" ]
 then
   bool 'Use SRM as bootloader' CONFIG_ALPHA_SRM
 fi
@@ -235,6 +235,10 @@
 	"ELF		CONFIG_KCORE_ELF	\
 	 A.OUT		CONFIG_KCORE_AOUT" ELF
 fi
+if [ "$CONFIG_PROC_FS" != "n" -a CONFIG_ALPHA_SRM = "y" ]; then
+   tristate 'SRM environment through procfs' CONFIG_SRM_ENV
+fi
+ 
 tristate 'Kernel support for a.out (ECOFF) binaries' CONFIG_BINFMT_AOUT
 tristate 'Kernel support for ELF binaries' CONFIG_BINFMT_ELF
 tristate 'Kernel support for MISC binaries' CONFIG_BINFMT_MISC
arch/alpha/kernel/Makefile +1 -0
diff -Nur linux-2.4.6-pre1/arch/alpha/kernel/Makefile linux-2.4.6-pre1-srm/arch/alpha/kernel/Makefile
@@ -32,6 +32,7 @@
 
 obj-$(CONFIG_SMP)    += smp.o irq_smp.o
 obj-$(CONFIG_PCI)    += pci.o pci_iommu.o
+obj-$(CONFIG_SRM_ENV)	+= srm_env.o
 
 ifdef CONFIG_ALPHA_GENERIC
 
arch/alpha/kernel/alpha_ksyms.c +6 -0
diff -Nur linux-2.4.6-pre1/arch/alpha/kernel/alpha_ksyms.c linux-2.4.6-pre1-srm/arch/alpha/kernel/alpha_ksyms.c
@@ -18,6 +18,7 @@
 #include <linux/mm.h>
 
 #include <asm/io.h>
+#include <asm/console.h>
 #include <asm/hwrpb.h>
 #include <asm/uaccess.h>
 #include <asm/processor.h>
@@ -56,6 +57,11 @@
 EXPORT_SYMBOL(probe_irq_mask);
 EXPORT_SYMBOL(screen_info);
 EXPORT_SYMBOL(perf_irq);
+#ifdef CONFIG_ALPHA_SRM
+EXPORT_SYMBOL(callback_getenv);
+EXPORT_SYMBOL(callback_setenv);
+EXPORT_SYMBOL(callback_save_env);
+#endif /* CONFIG_ALPHA_SRM */
 
 /* platform dependent support */
 EXPORT_SYMBOL(_inb);
arch/alpha/kernel/srm_env.c +219 -0

219 lines not on this page · raw message

include/asm-alpha/console.h +4 -2
diff -Nur linux-2.4.6-pre1/include/asm-alpha/console.h linux-2.4.6-pre1-srm/include/asm-alpha/console.h
@@ -22,8 +22,8 @@
 #define CCB_GET_ENV		0x22
 #define CCB_SAVE_ENV		0x23
 
-#define CCB_PSWITCH            0x30
-#define CCB_BIOS_EMUL          0x32
+#define CCB_PSWITCH		0x30
+#define CCB_BIOS_EMUL		0x32
 
 /*
  * Environment variable numbers
@@ -51,6 +51,8 @@
 extern long callback_close(long unit);
 extern long callback_read(long channel, long count, const char *buf, long lbn);
 extern long callback_getenv(long id, const char *buf, unsigned long buf_size);
+extern long callback_setenv(long id, const char *buf, unsigned long buf_size);
+extern long callback_save_env(void);
 
 extern int srm_fixup(unsigned long new_callback_addr,
 		     unsigned long new_hwrpb_addr);