[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: mol build



On Tue, Oct 31, 2000 at 03:31:28PM -0700, Bradley C. Midgley wrote:
> hi guys
> 
> i would like to see mol added to the available packages (or at least do a
> one-off proper package), so i started trying to build it from inside
> debian. a couple of notes:

packages certainly would be nice, i have to do all kinds of patching
to make the damn thing go into /usr/local where it belongs.  there is
more to life then .rpm sheesh....

> 1. i don't know what package provides /usr/include/net/sock.h et all for
> compiling the network (kernel) module -- my guess is it would be something
> like kernel-modules-dev; i can fudge this using the kernel source but i
> want to know how to do it right.

hmm i don't have such a file on my system and was able to compile
MOL.  the makefile does use the kernel headers in
/usr/src/linux/include (i have a /usr/src/linux symlink to
/usr/local/src/linux which is a link to /usr/local/src/linux-2.2.17.) 

i do however have to at least copy my .config back to the kenrel
source tree and run make oldconfig && make dep.  otherwise the mol
modules get miscompiled.

> 2. libelf is not explicitly linked into mol. i've sent a patch upstream
> but i don't know why it would work without -lelf under redhat. hmmph.

yup i don't know why this is still broken it *should* fail everywhere
but i suspect nobody actually compiles this bugger themselves.  adding
-lelf to the linker arguments in Rules.make seems to work fine... 

i enclosed a patch i made to fix things for my /usr/local setup, and
to fix the insecure permissions it insists on installing with, along
with fixing some insecure /tmp handling (not all of it im sure, i
think the program itself has insecure tmp handling too, have not
checked.)

i have not really refined my changes enough to send upstream yet, feel
free to improve.  

-- 
Ethan Benson
http://www.alaska.net/~erbenson/
diff -ur /var/tmp/mol-0.9.53/Makefile mol-0.9.53/Makefile
--- /var/tmp/mol-0.9.53/Makefile	Mon Oct 30 11:35:29 2000
+++ mol-0.9.53/Makefile	Mon Oct 30 23:36:10 2000
@@ -24,13 +24,13 @@
 
 # Install directories
 BUILD_ROOT	= 
-DOC_DIR		= $(BUILD_ROOT)/usr/doc/mol-$(VERS)
-BIN_DIR		= $(BUILD_ROOT)/usr/bin
+DOC_DIR		= $(BUILD_ROOT)/usr/local/share/doc/mol
+BIN_DIR		= $(BUILD_ROOT)/usr/local/bin
 ETC_DIR		= $(BUILD_ROOT)/etc
-LIB_DIR 	= $(BUILD_ROOT)/usr/lib/mol
+LIB_DIR 	= $(BUILD_ROOT)/usr/local/lib/mol
 DEV_DIR		= $(BUILD_ROOT)/dev
 #MAN_DIR	= /usr/local/man
-
+MAN_DIR                = $(BUILD_ROOT)/usr/local/man
 
 MM_DIRS		= debugger emulation drivers booter
 UTIL_DIRS	= $(addprefix util/, debug dv kunload nvs \
@@ -47,8 +47,8 @@
 		  $(MOL_LIB_DIR)/modules/System.map* lib/core
 CLEAN_DIRS	= include sinclude Doc scripts 
 
-INST_FILE	= install --mode=664
-INST_BIN	= install --mode=775
+INST_FILE	= install --mode=644
+INST_BIN	= install --mode=755
 
 # These lib directories are copied automatically upon intallation
 LIB_SUBS	= bin config drivers images modules oftrees \
@@ -107,11 +107,11 @@
 	@install -d $(LIB_DIR)/nvram
 	install --mode=644 $(MOL_LIB_DIR)/nvram/nvram.dist $(LIB_DIR)/nvram/nvram.nw
 	@$(RM) $(LIB_DIR)/config/vmodes
-	@chmod -R a+x $(LIB_DIR)/bin
+	@chmod -R u=rwx,go=rx $(LIB_DIR)/bin
 	@echo $(DOC_DIR)
 	@install -d $(DOC_DIR)
 	@cp -r Doc/* $(DOC_DIR)
-	@chmod -R a+rX,og+w,o-w $(DOC_DIR)
+	@chmod -R u+rwX,go=rX $(DOC_DIR)
 	@$(INST_FILE) COPYING CREDITS COPYRIGHT $(DOC_DIR)/
 	@install -d $(BIN_DIR)
 	@$(INST_BIN) -v startmol $(BIN_DIR)/startmol
@@ -121,13 +121,15 @@
 	@$(INST_BIN) -v booter/strip_nwrom/strip_nwrom $(BIN_DIR)/strip_nwrom
 	@strip $(LIB_DIR)/bin/mol
 	@install -d $(ETC_DIR)
-	@$(INST_FILE) -v Doc/molrc.sample $(ETC_DIR)/molrc
+	@if [ ! -f $(ETC_DIR)/molrc ] ; then $(INST_FILE) -v Doc/molrc.sample $(ETC_DIR)/molrc ; fi
 	@$(RM) $(LIB_DIR)/doc
 	@install -d $(DEV_DIR)
 	@$(RM) $(DEV_DIR)/sheep_net
-	@mknod $(DEV_DIR)/sheep_net c 10 198
-	chmod +s,go-rw $(LIB_DIR)/bin/mol
-	chmod +s,go-rw $(LIB_DIR)/bin/ismolpatched
+	@mknod -m 600 $(DEV_DIR)/sheep_net c 10 198
+	chown root.mol $(LIB_DIR)/bin/mol
+	chown root.mol $(LIB_DIR)/bin/ismolpatched
+	chmod 4754 $(LIB_DIR)/bin/mol
+	chmod 4754 $(LIB_DIR)/bin/ismolpatched
 	@echo +++ INSTALL COMPLETE +++
 
 
diff -ur /var/tmp/mol-0.9.53/Rules.make mol-0.9.53/Rules.make
--- /var/tmp/mol-0.9.53/Rules.make	Mon Oct 30 11:35:29 2000
+++ mol-0.9.53/Rules.make	Mon Oct 30 23:32:15 2000
@@ -115,7 +115,7 @@
 #
 ifdef P_TARGET
 $(P_TARGET): sub_dirs $(O_OBJS)
-	$(CC) $(LDFLAGS) $(LDFLAGS_EXTRA) $(LDFLAGS_TARGET1) -o $@ $(O_OBJS) $(STATIC_LIBS)
+	$(CC) $(LDFLAGS) $(LDFLAGS_EXTRA) $(LDFLAGS_TARGET1) -o $@ $(O_OBJS) $(STATIC_LIBS) -lelf
 	$(P_TARGET_HOOK)
 endif
 
diff -ur /var/tmp/mol-0.9.53/include/mol_config.h mol-0.9.53/include/mol_config.h
--- /var/tmp/mol-0.9.53/include/mol_config.h	Mon Oct 30 11:35:32 2000
+++ mol-0.9.53/include/mol_config.h	Mon Oct 30 23:32:15 2000
@@ -17,7 +17,7 @@
 #ifndef _H_MOL_CONFIG
 #define _H_MOL_CONFIG
 
-#define MOL_LIB_DIR	"/usr/lib/mol"
+#define MOL_LIB_DIR	"/usr/local/lib/mol"
 
 /* We use BSD signals... */
 
diff -ur /var/tmp/mol-0.9.53/kernel_module/runtime_patcher/molpatching mol-0.9.53/kernel_module/runtime_patcher/molpatching
--- /var/tmp/mol-0.9.53/kernel_module/runtime_patcher/molpatching	Mon Oct 30 10:27:52 2000
+++ mol-0.9.53/kernel_module/runtime_patcher/molpatching	Mon Oct 30 23:32:15 2000
@@ -14,7 +14,7 @@
     fi
 done
 if [ "$SYMF" == "" ] ; then
-    SYMF="/boot/System.map /usr/src/linux/System.map"
+    SYMF="/boot/System.map-`uname -r` /usr/src/linux/System.map"
     if [ -d "$MOL_LIB_DIR" ] ; then
 	SYMF="$SYMF $MOL_LIB_DIR/modules/System.map*"
     fi
@@ -36,8 +36,9 @@
 # The order is IMPORTANT - must equal the definition in runtime.h!
 SYMS=( giveup_fpu do_signal_ret flush_hash_page last_task_used_math next_mmu_context handle_mm_fault Hash Hash_mask )
 
-TMPFILE=/tmp/System.map_tmp
-rm -f $TMPFILE
+TMP=${TMPDIR-/tmp}
+TMPFILE=`mktemp -q "$TMP/System.map.XXXXXX"`
+rm -f "$TMPFILE"
 
 ####################################################################
 # patch_apply System.map
@@ -77,7 +78,7 @@
     if [ $RET -eq 0 -a "$MOL_LIB_DIR" != "" ] ; then 
 	cp $1 $MOL_LIB_DIR/modules/System.map.last
     fi
-    rm -f $TMPFILE
+    rm -f "$TMPFILE"
     exit $RET
 }
 
diff -ur /var/tmp/mol-0.9.53/lib/config/molrc.sys mol-0.9.53/lib/config/molrc.sys
--- /var/tmp/mol-0.9.53/lib/config/molrc.sys	Mon Oct 30 11:35:31 2000
+++ mol-0.9.53/lib/config/molrc.sys	Mon Oct 30 23:32:15 2000
@@ -10,7 +10,7 @@
 
 # All paths are relative the rootdir
 
-rootdir:	/usr/lib/mol
+rootdir:	/usr/local/lib/mol
 
 ####################################
 # Misc

Attachment: pgpM__kMMZr90.pgp
Description: PGP signature


Reply to: