summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xanaconda9
-rw-r--r--isys/silo.c158
-rw-r--r--iw/silo.py44
-rw-r--r--iw/xconfig.py28
-rw-r--r--silo.py36
-rw-r--r--todo.py35
-rwxr-xr-xupd-instroot6
7 files changed, 262 insertions, 54 deletions
diff --git a/anaconda b/anaconda
index 3b5c1b8a5..9749fb250 100755
--- a/anaconda
+++ b/anaconda
@@ -217,6 +217,15 @@ if keymap:
instClass.addToSkipList("keyboard")
instClass.setKeyboard(keymap)
+if iutil.getArch() == "sparc":
+ import kudzu
+ mice = kudzu.probe (kudzu.CLASS_MOUSE, kudzu.BUS_UNSPEC, kudzu.PROBE_ONE);
+ if mice:
+ (mouseDev, driver, descr) = mice[0]
+ if mouseDev == 'sunmouse':
+ instClass.addToSkipList("mouse")
+ instClass.setMouseType("Sun - Mouse", "sunmouse")
+
try:
todo = ToDo(intf, method, rootPath, installSystem = installPackages,
setupFilesystems = setupFilesystems, mouse = mouseInfo,
diff --git a/isys/silo.c b/isys/silo.c
index 072dc4314..554e89068 100644
--- a/isys/silo.c
+++ b/isys/silo.c
@@ -91,6 +91,31 @@ prom_getproperty(char *prop, int *lenp) {
return op->oprom_array;
}
+static 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;
+}
+
+static void
+prom_setopt(char *var, char *value) {
+ DECL_OP(MAX_VAL);
+
+ strcpy (op->oprom_array, var);
+ strcpy (op->oprom_array + strlen (var) + 1, value);
+ if (ioctl (promfd, OPROMSETOPT, op) < 0) {
+ printf ("in %s\n", var);
+ perror ("opepromsetopt");
+ printf ("%d\n", errno);
+ return;
+ }
+}
+
static int
prom_getbool(char *prop) {
DECL_OP(0);
@@ -186,10 +211,10 @@ prom_walk(char *path, int parent, int node, int type) {
}
static int
-prom_init(void) {
+prom_init(int mode) {
struct utsname u;
- promfd = open(promdev, O_RDONLY);
+ promfd = open(promdev, mode);
if (promfd == -1)
return -1;
prom_root_node = prom_getsibling(0);
@@ -482,7 +507,7 @@ scan_scsi(void) {
return 0;
}
-int get_prom_ver(void)
+static int get_prom_ver(void)
{
FILE *f = fopen ("/proc/cpuinfo","r");
int ver = 0;
@@ -507,7 +532,7 @@ int get_prom_ver(void)
return ver;
}
-void check_aliases(void) {
+static void check_aliases(void) {
int nextnode, len;
char *prop;
hasaliases = 0;
@@ -518,11 +543,24 @@ void check_aliases(void) {
}
}
+char *prom_root_name = NULL;
+
+static void get_root_name(void) {
+ int len;
+ char *prop;
+
+ prom_getsibling(0);
+ prop = prom_getproperty("name", &len);
+ if (prop && len > 0 && !strcmp (prop, "aliases"))
+ prom_root_name = strdup(prop);
+}
+
int init_sbusdisk(void) {
- if (prom_init())
+ if (prom_init(O_RDONLY))
return -1;
promvers = get_prom_ver();
check_aliases();
+ get_root_name();
scan_ide();
scan_scsi();
prom_walk_callback = scan_walk_callback;
@@ -531,12 +569,80 @@ int init_sbusdisk(void) {
return 0;
}
+void set_prom_vars(char *linuxAlias, char *bootDevice) {
+ int len;
+ if (prom_init(O_RDWR))
+ return;
+ if (linuxAlias && hasaliases) {
+ char *use_nvramrc;
+ char nvramrc[2048];
+ char *p, *q, *r;
+ int enabled = -1;
+ use_nvramrc = prom_getopt ("use-nvramrc?", &len);
+ if (len > 0) {
+ if (!strcasecmp (use_nvramrc, "false"))
+ enabled = 0;
+ else if (!strcasecmp (use_nvramrc, "true"))
+ enabled = 1;
+ printf ("use_nvramrc `%s' %d\n", use_nvramrc, len);
+ }
+ if (enabled != -1) {
+ p = prom_getopt ("nvramrc", &len);
+ if (p) {
+ memcpy (nvramrc, p, len);
+ nvramrc [len] = 0;
+ q = p;
+ while (q) {
+ /* If there is already `devalias linux /some/ugly/prom/path'
+ make sure we fully understand that and remove it. */
+ if (!strncmp (q, "devalias", 8) && (q[8] == ' ' || q[8] == '\t')) {
+ for (r = q + 9; *r == ' ' || *r == '\t'; r++);
+ if (!strncmp (r, "linux", 5) && (r[5] == ' ' || r[8] == '\t')) {
+ for (r += 6; *r == ' ' || *r == '\t'; r++);
+ for (; *r && *r != ' ' && *r != '\t' && *r != '\n'; r++);
+ for (; *r == ' ' || *r == '\t'; r++);
+ if (*r == '\n') {
+ r++;
+ memmove (q, r, strlen(r) + 1);
+ continue;
+ }
+ }
+ }
+ q = strchr (q, '\n');
+ }
+ len = strlen (nvramrc);
+ if (len && nvramrc [len-1] != '\n')
+ strcat (nvramrc, "\n");
+ strcat (nvramrc, "devalias linux ");
+ strcat (nvramrc, linuxAlias);
+ strcat (nvramrc, "\n");
+ prom_setopt ("nvramrc", nvramrc);
+ if (!enabled)
+ prom_setopt ("use-nvramrc?", "true");
+ }
+ }
+ }
+ if (bootDevice) {
+ char *p;
+ p = prom_getopt ("boot-device", &len);
+ if (p) {
+ prom_setopt ("boot-device", bootDevice);
+ prom_setopt ("boot-file", "");
+ } else {
+ p = prom_getopt ("boot-from", &len);
+ if (p)
+ prom_setopt ("boot-from", bootDevice);
+ }
+ }
+}
+
#ifdef STANDALONE_SILO
int main(void) {
int i;
init_sbusdisk();
+ set_prom_vars ("/sbus@2,0/SUNW,fas@1,8800000/sd@0,0", "linux");
for (i = 0; i < hdlen; i++) {
if (hd[i].type)
printf ("hd%c %x %d %d %d\n", i + 'a', hd[i].prom_node,
@@ -554,16 +660,21 @@ int main(void) {
if (sd[i].prom_name) printf ("%s\n", sd[i].prom_name);
}
}
+
#else
#include <Python.h>
-PyObject *disk2prompath (PyObject *, PyObject *);
-PyObject *has_aliases (void);
+static PyObject *disk2PromPath (PyObject *, PyObject *);
+static PyObject *hasAliases (void);
+static PyObject *promRootName (void);
+static PyObject *setPromVars (PyObject *, PyObject *);
static PyMethodDef _siloMethods[] = {
- { "disk2prompath", disk2prompath, 1 },
- { "has_aliases", has_aliases, 1 },
+ { "disk2PromPath", disk2PromPath, 1 },
+ { "hasAliases", hasAliases, 1 },
+ { "promRootName", promRootName, 1 },
+ { "setPromVars", setPromVars, 1 },
{ NULL, NULL }
};
@@ -579,8 +690,8 @@ init_silo ()
Py_FatalError ("can't initialize module _silo");
}
-PyObject *
-disk2prompath (PyObject *self, PyObject *args)
+static PyObject *
+disk2PromPath (PyObject *self, PyObject *args)
{
unsigned char *disk, prompath[1024];
int diskno = -1, part;
@@ -627,10 +738,29 @@ disk2prompath (PyObject *self, PyObject *args)
return Py_BuildValue ("s", prompath);
}
-PyObject *
-has_aliases (void)
+static PyObject *
+hasAliases (void)
{
return Py_BuildValue ("i", hasaliases);
-}
+}
+
+static PyObject *
+promRootName (void)
+{
+ return Py_BuildValue ("s", prom_root_name ? prom_root_name : "");
+}
+
+static PyObject *
+setPromVars (PyObject *self, PyObject *args)
+{
+ char *linuxAlias, *bootDevice;
+ if (!PyArg_ParseTuple (args, "ss", &linuxAlias, &bootDevice))
+ return NULL;
+ if (linuxAlias && !*linuxAlias) linuxAlias = NULL;
+ if (bootDevice && !*bootDevice) bootDevice = NULL;
+ set_prom_vars (linuxAlias, bootDevice);
+ Py_INCREF(Py_None);
+ return Py_None;
+}
#endif
diff --git a/iw/silo.py b/iw/silo.py
index b0ee4036b..c91f7275d 100644
--- a/iw/silo.py
+++ b/iw/silo.py
@@ -21,6 +21,7 @@ class SiloWindow (InstallWindow):
self.bootdisk = None
self.silo = None
self.linuxAlias = None
+ self.linuxAliasLabel = None
self.bootDevice = None
def getNext (self):
@@ -42,6 +43,15 @@ class SiloWindow (InstallWindow):
self.todo.setLiloImages(self.images)
+ linuxAlias = 0
+ bootDevice = 0
+ if self.linuxAlias.get_active ():
+ linuxAlias = 1
+ if self.bootDevice.get_active ():
+ bootDevice = 1
+
+ self.todo.silo.setPROM(linuxAlias, bootDevice)
+
def typeName(self, type):
if (type == 2):
return "Linux Native"
@@ -59,6 +69,21 @@ class SiloWindow (InstallWindow):
for n in [self.radioBox, self.editBox, self.imageList ]:
n.set_sensitive (state)
+ def mbr_toggled (self, widget, *args):
+ if widget.get_active ():
+ part = self.boothd
+ else:
+ part = self.bootpart
+ prompath = self.todo.silo.disk2PromPath(part)
+ if prompath and len(prompath) > 0:
+ self.linuxAliasLabel.set_text ("linux " + prompath)
+ if self.todo.silo.hasAliases():
+ self.linuxAliasLabel.set_sensitive (TRUE)
+ self.linuxAlias.set_sensitive (TRUE)
+ return
+ self.linuxAliasLabel.set_sensitive (FALSE)
+ self.linuxAlias.set_sensitive (FALSE)
+
def labelUpdated(self, *args):
index = self.imageList.selection[0]
device = self.imageList.get_text(index, 1)
@@ -115,6 +140,8 @@ class SiloWindow (InstallWindow):
if '/' not in self.todo.mounts.keys (): return None
(bootpart, boothd) = self.todo.silo.getSiloOptions()
+ self.bootpart = bootpart
+ self.boothd = boothd
format = "/dev/%s"
@@ -136,21 +163,24 @@ class SiloWindow (InstallWindow):
("/dev/%s %s" % (boothd, _("Master Boot Record (MBR)"))))
self.radioBox.attach(part, 1, 2, 2, 3)
self.radioBox.attach(self.mbr, 1, 2, 3, 4)
-
- print "bootpart ", bootpart, " ", self.todo.silo.disk2PromPath(bootpart)
+ self.mbr.connect("toggled", self.mbr_toggled)
# FIXME: Position this correctly
self.linuxAlias = GtkCheckButton(
- ("%s: linux %s" % (_("Create PROM alias"), self.todo.silo.disk2PromPath(bootpart))))
- self.radioBox.attach(self.linuxAlias, 0, 2, 4, 5)
+ _("Create PROM alias") + ":")
if (self.todo.silo.hasAliases()):
self.linuxAlias.set_active (TRUE)
else:
self.linuxAlias.set_active (FALSE)
- self.linuxAlias.set_sensitive (FALSE)
+ self.linuxAliasLabel = GtkLabel("")
+ self.mbr_toggled(self.mbr)
+ tempBox = GtkHBox (FALSE, 5)
+ tempBox.pack_start(self.linuxAlias)
+ tempBox.pack_start(self.linuxAliasLabel)
+ self.radioBox.attach(tempBox, 0, 2, 4, 5)
self.bootDevice = GtkCheckButton(_("Set default PROM boot device to linux"))
- self.radioBox.attach(self.bootDevice, 0, 2, 4, 6)
+ self.radioBox.attach(self.bootDevice, 0, 2, 5, 6)
self.bootDevice.set_active (TRUE)
label = GtkLabel(_("Kernel parameters") + ":")
@@ -162,7 +192,7 @@ class SiloWindow (InstallWindow):
alignment = GtkAlignment()
alignment.set(0.0, 0.5, 0, 1.0)
alignment.add(box)
- self.radioBox.attach(alignment, 0, 2, 5, 7)
+ self.radioBox.attach(alignment, 0, 2, 6, 7)
box = GtkVBox (FALSE, 0)
diff --git a/iw/xconfig.py b/iw/xconfig.py
index 7ce864723..f2ee3fd30 100644
--- a/iw/xconfig.py
+++ b/iw/xconfig.py
@@ -24,6 +24,7 @@ class XCustomWindow (InstallWindow):
self.ics.setNextEnabled (TRUE)
self.didTest = 0
+ self.sunServer = 0
def getNext (self):
newmodes = {}
@@ -104,6 +105,8 @@ class XConfigWindow (InstallWindow):
self.ics.setNextEnabled (TRUE)
self.todo = ics.getToDo ()
+ if self.todo.x.server and len (self.todo.x.server) >= 3 and self.todo.x.server[0:3] == 'Sun':
+ self.sunServer = 1
ics.setTitle (_("X Configuration"))
ics.readHTML ("xconf")
@@ -118,8 +121,9 @@ class XConfigWindow (InstallWindow):
setting = self.monlist.get_row_data (row)
self.todo.x.setMonitor (setting)
- if self.custom.get_active () and not self.skip.get_active ():
- return XCustomWindow
+ if not self.sunServer:
+ if self.custom.get_active () and not self.skip.get_active ():
+ return XCustomWindow
if not self.skip.get_active ():
if self.xdm.get_active ():
self.todo.initlevel = 5
@@ -183,7 +187,7 @@ class XConfigWindow (InstallWindow):
self.autoBox.pack_start (result, FALSE)
self.monlist = None
- if self.todo.x.monID == "Generic Monitor":
+ if ( not self.sunServer ) and self.todo.x.monID == "Generic Monitor":
label = GtkLabel (_("Your monitor could not be "
"autodetected. Please choose it "
"from the list below:"))
@@ -206,21 +210,23 @@ class XConfigWindow (InstallWindow):
sw.set_policy (POLICY_NEVER, POLICY_AUTOMATIC)
self.autoBox.pack_start (sw, TRUE, TRUE)
- test = GtkAlignment ()
- button = GtkButton (_("Test this configuration"))
- button.connect ("clicked", self.testPressed)
- test.add (button)
+ if not self.sunServer:
+ test = GtkAlignment ()
+ button = GtkButton (_("Test this configuration"))
+ button.connect ("clicked", self.testPressed)
+ test.add (button)
- self.custom = GtkCheckButton (_("Customize X Configuration"))
- self.custom.connect ("toggled", self.customToggled)
+ self.custom = GtkCheckButton (_("Customize X Configuration"))
+ self.custom.connect ("toggled", self.customToggled)
self.xdm = GtkCheckButton (_("Use Graphical Login"))
self.skip = GtkCheckButton (_("Skip X Configuration"))
self.skip.connect ("toggled", self.skipToggled)
- self.autoBox.pack_start (test, FALSE)
- self.autoBox.pack_start (self.custom, FALSE)
+ if not self.sunServer:
+ self.autoBox.pack_start (test, FALSE)
+ self.autoBox.pack_start (self.custom, FALSE)
self.autoBox.pack_start (self.xdm, FALSE)
box.pack_start (self.autoBox, TRUE, TRUE)
diff --git a/silo.py b/silo.py
index 84a4e7518..be0e5515e 100644
--- a/silo.py
+++ b/silo.py
@@ -6,8 +6,8 @@ import _silo
class SiloInstall:
def __init__ (self, todo):
self.todo = todo
- self.linuxalias = None
- self.bootdevice = None
+ self.linuxAlias = None
+ self.bootBevice = None
def getSiloImages(self):
todo = self.todo
@@ -79,11 +79,15 @@ class SiloInstall:
return 1
return 0
+ def setPROM(self, linuxAlias, bootDevice):
+ self.linuxAlias = linuxAlias
+ self.bootDevice = bootDevice
+
def hasAliases(self):
- return _silo.has_aliases()
+ return _silo.hasAliases()
def disk2PromPath(self,dev):
- return _silo.disk2prompath(dev)
+ return _silo.disk2PromPath(dev)
def installSilo (self):
todo = self.todo
@@ -95,19 +99,19 @@ class SiloInstall:
# OK - for this release we need to just blow away the old silo.conf
# just like we used to.
## # on upgrade read in the silo config file
-## if os.access (self.instPath + '/etc/silo.conf', os.R_OK):
-## silo.read (self.instPath + '/etc/silo.conf')
+## if os.access (todo.instPath + '/etc/silo.conf', os.R_OK):
+## silo.read (todo.instPath + '/etc/silo.conf')
## elif not todo.liloDevice: return
(bootpart, boothd) = self.getSiloOptions()
- smpInstalled = (self.hdList.has_key('kernel-smp') and
- self.hdList['kernel-smp'].selected)
+ smpInstalled = (self.todo.hdList.has_key('kernel-smp') and
+ self.todo.hdList['kernel-smp'].selected)
- if self.mounts.has_key ('/'):
- (dev, fstype, format) = self.mounts['/']
+ if self.todo.mounts.has_key ('/'):
+ (dev, fstype, format) = self.todo.mounts['/']
rootDev = dev
else:
- raise RuntimeError, "Installing lilo, but there is no root device"
+ raise RuntimeError, "Installing silo, but there is no root device"
args = [ "silo", "-r", todo.instPath ]
@@ -138,10 +142,10 @@ class SiloInstall:
label = main
if (smpInstalled):
- kernelList.append((main, self.hdList['kernel-smp'], "smp"))
+ kernelList.append((main, self.todo.hdList['kernel-smp'], "smp"))
label = main + "-up"
- kernelList.append((label, self.hdList['kernel'], ""))
+ kernelList.append((label, self.todo.hdList['kernel'], ""))
for (label, kernel, tag) in kernelList:
kernelTag = "-%s-%s%s" % (kernel['version'], kernel['release'], tag)
@@ -156,7 +160,7 @@ class SiloInstall:
sl = LiloConfiguration()
sl.addEntry("label", label)
- if os.access (self.instPath + initrd, os.R_OK):
+ if os.access (todo.instPath + initrd, os.R_OK):
sl.addEntry("initrd", initrdFile)
silo.addImage ("image", kernelFile, sl)
@@ -169,7 +173,7 @@ class SiloInstall:
# for (siloType, name, config) in silo.images:
# # remove entries for missing kernels (upgrade)
# if siloType == "image":
- # if not os.access (self.instPath + name, os.R_OK):
+ # if not os.access (todo.instPath + name, os.R_OK):
# silo.delImage (name)
# # remove entries for unbootable partitions
# elif siloType == "other":
@@ -188,7 +192,7 @@ class SiloInstall:
else: # duplicate entry, first entry wins
silo.delImage (name)
- silo.write(self.instPath + "/etc/silo.conf")
+ silo.write(todo.instPath + "/etc/silo.conf")
# XXX make me "not test mode"
if todo.setupFilesystems:
diff --git a/todo.py b/todo.py
index 5829b3ddb..b74de9e06 100644
--- a/todo.py
+++ b/todo.py
@@ -11,6 +11,7 @@ import _balkan
from simpleconfig import SimpleConfigFile
from mouse import Mouse
from xf86config import XF86Config
+import errno
def _(x):
return x
@@ -445,6 +446,7 @@ class ToDo:
self.expert = expert
self.progressWindow = None
self.swapCreated = 0
+ self.fdDevice = None
if (not instClass):
raise TypeError, "installation class expected"
if x:
@@ -458,6 +460,19 @@ class ToDo:
# This absolutely, positively MUST BE LAST
self.setClass(instClass)
+ def setFdDevice(self):
+ if self.fdDevice:
+ return
+ self.fdDevice = "/dev/fd0"
+ if iutil.getArch() == "sparc":
+ try:
+ f = open(self.fdDevice, "r")
+ except Exception, (errnum, msg):
+ if errno.errorcode[errnum] == 'ENXIO':
+ self.fdDevice = "/dev/fd1"
+ else:
+ f.close()
+
def umountFilesystems(self):
if (not self.setupFilesystems): return
@@ -726,6 +741,7 @@ class ToDo:
f = open (self.instPath + "/etc/fstab", "w")
keys = self.mounts.keys ()
keys.sort ()
+ self.setFdDevice ()
for mntpoint in keys:
(dev, fs, reformat) = self.mounts[mntpoint]
if (mntpoint == '/'):
@@ -737,7 +753,7 @@ class ToDo:
f.write (format % ( '/dev/' + dev, mntpoint, fs, 'noauto,owner,ro', 0, 0))
else:
f.write (format % ( '/dev/' + dev, mntpoint, fs, 'defaults', 0, 0))
- f.write (format % ("/dev/fd0", "/mnt/floppy", 'ext2', 'noauto,owner', 0, 0))
+ f.write (format % (self.fdDevice, "/mnt/floppy", 'ext2', 'noauto,owner', 0, 0))
f.write (format % ("none", "/proc", 'proc', 'defaults', 0, 0))
f.write (format % ("none", "/dev/pts", 'devpts', 'gid=5,mode=620', 0, 0))
f.close ()
@@ -801,11 +817,12 @@ class ToDo:
self.makeInitrd (kernelTag)
w = self.intf.waitWindow (_("Creating"), _("Creating boot disk..."))
+ self.setFdDevice ()
rc = iutil.execWithRedirect("/sbin/mkbootdisk",
[ "/sbin/mkbootdisk",
"--noprompt",
"--device",
- "/dev/fd0",
+ self.fdDevice,
kernelTag[1:] ],
stdout = None, stderr = None,
searchPath = 1, root = self.instPath)
@@ -1565,9 +1582,17 @@ class ToDo:
pcmcia.createPcmciaConfig(self.instPath + "/etc/sysconfig/pcmcia")
self.copyConfModules ()
if not self.x.skip and self.x.server:
- self.x.write (self.instPath + "/etc/X11/XF86Config")
- os.symlink ("../../usr/X11R6/bin/XF86_" + self.x.server,
- self.instPath + "/etc/X11/X")
+ if len (self.x.server) >= 3 and self.x.server[0:3] == 'Sun':
+ os.unlink(self.instPath + "/etc/X11/X")
+ script = open(self.instPath + "/etc/X11/X","w")
+ script.write("#!/bin/bash\n")
+ script.write("exec /usr/X11R6/bin/Xs%s -fp unix/:-1 $@\n" % self.x.server[1:])
+ script.close()
+ os.chmod(self.instPath + "/etc/X11/X", 0755)
+ else:
+ self.x.write (self.instPath + "/etc/X11/XF86Config")
+ os.symlink ("../../usr/X11R6/bin/XF86_" + self.x.server,
+ self.instPath + "/etc/X11/X")
self.setDefaultRunlevel ()
argv = [ "/usr/sbin/kudzu", "-q" ]
devnull = os.open("/dev/null", os.O_RDWR)
diff --git a/upd-instroot b/upd-instroot
index 154e14ae3..d7e961d07 100755
--- a/upd-instroot
+++ b/upd-instroot
@@ -6,7 +6,11 @@ if [ -z "$1" -o ! -d "$1" ]; then
exit 1
fi
-ARCH=`uname -m | sed -e 's/sparc64/sparc/' -e 's/i.86/i386/'`
+ARCH=`uname -m | sed -e 's/i.86/i386/'`
+
+if [ "$ARCH" = sparc64 ]; then
+ exec sparc32 $0 $*
+fi
HOMEDIR=`pwd`
echo HOMEDIR $HOMEDIR