bootsplash progressbar support

This commit is contained in:
Anton Farygin 2005-04-21 11:06:44 +00:00
parent fb310ae93a
commit 3085a93992
9 changed files with 114 additions and 5 deletions

View File

@ -109,9 +109,9 @@ enum return_type cdrom_prepare(void)
char * choice;
int i, count = 0;
enum return_type results;
my_insmod("ide-cd", ANY_DRIVER_TYPE, NULL);
my_insmod("sr_mod", ANY_DRIVER_TYPE, NULL);
update_splash();
get_medias(CDROM, &medias, &medias_models);
@ -176,7 +176,10 @@ enum return_type cdrom_prepare(void)
}
if (results == RETURN_OK)
{
update_splash();
return RETURN_OK;
}
if (results == RETURN_BACK)
return cdrom_prepare();

View File

@ -36,6 +36,7 @@
#ifndef STAGE2_BINNAME
#define STAGE2_BINNAME "/sbin/init"
#endif
#define PROCSPLASH "/proc/splash"
/* user-definable (in Makefile): DISABLE_NETWORK, DISABLE_DISK, DISABLE_CDROM, DISABLE_PCMCIA */

View File

@ -628,6 +628,7 @@ enum return_type nfs_prepare(void)
if (results != RETURN_OK)
return results;
update_splash();
do {
results = ask_from_entries_auto("Please enter the name or IP address of your NFS server, "
@ -707,6 +708,7 @@ enum return_type nfs_prepare(void)
add_to_env("METHOD", method_name);
add_to_env("HOST", answers[0]);
add_to_env("PREFIX", answers[1]);
update_splash();
return RETURN_OK;
}
@ -718,6 +720,7 @@ enum return_type ftp_prepare(void)
static char ** answers = NULL;
enum return_type results;
update_splash();
if (!ramdisk_possible()) {
stg1_error_message("FTP install needs more than %d Mbytes of memory (detected %d Mbytes).",
MEM_LIMIT_RAMDISK, total_memory());
@ -796,6 +799,7 @@ enum return_type ftp_prepare(void)
}
while (results == RETURN_BACK);
update_splash();
return RETURN_OK;
}
@ -806,6 +810,8 @@ enum return_type http_prepare(void)
static char ** answers = NULL;
enum return_type results;
update_splash();
if (!ramdisk_possible()) {
stg1_error_message("HTTP install needs more than %d Mbytes of memory (detected %d Mbytes).",
MEM_LIMIT_RAMDISK, total_memory());
@ -857,6 +863,7 @@ enum return_type http_prepare(void)
}
while (results == RETURN_BACK);
update_splash();
return RETURN_OK;
}

View File

@ -57,11 +57,13 @@ void finish_frontend(void)
void verror_message(char *msg, va_list ap)
{
set_splash("verbose");
newtWinMessagev("Error", "Ok", msg, ap);
}
void vinfo_message(char *msg, va_list ap)
{
set_splash("verbose");
newtWinMessagev("Notice", "Ok", msg, ap);
}
@ -190,7 +192,7 @@ enum return_type ask_from_list_comments(char *msg, char ** elems, char ** elems_
elems++;
}
items[i] = NULL;
set_splash("verbose");
rc = newtWinMenu("Please choose...", msg, 52, 5, 5, 7, items, &answer, "Ok", "Cancel", NULL);
if (rc == 2)
@ -206,6 +208,7 @@ enum return_type ask_from_list(char *msg, char ** elems, char ** choice)
{
int answer = 0, rc;
set_splash("verbose");
rc = newtWinMenu("Please choose...", msg, 52, 5, 5, 7, elems, &answer, "Ok", "Cancel", NULL);
if (rc == 2)
@ -220,7 +223,7 @@ enum return_type ask_from_list(char *msg, char ** elems, char ** choice)
enum return_type ask_yes_no(char *msg)
{
int rc;
set_splash("verbose");
rc = newtWinTernary("Please answer...", "Yes", "No", "Back", msg);
if (rc == 1)
@ -380,6 +383,7 @@ enum return_type ask_from_entries(char *msg, char ** questions, char *** answers
} else
*(entries[j].value) = NULL;
}
set_splash("verbose");
rc = mynewtWinEntries("Please fill entries...", msg, 52, 5, 5, entry_size, callback_func, entries, "Ok", "Cancel", NULL);

View File

@ -421,12 +421,19 @@ static void probe_that_type(enum driver_type type)
}
if (type == MEDIA_ADAPTERS) {
update_splash();
pci_probe(IDE_ADAPTERS);
update_splash();
pci_probe(SCSI_ADAPTERS);
update_splash();
usb_probe(MEDIA_ADAPTERS);
update_splash();
} else {
update_splash();
pci_probe(type);
update_splash();
usb_probe(type);
update_splash();
}
}

View File

@ -2,7 +2,7 @@
# $Id$
Name: propagator
Version: 20050412
Version: 20050420
Release: alt1
Summary: 'Early userspace' set of binaries
@ -31,6 +31,9 @@ including init and various helpers for hw probing and bootstrapping.
%_libdir/%name
%changelog
* Mon Apr 20 2005 Anton Farygin <rider@altlinux.ru> 20050420-alt1
- added splash update support
* Tue Apr 12 2005 Anton Farygin <rider@altlinux.ru> 20050412-alt1
- use squashfs for stage2 and live system

View File

@ -322,7 +322,7 @@ static enum return_type method_select_and_prepare(void)
means[i] = disk_install; means_auto[i++] = disk_install_auto;
#endif
means[i] = NULL;
update_splash();
results = ask_from_list_auto("Please choose the installation method.", means, &choice, "method", means_auto);
if (results != RETURN_OK)
@ -384,6 +384,8 @@ int main(int argc, char **argv, char **env)
process_cmdline();
handle_env(env);
spawn_shell();
prepare_progress();
update_splash();
init_modules_insmoding();
snprintf(buf, sizeof(buf), "Welcome to %s " __DATE__ " " __TIME__, version);
init_frontend(buf);
@ -394,7 +396,9 @@ int main(int argc, char **argv, char **env)
if (IS_UPDATEMODULES)
update_modules();
update_splash();
handle_pcmcia(&pcmcia_adapter);
update_splash();
if (IS_RESCUE && total_memory() < MEM_LIMIT_RESCUE) {
stg1_error_message("You are starting the rescue with a low memory configuration. "
@ -408,6 +412,8 @@ int main(int argc, char **argv, char **env)
finish_frontend();
close_log();
update_splash();
close_progress();
if (ret != RETURN_OK)
fatal_error("could not select an installation method");

View File

@ -37,6 +37,7 @@ extern char * interactive_fifo;
#define MODE_RESCUE (1 << 3)
#define MODE_AUTOMATIC (1 << 4)
#define MODE_LOWMEM (1 << 5)
#define MODE_PROGRESSCOUNT (1 << 7)
#define MODE_STAGENAME (1 << 8)
#define MODE_RAMDISK (1 << 9)
#define MODE_CHANGEDISK (1 << 10)
@ -48,6 +49,7 @@ extern char * interactive_fifo;
#define IS_LIVE (get_param(MODE_LIVE))
#define IS_AUTOMATIC (get_param(MODE_AUTOMATIC))
#define IS_LOWMEM (get_param(MODE_LOWMEM))
#define IS_PROGRESSCOUNT (get_param(MODE_PROGRESSCOUNT))
#define IS_STAGENAME (get_param(MODE_STAGENAME))
#define IS_RAMDISK (get_param(MODE_RAMDISK))
#define IS_CHANGEDISK (get_param(MODE_CHANGEDISK))

76
tools.c
View File

@ -46,6 +46,9 @@
static struct param_elem params[50];
static int param_number = 0;
static int splashfd = -1;
static int splashcount = 0;
static int splashstep = 0;
void process_cmdline(void)
{
@ -311,6 +314,79 @@ enum return_type load_ramdisk_fd(int source_fd, int size)
return RETURN_OK;
}
int prepare_progress()
{
char readbuffer[4096];
int size;
if (splashfd > 0) return(0);
splashfd = open(PROCSPLASH,O_RDWR);
if (splashfd < 0)
{
log_message("Error open /proc/splash\n");
return(-1);
}
size = read(splashfd, readbuffer, sizeof(readbuffer));
if ( strstr(readbuffer,"silent") && strstr(readbuffer,": on") )
{
log_message("bootsplash detected and progress enabled");
}
else
{
close(splashfd);
splashfd = -1;
}
if (splashcount == 0 )
{
char * splash_param = get_param_valued("splashcount");
if (!splash_param)
{
splashcount = -1;
return;
}
if (sscanf(splash_param,"%d",&splashcount) != 1)
{
splashcount = -1;
return;
}
}
return(0);
}
void close_progress()
{
char * tmpcount;
char * tmpstep;
if (splashfd < 0)
return;
close(splashfd);
sprintf(tmpcount,"%i",splashcount);
sprintf(tmpstep,"%i",splashstep);
add_to_env("SPLASHCOUNT",tmpcount);
add_to_env("SPLASHSTEP",tmpstep);
return;
}
void set_splash(char * mode)
{
if (splashfd < 0)
return;
write(splashfd,mode, strlen(mode));
return;
}
void update_splash()
{
int progress = 0;
char data[32];
if (splashcount <= 0)
return;
++splashstep;
progress = (65534 * splashstep ) / splashcount;
log_message("boostplash progress: %i",progress);
sprintf(data,"show %i\n",progress);
write(splashfd,data,strlen(data));
return;
}
char * get_ramdisk_realname(void)
{