summaryrefslogtreecommitdiffstats
path: root/mdk-stage1
diff options
context:
space:
mode:
Diffstat (limited to 'mdk-stage1')
-rw-r--r--mdk-stage1/Makefile6
-rw-r--r--mdk-stage1/automatic.c15
-rw-r--r--mdk-stage1/bootsplash.c70
-rw-r--r--mdk-stage1/bootsplash.h25
-rw-r--r--mdk-stage1/frontend.h10
-rw-r--r--mdk-stage1/newt-frontend.c6
-rw-r--r--mdk-stage1/stdio-frontend.c8
-rw-r--r--mdk-stage1/tools.c1
-rw-r--r--mdk-stage1/tools.h1
9 files changed, 126 insertions, 16 deletions
diff --git a/mdk-stage1/Makefile b/mdk-stage1/Makefile
index 543115741..d20aecf71 100644
--- a/mdk-stage1/Makefile
+++ b/mdk-stage1/Makefile
@@ -191,7 +191,7 @@ stage1-network: $(STAGE1OBJS-NETWORK) $(STAGE1_OWN_LIBS) $(STAGE1_NETWORK_LIBS)
$(DIET) $(CC) $(LDFLAGS) -o $@ $^
$(STRIPCMD) $@
-stage1-full: $(STAGE1OBJS-FULL) $(STAGE1_OWN_LIBS) $(STAGE1_NETWORK_LIBS) $(FRONTEND_LINK) $(PCMCIA_LIB) $(STAGE1_LIBC)
+stage1-full: $(STAGE1OBJS-FULL) $(STAGE1_OWN_LIBS) $(STAGE1_NETWORK_LIBS) $(FRONTEND_LINK) bootsplash.o $(PCMCIA_LIB) $(STAGE1_LIBC)
$(DIET) $(CC) $(LDFLAGS) -o $@ $^
$(STRIPCMD) $@
@@ -209,10 +209,10 @@ $(STAGE1OBJS-NETWORK): %-NETWORK.o: %.c
$(DIET) $(COMPILE) $(INCLUDES) $(NETWORK_DEFS) $(PCMCIA_DEFS) $(USB_DEFS_GEN) -c $< -o $@
$(STAGE1OBJS-FULL): %-FULL.o: %.c
- $(DIET) $(COMPILE) $(INCLUDES) $(USB_DEFS_GEN) $(PCMCIA_DEFS) -c $< -o $@
+ $(DIET) $(COMPILE) $(INCLUDES) $(USB_DEFS_GEN) $(PCMCIA_DEFS) -DENABLE_BOOTSPLASH -c $< -o $@
.c.o:
- $(DIET) $(COMPILE) $(INCLUDES) -c $<
+ $(DIET) $(COMPILE) $(INCLUDES) -DENABLE_BOOTSPLASH -c $<
clean:
diff --git a/mdk-stage1/automatic.c b/mdk-stage1/automatic.c
index a2e32924e..3a816bab1 100644
--- a/mdk-stage1/automatic.c
+++ b/mdk-stage1/automatic.c
@@ -100,9 +100,10 @@ char * get_auto_value(char * auto_param)
enum return_type ask_from_list_auto(char *msg, char ** elems, char ** choice, char * auto_param, char ** elems_auto)
{
- if (!IS_AUTOMATIC)
+ if (!IS_AUTOMATIC) {
+ exit_bootsplash();
return ask_from_list(msg, elems, choice);
- else {
+ } else {
char ** sav_elems = elems;
char * tmp = get_auto_value(auto_param);
while (elems && *elems) {
@@ -121,9 +122,10 @@ enum return_type ask_from_list_auto(char *msg, char ** elems, char ** choice, ch
enum return_type ask_from_list_comments_auto(char *msg, char ** elems, char ** elems_comments, char ** choice, char * auto_param, char ** elems_auto)
{
- if (!IS_AUTOMATIC)
+ if (!IS_AUTOMATIC) {
+ exit_bootsplash();
return ask_from_list_comments(msg, elems, elems_comments, choice);
- else {
+ } else {
char ** sav_elems = elems;
char * tmp = get_auto_value(auto_param);
while (elems && *elems) {
@@ -143,9 +145,10 @@ enum return_type ask_from_list_comments_auto(char *msg, char ** elems, char ** e
enum return_type ask_from_entries_auto(char *msg, char ** questions, char *** answers, int entry_size, char ** questions_auto, void (*callback_func)(char ** strings))
{
- if (!IS_AUTOMATIC)
+ if (!IS_AUTOMATIC) {
+ exit_bootsplash();
return ask_from_entries(msg, questions, answers, entry_size, callback_func);
- else {
+ } else {
char * tmp_answers[50];
int i = 0;
while (questions && *questions) {
diff --git a/mdk-stage1/bootsplash.c b/mdk-stage1/bootsplash.c
new file mode 100644
index 000000000..d51deb543
--- /dev/null
+++ b/mdk-stage1/bootsplash.c
@@ -0,0 +1,70 @@
+/*
+ * Pixel (pixel@mandrakesoft.com)
+ *
+ * Copyright 2004 Mandrakesoft
+ *
+ * This software may be freely redistributed under the terms of the GNU
+ * public license.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ */
+
+#include <stdio.h>
+#include "bootsplash.h"
+#include "frontend.h"
+#include "log.h"
+
+static int total_size;
+static float previous;
+static FILE* splash = NULL;
+
+static void update_progression_only(int current_size)
+{
+ if (splash && total_size) {
+ float ratio = (float) (current_size + 1) / total_size;
+ if (ratio > previous + 0.01) {
+ fprintf(splash, "show %d\n", (int) (ratio * 65534));
+ fflush(splash);
+ previous = ratio;
+ }
+ }
+}
+
+static void open_bootsplash(void)
+{
+ if (!splash) splash = fopen("/proc/splash", "w");
+ if (!splash) log_message("opening /proc/splash failed");
+}
+
+void exit_bootsplash(void)
+{
+ log_message("exiting bootsplash");
+ open_bootsplash();
+ if (splash) {
+ fprintf(splash, "verbose\n");
+ fflush(splash);
+ }
+}
+
+
+void init_progression(char *msg, int size)
+{
+ previous = 0; total_size = size;
+ open_bootsplash();
+ update_progression_only(0);
+ init_progression_raw(msg, size);
+}
+
+void update_progression(int current_size)
+{
+ update_progression_only(current_size);
+ update_progression_raw(current_size);
+}
+
+void end_progression(void)
+{
+ end_progression_raw();
+}
diff --git a/mdk-stage1/bootsplash.h b/mdk-stage1/bootsplash.h
new file mode 100644
index 000000000..7d1c8403c
--- /dev/null
+++ b/mdk-stage1/bootsplash.h
@@ -0,0 +1,25 @@
+/*
+ * Pixel (pixel@mandrakesoft.com)
+ *
+ * Copyright 2004 Mandrakesoft
+ *
+ * This software may be freely redistributed under the terms of the GNU
+ * public license.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ */
+
+#ifndef _BOOTSPLASH_H_
+#define _BOOTSPLASH_H_
+
+#ifdef ENABLE_BOOTSPLASH
+void exit_bootsplash(void);
+void tell_bootsplash(char *cmd);
+#else
+#define exit_bootsplash()
+#endif
+
+#endif
diff --git a/mdk-stage1/frontend.h b/mdk-stage1/frontend.h
index 1d78aaea5..1737ee7e7 100644
--- a/mdk-stage1/frontend.h
+++ b/mdk-stage1/frontend.h
@@ -38,9 +38,19 @@ void info_message(char *msg, ...) __attribute__ ((format (printf, 1, 2))); /* bl
void wait_message(char *msg, ...) __attribute__ ((format (printf, 1, 2))); /* non-blocking */
void remove_wait_message(void);
+void init_progression_raw(char *msg, int size);
+void update_progression_raw(int current_size);
+void end_progression_raw(void);
+
+#ifdef ENABLE_BOOTSPLASH
void init_progression(char *msg, int size);
void update_progression(int current_size);
void end_progression(void);
+#else
+#define init_progression init_progression_raw
+#define update_progression update_progression_raw
+#define end_progression end_progression_raw
+#endif
enum return_type ask_yes_no(char *msg);
enum return_type ask_from_list(char *msg, char ** elems, char ** choice);
diff --git a/mdk-stage1/newt-frontend.c b/mdk-stage1/newt-frontend.c
index 44fda1b73..534036ce9 100644
--- a/mdk-stage1/newt-frontend.c
+++ b/mdk-stage1/newt-frontend.c
@@ -117,7 +117,7 @@ static int size_progress;
static int actually_drawn;
static char * msg_progress;
-void init_progression(char *msg, int size)
+void init_progression_raw(char *msg, int size)
{
size_progress = size;
if (size) {
@@ -136,7 +136,7 @@ void init_progression(char *msg, int size)
}
}
-void update_progression(int current_size)
+void update_progression_raw(int current_size)
{
if (size_progress) {
if (current_size <= size_progress)
@@ -159,7 +159,7 @@ void update_progression(int current_size)
}
}
-void end_progression(void)
+void end_progression_raw(void)
{
if (size_progress) {
newtPopWindow();
diff --git a/mdk-stage1/stdio-frontend.c b/mdk-stage1/stdio-frontend.c
index fa6bb7358..ffa306811 100644
--- a/mdk-stage1/stdio-frontend.c
+++ b/mdk-stage1/stdio-frontend.c
@@ -200,7 +200,7 @@ void remove_wait_message(void)
static int size_progress;
static int actually_drawn;
#define PROGRESS_SIZE 45
-void init_progression(char *msg, int size)
+void init_progression_raw(char *msg, int size)
{
int i;
size_progress = size;
@@ -215,7 +215,7 @@ void init_progression(char *msg, int size)
printf("\n");
}
-void update_progression(int current_size)
+void update_progression_raw(int current_size)
{
if (size_progress) {
if (current_size > size_progress)
@@ -230,10 +230,10 @@ void update_progression(int current_size)
fflush(stdout);
}
-void end_progression(void)
+void end_progression_raw(void)
{
if (size_progress) {
- update_progression(size_progress);
+ update_progression_raw(size_progress);
printf("]\n");
} else
printf(" done.\n");
diff --git a/mdk-stage1/tools.c b/mdk-stage1/tools.c
index 6c47b193d..75406ba36 100644
--- a/mdk-stage1/tools.c
+++ b/mdk-stage1/tools.c
@@ -191,6 +191,7 @@ void unset_automatic(void)
{
log_message("unsetting automatic");
unset_param(MODE_AUTOMATIC);
+ exit_bootsplash();
}
// warning, many things rely on the fact that:
diff --git a/mdk-stage1/tools.h b/mdk-stage1/tools.h
index 3e0213a17..737b323c9 100644
--- a/mdk-stage1/tools.h
+++ b/mdk-stage1/tools.h
@@ -23,6 +23,7 @@
#define _TOOLS_H_
#include <stdlib.h>
+#include "bootsplash.h"
void process_cmdline(void);
int get_param(int i);