Hi,
As the consensus seems to be that silo checks belong better in silo-installer, I have updated the patch by moving it to silo-installer and adding a check that the disk where kernel is installed has sun disklabel. Note that this check depends on the new parted_server command GET_DISK_TYPE, for which the patch has been submitted as #287931. Patch against current svn source of silo-installer is attached. IMPORTANT: the patch creates a new file finish.d/silo_check, which must be executable. As patch does not have control over file permissions, whoever is going to commit it has to 'chmod +x finish.d/silo_check' after applying the patch, otherwise it will not run!
Best regards,
Jurij Smakov [EMAIL PROTECTED] Key: http://www.wooyd.org/pgpkey/ KeyID: C99E03CC
diff -aurN --exclude po --exclude .svn silo-installer_orig/debian/rules silo-installer/debian/rules --- silo-installer_orig/debian/rules 2004-12-30 01:41:57.000000000 -0500 +++ silo-installer/debian/rules 2004-12-29 17:02:44.000000000 -0500 @@ -18,7 +18,7 @@ dh_clean -k dh_installdebconf dh_installdeb -# debian/install-rc finish.d + debian/install-rc finish.d dh_gencontrol dh_builddeb diff -aurN --exclude po --exclude .svn silo-installer_orig/debian/silo-installer.templates silo-installer/debian/silo-installer.templates --- silo-installer_orig/debian/silo-installer.templates 2004-12-30 01:41:57.000000000 -0500 +++ silo-installer/debian/silo-installer.templates 2004-12-29 18:06:48.000000000 -0500 @@ -22,36 +22,37 @@ # Main menu text _Description: Install the SILO boot loader on a hard disk -Template: silo-installer/non-sun-partitions -Type: boolean -Default: false -_Description: Install /boot on a disk with an unsupported partition table? - To be bootable from the PROM, silo and the kernel it loads must be - installed on a disk which uses Sun disklabels for its partition - table. Your /boot directory is not located on such a disk. If you - proceed, you will not be able to boot your system using SILO, and will - need to boot it some other way. +Template: silo-installer/silo_bad_fs +Type: note +_Description: Warning: unsupported boot filesystem type! + In order to be successfully loaded by SILO (Sparc Linux Loader), the + kernel must reside on an ext2, ext3 or ufs formatted partition. In + the current partitioning scheme the kernel is going to be installed + on the ${SILO_PART} partition of type ${SILO_TYPE}. It is strongly + recommended that you go back to partitioning and correct this + problem. Keeping the current configuration may result in an + unbootable system. -Template: silo-installer/non-ext2-boot -Type: boolean -Default: false -_Description: Use unsupported filesystem type for /boot? - SILO requires /boot to be located on an ext2 or ext3 partition on - a bootable device. This means that either the root partition must be - an ext2 filesystem, or you must have a separate ext2 partition mounted at - /boot. - . - Currently, /boot is located on a partition of type ${PARTTYPE}. If you - keep this setting, you will not be able to boot your Debian system - using SILO. +Template: silo-installer/silo_too_far +Type: note +_Description: Warning: boot partition may cause problems with SILO! + This machine is likely to suffer from a firmware bug, which makes it + impossible for SILO (Sparc Linux Loader) to boot a kernel placed + farther than 1 GB from the beginning of the disk. To avoid problems + it is strongly recommended to install the kernel into a partition + which fits entirely within the first GB of the disk (by creating a + small /boot partition in the beginning of the disk, for example). In + the current partitioning scheme it is going to be installed onto the + ${SILO_PART} partition which extends up to ${SILO_OFF} mark. Keeping + this configuration may result in an unbootable system. -Template: silo-installer/boot-after-1024cyl -Type: boolean -Default: false -_Description: Install /boot on a disk with an unsupported partition table? - You are using a 32-bit SPARC machine. On many of these, it is unlikely that - Debian will boot if /boot resides in a partition that extends past the - first 1024 cylinders of the hard disk. /boot currently resides in a - partition that extends to cylinder ${CYL}. You should change this by reducing - the size of the partition or creating a separate, smaller partition just for - /boot. +Template: silo-installer/silo_bad_disk +Type: note +_Description: Warning: unsupported partition table on the boot disk! + SILO (Sparc Linux Loader) can only boot the kernel off a disk with + the "sun" partition table. In the current partitioning scheme the + kernel is going to be installed on the ${SILO_PART} partition located + on a disk with the partition table of type "${SILO_DISK}". It is + strongly recommended that you go back to partitioning and correct + this problem. Keeping the current configuration may result in an + unbootable system. diff -aurN --exclude po --exclude .svn silo-installer_orig/finish.d/find_silo_bootable_disk silo-installer/finish.d/find_silo_bootable_disk --- silo-installer_orig/finish.d/find_silo_bootable_disk 2004-12-30 01:41:57.000000000 -0500 +++ silo-installer/finish.d/find_silo_bootable_disk 1969-12-31 19:00:00.000000000 -0500 @@ -1,92 +0,0 @@ -#!/bin/sh -e - -. /lib/partman/definitions.sh - -# Verify that /boot is on an ext2/3 partition on a disk using Sun -# disklabels, so that the system will actually be bootable. - -get_silo_root_boot() { - (for i in /lib/partman/fstab.d/*; do - [ -x "$i" ] || continue - $i - done) | - while read fs mp type options dump pass - do - if [ "$mp" = / ]; then - echo "root_type=$type; root_fs=$fs;" - elif [ "$mp" = /boot ]; then - echo "boot_type=$type; boot_fs=$fs;" - fi - done -} - -eval "$(get_silo_root_boot)" - -if [ -z "$boot_fs" ] -then - boot_fs=$root_fs - boot_type=$root_type -fi - -disk= -for dev in $DEVICES/* -do - [ -d "$dev" ] || continue - cd $dev - partitions= - open_dialog PARTITIONS - while { read_line num id size type fs path name; [ "$id" ]; }; do - if [ -d "$id" ] && [ "$path" = "$boot_fs" ]; then - ourdev=$dev - disk="$(cat ${dev}/device)" - break - fi - done - close_dialog - - # We got /boot or /. Hooray! - if [ -n "$disk" ]; then - # /boot or / goes past the 1024cyl barrier - open_dialog GET_CHS "$id" - read_line start_cyl start_head start_sector end_cyl end_head end_sector - close_dialog - - # Only sparc32 suffers from this problem though. - if [ "$end_cyl" -gt 1024 ] && [ "$(archdetect)" = sparc/sparc32 ]; then - db_subst silo-installer/boot-after-1024cyl CYL "$end_cyl" - db_input critical silo-installer/boot-after-1024cyl - db_go - db_get silo-installer/boot-after-1024cyl - # Bail out - if [ "$RET" = false ]; then - exit 1 - fi - fi - break - fi -done - -# Make sure the disk is using a Sun disklabel or nothing will boot! - -label=$(parted "$disk" print | sed -n 's/Disk label type: //p') -if [ "$label" != sun ]; then - db_input critical silo-installer/non-sun-partitions - db_go - db_get silo-installer/non-sun-partitions - if [ "$RET" = false ]; then - exit 1 - fi -fi - -# SILO only groks ext2/3. - -if [ "$boot_type" != ext2 ] && [ "$boot_type" != ext3 ] -then - db_subst silo-installer/non-ext2-boot PARTTYPE $boot_type - db_input critical silo-installer/non-ext2-boot - db_go - db_get silo-installer/non-ext2-boot - if [ "$RET" = false ]; then - exit 1 - fi -fi diff -aurN --exclude po --exclude .svn silo-installer_orig/finish.d/_numbers silo-installer/finish.d/_numbers --- silo-installer_orig/finish.d/_numbers 2004-12-30 01:41:57.000000000 -0500 +++ silo-installer/finish.d/_numbers 2004-12-29 17:02:30.000000000 -0500 @@ -1 +1 @@ -05 find_silo_bootable_disk +05 silo_check diff -aurN --exclude po --exclude .svn silo-installer_orig/finish.d/silo_check silo-installer/finish.d/silo_check --- silo-installer_orig/finish.d/silo_check 1969-12-31 19:00:00.000000000 -0500 +++ silo-installer/finish.d/silo_check 2004-12-30 01:41:34.000000000 -0500 @@ -0,0 +1,98 @@ +#!/bin/sh +# +# SILO can only boot from ext[23] or ufs filesystem, located on a disk +# with a sun disklabel. Also, if the old PROM version is used (major +# version <= 2), the complete partition where kernel is installed must +# fit within 1GB from the beginning of the disk. +# +# -- Jurij Smakov <[EMAIL PROTECTED]> Thu, 30 Dec 2004 01:40:34 -0500 + +. /lib/partman/definitions.sh + +check_sparc() +{ + arch=$(archdetect 2>/dev/null) || exit 0 + cpu="${arch%%/*}" + [ "${cpu}" = "sparc" ] || exit 0 +} + +prom_major_version() +{ + [ -f /proc/cpuinfo ] || exit 0 + prom="$(grep '^prom' /proc/cpuinfo | grep -v '^promlib')" + prom_version="${prom##*: }" + prom_major="${prom_version%%.*}" + echo "prom_major=${prom_major}" +} + +boot_part_params() +{ + result='' + startdir="$(pwd)" + for dev in $DEVICES/*; do + [ -d "$dev" ] || continue + cd $dev + partitions='' + open_dialog PARTITIONS + while { read_line num id size type fs path name; [ "$id" ]; }; do + [ -f "${id}/mountpoint" ] || continue + mp=$(cat ${id}/mountpoint) + [ "${mp}" = /boot ] && \ + result="boot_name=${mp} boot_fs=${fs} boot_last=${id##*-} boot_dev=${dev}" + [ "${mp}" = / ] && [ -z "${result}" ] && \ + result="boot_name=${mp} boot_fs=${fs} boot_last=${id##*-} boot_dev=${dev}" + done + close_dialog +done +cd "${startdir}" +echo "${result}" +} + +silo_limit_check() +{ + if ! longint_le "${boot_last}" 1073741824 ; then + db_subst silo-installer/silo_too_far SILO_PART "${boot_name}" + db_subst silo-installer/silo_too_far SILO_OFF "$(longint2human ${boot_last})" + db_input critical silo-installer/silo_too_far || true + db_go || exit 1 + fi +} + +silo_boot_fs_check() +{ + case "${boot_fs}" in + ext2|ext3|ufs) + ;; + *) + db_subst silo-installer/silo_bad_fs SILO_PART "${boot_name}" + db_subst silo-installer/silo_bad_fs SILO_TYPE "${boot_fs}" + db_input critical silo-installer/silo_bad_fs || true + db_go || exit 1 + ;; + esac +} + +silo_disk_type_check() +{ + if [ "${boot_dev}" ]; then + cd "${boot_dev}" + open_dialog GET_DISK_TYPE + read_line disk_type + close_dialog + if [ "${disk_type}" != "sun" ]; then + db_subst silo-installer/silo_bad_disk SILO_PART "${boot_name}" + db_subst silo-installer/silo_bad_disk SILO_DISK "${disk_type}" + db_input critical silo-installer/silo_bad_disk || true + db_go || exit 1 + fi + fi +} + +check_sparc +eval "$(boot_part_params)" +silo_disk_type_check +silo_boot_fs_check +eval "$(prom_major_version)" +[ -n "${prom_major}" ] || exit 0 +[ "${prom_major}" -le 2 ] || exit 0 +silo_limit_check