From 7f7a9b7b58dbef59e2e1a09afe682983dc7806f8 Mon Sep 17 00:00:00 2001 From: Francois Pons Date: Tue, 20 Jun 2000 16:25:33 +0000 Subject: *** empty log message *** --- perl-install/ChangeLog | 13 ++++++++ perl-install/any.pm | 2 +- perl-install/c/Makefile.PL | 3 +- perl-install/c/sbus.c | 38 ++++++++++++++++++++-- perl-install/c/stuff.xs.pm | 53 +++++++++++++++++++++++++++---- perl-install/fs.pm | 2 ++ perl-install/fsedit.pm | 3 +- perl-install/help.pm | 20 ++++++++++++ perl-install/install2.pm | 1 + perl-install/install_any.pm | 8 +++++ perl-install/install_steps.pm | 3 +- perl-install/install_steps_interactive.pm | 16 ++++++---- perl-install/partition_table.pm | 18 ++++++++--- perl-install/sbus_probing/main.pm | 18 ++++++----- 14 files changed, 163 insertions(+), 35 deletions(-) (limited to 'perl-install') diff --git a/perl-install/ChangeLog b/perl-install/ChangeLog index 8d394f12b..82808360c 100644 --- a/perl-install/ChangeLog +++ b/perl-install/ChangeLog @@ -1,3 +1,16 @@ +2000-06-20 François Pons + + * c/sbus.c: added some functions for silo.c integration. + * c/silo.c: initial release including write in prom, and translation + of disk name from openprom to linux, rh version modified. + * silo.pm: added write in prom, support of sunos boot from silo. + * partition_table.pm: added support for ufs partition like windows one. + * install_steps_interactive.pm: added other entries in silo. + * install_steps.pm: support sunos partition. + * install_any.pm: automatically mount sunos partition with diskdrake. + * fsedit.pm: added /mnt/sunos suggested mount point. + * fs.pm: added ufs support for mount. + 2000-06-19 François Pons * crypto.pm: modified for getting sparc crypto file for sparc*. diff --git a/perl-install/any.pm b/perl-install/any.pm index 120f1a387..34e32a2c5 100644 --- a/perl-install/any.pm +++ b/perl-install/any.pm @@ -135,7 +135,7 @@ You can add some more or change the existing ones."), } my %old_e = %$e; my $default = my $old_default = $e->{label} eq $b->{default}; - + my @l; if ($e->{type} eq "image") { @l = ( diff --git a/perl-install/c/Makefile.PL b/perl-install/c/Makefile.PL index e406f1fe4..315160a17 100644 --- a/perl-install/c/Makefile.PL +++ b/perl-install/c/Makefile.PL @@ -3,14 +3,13 @@ use ExtUtils::MakeMaker; # the contents of the Makefile that is written. my $libs = '-L/usr/X11R6/lib -lX11 -lgdk -lXxf86misc'; - $libs .= ' -lrpm -ldb1 -lz' if $ENV{C_RPM}; WriteMakefile( 'NAME' => 'stuff', 'OPTIMIZE' => '-Os', 'MAKEFILE' => 'Makefile_c', - 'OBJECT' => 'stuff.o smp.o md5.o md5_crypt.o sbus.o', + 'OBJECT' => 'stuff.o smp.o md5.o md5_crypt.o sbus.o silo.o', 'VERSION_FROM' => 'stuff.pm', # finds $VERSION 'LIBS' => [$libs], # e.g., '-lm' 'DEFINE' => '', # e.g., '-DHAVE_SOMETHING' diff --git a/perl-install/c/sbus.c b/perl-install/c/sbus.c index 3de75fca2..85d44fa79 100644 --- a/perl-install/c/sbus.c +++ b/perl-install/c/sbus.c @@ -19,12 +19,11 @@ * */ -#include - #ifdef __sparc__ #include #include +#include #include #include #include @@ -87,6 +86,25 @@ int prom_getchild(int node) return *(int *)op->oprom_array; } +char *prom_getopt(char *var, int *lenp) +{ + DECL_OP(MAX_VAL); + + strcpy (op->oprom_array, var); + if (ioctl (promfd, OPROMGETOPT, op) < 0) + return 0; + if (lenp) *lenp = op->oprom_size; + return op->oprom_array; +} + +void prom_setopt(char *var, char *value) { + DECL_OP(MAX_VAL); + + strcpy (op->oprom_array, var); + strcpy (op->oprom_array + strlen (var) + 1, value); + ioctl (promfd, OPROMSETOPT, op); +} + char *prom_getproperty(char *prop, int *lenp) { DECL_OP(MAX_VAL); @@ -114,11 +132,25 @@ int prom_getbool(char *prop) } } +int prom_pci2node(int bus, int devfn) { + DECL_OP(2*sizeof(int)); + + ((int *)op->oprom_array)[0] = bus; + ((int *)op->oprom_array)[1] = devfn; + if (ioctl (promfd, OPROMPCI2NODE, op) < 0) + return 0; + prom_current_node = *(int *)op->oprom_array; + return *(int *)op->oprom_array; +} + #else int prom_open() { return 0; } void prom_close() {} int prom_getsibling(int node) { return 0; } int prom_getchild(int node) { return 0; } -char *prom_getproperty(char *prop, int *lenp) { return NULL; } +char *prom_getopt(char *var, int *lenp) { return 0; /* NULL */ } +void prom_setopt(char *var, char *value) {} +char *prom_getproperty(char *prop, int *lenp) { return 0; /* NULL */ } int prom_getbool(char *prop) { return 0; } +int prom_pci2node(int bus, int devfn) { return 0; } #endif /* __sparc__ */ diff --git a/perl-install/c/stuff.xs.pm b/perl-install/c/stuff.xs.pm index 034996d21..3967392fb 100644 --- a/perl-install/c/stuff.xs.pm +++ b/perl-install/c/stuff.xs.pm @@ -326,12 +326,12 @@ prom_getchild(node) int node void -prom_getproperty(key) +prom_getopt(key) char *key PPCODE: int lenp = 0; char *value = NULL; - value = prom_getproperty(key, &lenp); + value = prom_getopt(key, &lenp); EXTEND(sp, 1); if (value != NULL) { PUSHs(sv_2mortal(newSVpv(value, 0))); @@ -339,23 +339,62 @@ prom_getproperty(key) PUSHs(&PL_sv_undef); } -int -prom_getbool(key) +void +prom_setopt(key, value) + char *key + char *value + +void +prom_getproperty(key) char *key + PPCODE: + int lenp = 0; + char *value = NULL; + value = prom_getproperty(key, &lenp); + EXTEND(sp, 1); + if (value != NULL) { + PUSHs(sv_2mortal(newSVpv(value, lenp))); + } else { + PUSHs(&PL_sv_undef); + } void -prom_getint(key) +prom_getstring(key) char *key PPCODE: int lenp = 0; char *value = NULL; value = prom_getproperty(key, &lenp); EXTEND(sp, 1); - if (value != NULL && lenp == sizeof(int)) { - PUSHs(sv_2mortal(newSViv(*(int *)value))); + if (value != NULL) { + PUSHs(sv_2mortal(newSVpv(value, 0))); } else { PUSHs(&PL_sv_undef); } + +int +prom_getbool(key) + char *key + + + +void +initSilo() + +char * +disk2PromPath(disk) + unsigned char *disk + +int +hasAliases() + +char * +promRootName() + +void +setPromVars(linuxAlias, bootDevice) + char *linuxAlias + char *bootDevice '; $ENV{C_RPM} and print ' diff --git a/perl-install/fs.pm b/perl-install/fs.pm index 12e9ceae0..33dc8229b 100644 --- a/perl-install/fs.pm +++ b/perl-install/fs.pm @@ -197,6 +197,8 @@ sub mount($$$;$) { $mount_opt = 'check=relaxed'; eval { modules::load('vfat') }; #- try using vfat eval { modules::load('msdos') } if $@; #- otherwise msdos... + } elsif ($fs eq 'ufs') { + eval { modules::load('ufs') }; } elsif ($fs eq 'reiserfs') { #- could be better if we knew if there is a /boot or not #- without knowing it, / is forced to be mounted with notail diff --git a/perl-install/fsedit.pm b/perl-install/fsedit.pm index 020a6f57c..6d30a73ab 100644 --- a/perl-install/fsedit.pm +++ b/perl-install/fsedit.pm @@ -36,8 +36,7 @@ arch() =~ /^sparc/ ? ( { mntpoint => "/tmp", size => 50 << 11, type => 0x83, ratio => 3, maxsize => 500 << 11 }, { mntpoint => "/mnt/iso", size => 700 << 11, type => 0x83 }, ); -my @suggestions_mntpoints = qw(/root /mnt/windows); - +my @suggestions_mntpoints = ( "/root/", arch() =~ /sparc/ ? "/mnt/sunos" : "/mnt/windows" ); my @partitions_signatures = ( [ 0x83, 0x438, "\x53\xEF" ], diff --git a/perl-install/help.pm b/perl-install/help.pm index af8e1611a..25668d026 100644 --- a/perl-install/help.pm +++ b/perl-install/help.pm @@ -371,6 +371,26 @@ when booting. The following values are available: * normal: select normal 80x25 text mode. * : use the corresponding text mode."), +setupSILOAddEntry => + __("SILO is a bootloader for SPARC: it is able to boot +either GNU/Linux or any other operating system present on your computer. +Normally, these other operating systems are correctly detected and +installed. If this is not the case, you can add an entry by hand in this +screen. Be careful as to choose the correct parameters. + + +You may also want not to give access to these other operating systems to +anyone, in which case you can delete the corresponding entries. But +in this case, you will need a boot disk in order to boot them!"), + +setupSILOGeneral => + __("SILO main options are: + - Delay before booting default image: Specifies the number in tenths +of a second the boot loader should wait before booting the first image. +This is useful on systems that immediately boot from the hard disk after +enabling the keyboard. The boot loader doesn't wait if \"delay\" is +omitted or is set to zero."), + configureX => __("Now it's time to configure the X Window System, which is the core of the GNU/Linux GUI (Graphical User Interface). For this purpose, diff --git a/perl-install/install2.pm b/perl-install/install2.pm index 8e3414429..1e1f26320 100644 --- a/perl-install/install2.pm +++ b/perl-install/install2.pm @@ -34,6 +34,7 @@ use install_steps; #- Steps table #-###################################################################################### $::VERSION = "7.1"; +#-$::corporate=1; my (%installSteps, @orderedInstallSteps); { diff --git a/perl-install/install_any.pm b/perl-install/install_any.pm index d1fb27060..920bfb5e8 100644 --- a/perl-install/install_any.pm +++ b/perl-install/install_any.pm @@ -363,6 +363,14 @@ Continue at your own risk!")) if !$ok2 && $ok && !$o->{partitioning}{readonly}; $_->{mntpoint} = "/mnt/win_" . lc($_->{device_windobe}) . ($v ? $v+1 : ''); #- lc cuz of StartOffice(!) cf dadou } } + + my @sunos = grep { isSunOS($_) && type2name($_->{type}) =~ /root/i } @{$o->{fstab}}; #- take only into account root partitions. + if (@sunos) { + my $v = ''; + map { $_->{mntpoint} = "/mnt/sunos" . ($v && ++$v) } @sunos; + } + #- a good job is to mount SunOS root partition, and to use mount point described here in /etc/vfstab. + $ok2; } diff --git a/perl-install/install_steps.pm b/perl-install/install_steps.pm index f96d645ff..319a4c54a 100644 --- a/perl-install/install_steps.pm +++ b/perl-install/install_steps.pm @@ -202,7 +202,7 @@ sub choosePartitionsToFormat($$) { fsedit::typeOfPart($_->{device}); $_->{toFormatUnsure} = $_->{mntpoint} eq "/" || #- if detected dos/win, it's not precise enough to just compare the types (too many of them) - (isFat({ type => $t }) ? !isFat($_) : $t != $_->{type}); + (isOtherAvailableFS({ type => $t }) ? !isOtherAvailableFS($_) : $t != $_->{type}); } } } @@ -809,6 +809,7 @@ sub setupBootloaderBefore { } } elsif (arch() =~ /^sparc/) { require silo; + silo::init(); silo::suggest($o->{prefix}, $o->{bootloader}, $o->{hds}, $o->{fstab}, install_any::kernelVersion($o)); } else { require lilo; diff --git a/perl-install/install_steps_interactive.pm b/perl-install/install_steps_interactive.pm index 36a4ce526..00ed1b99c 100644 --- a/perl-install/install_steps_interactive.pm +++ b/perl-install/install_steps_interactive.pm @@ -219,7 +219,7 @@ sub choosePartitionsToFormat($$) { $o->SUPER::choosePartitionsToFormat($fstab); my @l = grep { !$_->{isFormatted} && $_->{mntpoint} && !($::beginner && isSwap($_)) && - (!isFat($_) || $::expert || $_->{toFormat}) + (!isOtherAvailableFS($_) || $::expert || $_->{toFormat}) } @$fstab; $_->{toFormat} = 1 foreach grep { $::beginner && isSwap($_) } @$fstab; @@ -801,7 +801,7 @@ sub setupSILO { if ($::beginner && $more == 1) { #- nothing more to do here. } elsif ($more || !$::beginner) { - $o->set_help("setupBootloaderGeneral"); + $o->set_help("setupSILOGeneral"); $::expert and $o->ask_yesorno('', _("Do you want to use SILO?"), 1) || return; @@ -825,7 +825,7 @@ _("Restrict command line options") => { val => \$b->{restricted}, type => "bool" } until ($::beginner && $more <= 1) { - $o->set_help('setupBootloaderAddEntry'); + $o->set_help('setupSILOAddEntry'); my $c = $o->ask_from_list_([''], _("Here are the following entries in SILO. You can add some more or change the existing ones."), @@ -854,16 +854,18 @@ You can add some more or change the existing ones."), my @l; if ($e->{type} eq "image") { @l = ( -_("Image") => { val => \$e->{kernel_or_dev}, list => [ eval { glob_("$o->{prefix}/boot/vmlinuz*") } ] }, +_("Image") => { val => \$e->{kernel_or_dev}, list => [ eval { map { s/$o->{prefix}//; $_ } glob_("$o->{prefix}/boot/vmlinuz*") } ] }, _("Partition") => { val => \$e->{partition}, list => [ map { ("$o->{prefix}/dev/$_->{device}" =~ /\D*(\d*)/)[0] || 1} @{$o->{fstab}} ], not_edit => !$::expert }, -_("Root") => { val => \$e->{root}, list => [ map { "$o->{prefix}/dev/$_->{device}" } @{$o->{fstab}} ], not_edit => !$::expert }, +_("Root") => { val => \$e->{root}, list => [ map { "/dev/$_->{device}" } @{$o->{fstab}} ], not_edit => !$::expert }, _("Append") => \$e->{append}, -_("Initrd") => { val => \$e->{initrd}, list => [ eval { glob_("$o->{prefix}/boot/initrd*") } ] }, +_("Initrd") => { val => \$e->{initrd}, list => [ eval { map { s/$o->{prefix}//; $_ } glob_("$o->{prefix}/boot/initrd*") } ] }, _("Read-write") => { val => \$e->{'read-write'}, type => 'bool' } ); @l = @l[0..7] unless $::expert; } else { - die "Other SILO entries not supported at the moment"; + @l = ( +_("Root") => { val => \$e->{kernel_or_dev}, list => [ map { "/dev/$_->{device}" } @{$o->{fstab}} ], not_edit => !$::expert }, + ); } @l = ( _("Label") => \$e->{label}, diff --git a/perl-install/partition_table.pm b/perl-install/partition_table.pm index 82eb6a4c5..8260740ed 100644 --- a/perl-install/partition_table.pm +++ b/perl-install/partition_table.pm @@ -7,7 +7,7 @@ use Data::Dumper; @ISA = qw(Exporter); %EXPORT_TAGS = ( - types => [ qw(type2name type2fs name2type fs2type isExtended isExt2 isReiserfs isTrueFS isSwap isDos isWin isFat isPrimary isNfs isSupermount isRAID isHFS isNT isMountableRW isApplePartMap isLoopback) ], + types => [ qw(type2name type2fs name2type fs2type isExtended isExt2 isReiserfs isTrueFS isSwap isDos isWin isFat isSunOS isOtherAvailableFS isPrimary isNfs isSupermount isRAID isHFS isNT isMountableRW isApplePartMap isLoopback) ], ); @EXPORT_OK = map { @$_ } values %EXPORT_TAGS; @@ -165,12 +165,19 @@ arch() =~ /^ppc/ ? ( ) : ( 0x07 => 'ntfs', ), -arch() !~ /^sparc/ ? ( +arch() !~ /sparc/ ? ( 0x01 => 'vfat', 0x04 => 'vfat', 0x05 => 'ignore', 0x06 => 'vfat', -) : (), +) : ( + 0x01 => 'ufs', + 0x02 => 'ufs', + 0x04 => 'ufs', + 0x06 => 'ufs', + 0x07 => 'ufs', + 0x08 => 'ufs', +), 0x0b => 'vfat', 0x0c => 'vfat', 0x0e => 'vfat', @@ -212,6 +219,9 @@ sub isReiserfs($) { $type2fs{$_[0]{type}} eq 'reiserfs' } sub isDos($) { arch() !~ /^sparc/ && $ {{ 1=>1, 4=>1, 6=>1 }}{$_[0]{type}} } sub isWin($) { $ {{ 0xb=>1, 0xc=>1, 0xe=>1, 0x1b=>1, 0x1c=>1, 0x1e=>1 }}{$_[0]{type}} } sub isFat($) { isDos($_[0]) || isWin($_[0]) } +sub isSunOS($) { arch() =~ /sparc/ && $ {{ 0x1=>1, 0x2=>1, 0x4=>1, 0x6=>1, 0x7=>1, 0x8=>1 }}{$_[0]{type}} } +sub isSolaris($) { 0; } #- hack to search for getting the difference ? TODO +sub isOtherAvailableFS($) { isFat($_[0]) || isSunOS($_[0]) } #- other OS that linux can access its filesystem sub isNfs($) { $_[0]{type} eq 'nfs' } #- small hack sub isNT($) { arch() !~ /^sparc/ && $_[0]{type} == 0x7 } sub isSupermount($) { $_[0]{type} eq 'supermount' } @@ -219,7 +229,7 @@ sub isHFS($) { $type2fs{$_[0]{type}} eq 'hfs' } sub isHiddenMacPart { defined $_[0]{isMap} } sub isLoopback { defined $_[0]{loopback_file} } sub isTrueFS { isExt2($_[0]) || isReiserfs($_[0]) } -sub isMountableRW { isTrueFS($_[0]) || isFat($_[0]) } +sub isMountableRW { isTrueFS($_[0]) || isOtherAvailableFS($_[0]) } sub isPrimary($$) { my ($part, $hd) = @_; diff --git a/perl-install/sbus_probing/main.pm b/perl-install/sbus_probing/main.pm index b1fce96f7..baf385819 100644 --- a/perl-install/sbus_probing/main.pm +++ b/perl-install/sbus_probing/main.pm @@ -65,13 +65,14 @@ my %sbus_table_video = ( 1; -#- update %sbus_probed according to SBUS detection. +sub prom_getint($) { unpack "I", c::prom_getproperty($_[0]) } + +#- update $@sbus_probed according to SBUS detection. sub prom_walk($$$$) { my ($sbus_probed, $node, $sbus, $ebus) = @_; - my ($prob_name, $prob_type) = (c::prom_getproperty("name"), c::prom_getproperty("device_type")); + my ($prob_name, $prob_type) = (c::prom_getstring("name"), c::prom_getstring("device_type")); my ($nextnode, $nsbus, $nebus) = (undef, $sbus, $ebus); - log::l("sbus probe at $node => $prob_name of type $prob_type on $sbus,$ebus"); #- probe for network devices. if ($sbus && $prob_type eq 'network') { $prob_name =~ s/[A-Z,]*(.*)/$1/; @@ -97,9 +98,9 @@ sub prom_walk($$$$) { #- probe for video devices. if ($prob_type eq 'display' && ($sbus || $prob_name =~ /^(ffb|afb|cgfourteen)$/)) { $prob_name =~ s/[A-Z,]*(.*)/$1/; - my $ext = ($prob_name eq 'mgx' && c::prom_getint('fb_size') == 0x400000 && '_4M' || + my $ext = ($prob_name eq 'mgx' && prom_getint('fb_size') == 0x400000 && '_4M' || $prob_name eq 'cgsix' && do { - my ($chiprev, $vmsize) = (c::prom_getint('chiprev'), c::prom_getint('vmsize')); + my ($chiprev, $vmsize) = (prom_getint('chiprev'), prom_getint('vmsize')); my $result = ''; $chiprev >= 1 && $chiprev <= 4 and $result = '_dbl'; $chiprev >= 5 && $chiprev <= 9 and $result = '_sgl'; @@ -108,10 +109,10 @@ sub prom_walk($$$$) { $chiprev == 11 && !$result and $result = '_t'; $result; } || - $prob_name eq 'leo' && c::prom_getproperty('model') =~ /501-2503/ && '_t' || + $prob_name eq 'leo' && c::prom_getstring('model') =~ /501-2503/ && '_t' || $prob_name eq 'tcx' && c::prom_getbool('tcx-8-bit') && '_8b' || - $prob_name eq 'afb' && sprintf "_btx%x", c::prom_getint('board_type') || - $prob_name eq 'ffb' && sprintf "_btx%x", c::prom_getint('board_type')); + $prob_name eq 'afb' && sprintf "_btx%x", prom_getint('board_type') || + $prob_name eq 'ffb' && sprintf "_btx%x", prom_getint('board_type')); $sbus_table_video{$prob_name . $ext} ? push @$sbus_probed, [ "VIDEO", @{$sbus_table_video{$prob_name . $ext}} ] : @@ -153,6 +154,7 @@ sub matching_desc($;$) { prom_walk(\@l, $root_node, 0, 0); c::prom_close(); + grep { !$type || $_->[1] =~ /$regexp/ } @l; } -- cgit v1.2.1