summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>2005-01-31 16:56:57 +0000
committerPascal Rigaux <pixel@mandriva.com>2005-01-31 16:56:57 +0000
commit6f4b6b015034ab57532ff2bf82e07f9d717dbd66 (patch)
tree1959cfc8ca47a8c2c44e8b5f5367f1acadf6c783
parent044a25c662ce8d32dca7395dd1353b1c0b9346d7 (diff)
downloaddrakx-6f4b6b015034ab57532ff2bf82e07f9d717dbd66.tar
drakx-6f4b6b015034ab57532ff2bf82e07f9d717dbd66.tar.gz
drakx-6f4b6b015034ab57532ff2bf82e07f9d717dbd66.tar.bz2
drakx-6f4b6b015034ab57532ff2bf82e07f9d717dbd66.tar.xz
drakx-6f4b6b015034ab57532ff2bf82e07f9d717dbd66.zip
add a dhcp-client built using mdk-stage1 code
-rw-r--r--mdk-stage1/.cvsignore1
-rw-r--r--mdk-stage1/Makefile22
-rw-r--r--mdk-stage1/modules.c9
-rw-r--r--mdk-stage1/network.c2
-rw-r--r--mdk-stage1/network.h1
-rw-r--r--mdk-stage1/newt-frontend.c6
-rw-r--r--mdk-stage1/stage1.c13
-rwxr-xr-xrescue/make_rescue_img3
8 files changed, 48 insertions, 9 deletions
diff --git a/mdk-stage1/.cvsignore b/mdk-stage1/.cvsignore
index 46b9c94a0..28f91e89f 100644
--- a/mdk-stage1/.cvsignore
+++ b/mdk-stage1/.cvsignore
@@ -12,3 +12,4 @@ debug.log
mkinitrd_helper.tar.bz2
hack_*
rescue-gui
+dhcp-client
diff --git a/mdk-stage1/Makefile b/mdk-stage1/Makefile
index 546090b87..9fd254c8b 100644
--- a/mdk-stage1/Makefile
+++ b/mdk-stage1/Makefile
@@ -46,7 +46,7 @@ include $(top_dir)/Makefile.common
include $(top_dir)/../Makefile.config
-DEFS = -DDISTRIB_NAME=\"$(DISTRIB_NAME)\" -DDISTRIB_VERSION=\"$(DISTRIB_VERSION)\" -DDISTRIB_DESCR=\"$(DISTRIB_DESCR)\" -DSPAWN_SHELL $(ADDITIONAL_DEFS) -D_FILE_OFFSET_BITS=64
+DEFS = -DDISTRIB_NAME=\"$(DISTRIB_NAME)\" -DDISTRIB_VERSION=\"$(DISTRIB_VERSION)\" -DDISTRIB_DESCR=\"$(DISTRIB_DESCR)\" $(ADDITIONAL_DEFS) -D_FILE_OFFSET_BITS=64
COMPILE = $(CC) $(DEFS) $(CFLAGS)
@@ -123,17 +123,22 @@ ALLSRC = $(INITSRC) $(STAGE1_ALLSRC)
STAGE1OBJS-CDROM = $(subst .c,-CDROM.o,$(STAGE1SRC) $(CDROMSRC))
-CDROM_DEFS = -DDISABLE_DISK -DDISABLE_NETWORK
+CDROM_DEFS = -DSPAWN_SHELL -DDISABLE_DISK -DDISABLE_NETWORK
STAGE1OBJS-NETWORK = $(subst .c,-NETWORK.o,$(STAGE1SRC) $(NETWORKSRC))
-NETWORK_DEFS = -DDISABLE_CDROM -DDISABLE_DISK
+NETWORK_DEFS = -DSPAWN_SHELL -DDISABLE_CDROM -DDISABLE_DISK
+
+
+STAGE1OBJS-NETWORK-STANDALONE = $(subst .c,-NETWORK-STANDALONE.o,$(STAGE1SRC) $(NETWORKSRC))
+
+NETWORK_STANDALONE_DEFS = -DDISABLE_CDROM -DDISABLE_DISK -DENABLE_NETWORK_STANDALONE
STAGE1OBJS-FULL = $(subst .c,-FULL.o,$(STAGE1_ALLSRC))
-BINS = init init-stage2 stage1-full
+BINS = init init-stage2 stage1-full dhcp-client
ifndef MOVE
ifeq (i386, $(ARCH))
@@ -194,6 +199,10 @@ stage1-full: $(STAGE1OBJS-FULL) $(STAGE1_OWN_LIBS) $(STAGE1_NETWORK_LIBS) $(FRON
$(DIET) $(CC) $(LDFLAGS) -o $@ $^
$(STRIPCMD) $@
+dhcp-client: $(STAGE1OBJS-NETWORK-STANDALONE) $(STAGE1_OWN_LIBS) $(STAGE1_NETWORK_LIBS) $(FRONTEND_LINK) $(STAGE1_LIBC)
+ $(DIET) $(CC) $(LDFLAGS) -o $@ $^
+ $(STRIPCMD) $@
+
$(INITOBJS): %.o: %.c
$(COMPILE) $(INIT_DEFS) $(INIT_DEFS_ADD) -c $<
@@ -207,8 +216,11 @@ $(STAGE1OBJS-CDROM): %-CDROM.o: %.c
$(STAGE1OBJS-NETWORK): %-NETWORK.o: %.c
$(DIET) $(COMPILE) $(INCLUDES) $(NETWORK_DEFS) $(PCMCIA_DEFS) $(USB_DEFS_GEN) -DENABLE_ADDITIONAL_MODULES -c $< -o $@
+$(STAGE1OBJS-NETWORK-STANDALONE): %-NETWORK-STANDALONE.o: %.c
+ $(DIET) $(COMPILE) $(INCLUDES) $(NETWORK_STANDALONE_DEFS) $(USB_DEFS_GEN) -c $< -o $@
+
$(STAGE1OBJS-FULL): %-FULL.o: %.c
- $(DIET) $(COMPILE) $(INCLUDES) $(USB_DEFS_GEN) $(PCMCIA_DEFS) -DENABLE_BOOTSPLASH -c $< -o $@
+ $(DIET) $(COMPILE) $(INCLUDES) -DSPAWN_SHELL $(USB_DEFS_GEN) $(PCMCIA_DEFS) -DENABLE_BOOTSPLASH -c $< -o $@
.c.o:
$(DIET) $(COMPILE) $(INCLUDES) -DENABLE_BOOTSPLASH -c $<
diff --git a/mdk-stage1/modules.c b/mdk-stage1/modules.c
index 3ba947e1f..01b342cd1 100644
--- a/mdk-stage1/modules.c
+++ b/mdk-stage1/modules.c
@@ -444,7 +444,16 @@ enum insmod_return my_insmod(const char * mod_name, enum driver_type type __attr
if (IS_TESTING)
return INSMOD_OK;
+#ifdef ENABLE_NETWORK_STANDALONE
+ {
+ char *cmd = options ? asprintf_("/sbin/modprobe %s %s", mod_name, options) :
+ asprintf_("/sbin/modprobe %s", mod_name);
+ log_message("running %s", cmd);
+ i = system(cmd);
+ }
+#else
i = insmod_with_deps(real_mod_name, options, allow_modules_floppy);
+#endif
if (i == 0) {
log_message("\tsucceeded %s", real_mod_name);
#ifndef DISABLE_NETWORK
diff --git a/mdk-stage1/network.c b/mdk-stage1/network.c
index be4cbefc4..10a42a74f 100644
--- a/mdk-stage1/network.c
+++ b/mdk-stage1/network.c
@@ -817,7 +817,7 @@ static int choose_mirror_from_list(char *http_proxy_host, char *http_proxy_port,
/* -=-=-- */
-static enum return_type intf_select_and_up()
+enum return_type intf_select_and_up()
{
static struct interface_info intf[20];
static int num_interfaces = 0;
diff --git a/mdk-stage1/network.h b/mdk-stage1/network.h
index ccef5d623..a94f8150b 100644
--- a/mdk-stage1/network.h
+++ b/mdk-stage1/network.h
@@ -26,6 +26,7 @@
#include <netinet/ip.h>
#include <arpa/inet.h>
+enum return_type intf_select_and_up();
enum return_type nfs_prepare(void);
#ifndef MANDRAKE_MOVE
diff --git a/mdk-stage1/newt-frontend.c b/mdk-stage1/newt-frontend.c
index 534036ce9..4bedda82b 100644
--- a/mdk-stage1/newt-frontend.c
+++ b/mdk-stage1/newt-frontend.c
@@ -45,8 +45,10 @@ void init_frontend(char * welcome_msg)
newtCls();
newtDrawRootText(0, 0, welcome_msg);
-
- newtPushHelpLine(" <Alt-F1> for here, <Alt-F3> to see the logs, <Alt-F4> for kernel msg");
+
+ if (welcome_msg[0])
+ newtPushHelpLine(" <Alt-F1> for here, <Alt-F3> to see the logs, <Alt-F4> for kernel msg");
+
newtRefresh();
}
diff --git a/mdk-stage1/stage1.c b/mdk-stage1/stage1.c
index 6176fe798..c15bd7201 100644
--- a/mdk-stage1/stage1.c
+++ b/mdk-stage1/stage1.c
@@ -595,6 +595,18 @@ void finish_preparing(void)
int main(int argc __attribute__ ((unused)), char **argv __attribute__ ((unused)), char **env)
{
+#ifdef ENABLE_NETWORK_STANDALONE
+ open_log();
+ init_frontend("");
+
+ unlink("/etc/resolv.conf"); /* otherwise it is read-only */
+ set_param(MODE_AUTOMATIC);
+ grab_automatic_params("network:dhcp");
+
+ intf_select_and_up();
+ finish_frontend();
+ return 0;
+#else
if (getenv("DEBUGSTAGE1"))
set_param(MODE_TESTING);
@@ -670,4 +682,5 @@ int main(int argc __attribute__ ((unused)), char **argv __attribute__ ((unused))
return 0;
else
return 66;
+#endif
}
diff --git a/rescue/make_rescue_img b/rescue/make_rescue_img
index d1d96afeb..12cd9287c 100755
--- a/rescue/make_rescue_img
+++ b/rescue/make_rescue_img
@@ -105,8 +105,9 @@ if (arch() =~ /^i.86/) {
}
installown("lsparts", "/usr/bin");
installown("rescue-doc", "/usr/bin");
-_ "cd ../mdk-stage1 && make rescue-gui";
+_ "cd ../mdk-stage1 && make rescue-gui dhcp-client";
installown("../mdk-stage1/rescue-gui", "/usr/bin");
+installown("../mdk-stage1/dhcp-client", "/usr/sbin");
#- note that on biarch systems, we may need to have both /lib and /lib64
__ "strip $tmp/{lib,$lib,bin,sbin}/* $tmp/usr/{bin,sbin}/* 2>/dev/null";