Package: grub-installer Version: 1.91 Severity: normal Tags: patch User: debian-powe...@lists.debian.org Usertags: ppc64el
Dear Maintainer, here is a patch from Ubuntu to add support for the ppc64el architecture. Thank you, F. -- System Information: Debian Release: jessie/sid APT prefers unstable APT policy: (500, 'unstable') Architecture: ppc64el (ppc64le) Kernel: Linux 3.14-1-powerpc64le (SMP w/1 CPU core) Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8) (ignored: LC_ALL set to en_US.UTF-8) Shell: /bin/sh linked to /bin/dash
diff -Nru grub-installer-1.91/debian/control grub-installer-1.91/debian/control --- grub-installer-1.91/debian/control 2013-07-13 07:09:07.000000000 +0000 +++ grub-installer-1.91/debian/control 2014-05-16 14:35:00.000000000 +0000 @@ -8,7 +8,7 @@ Vcs-Git: git://anonscm.debian.org/d-i/grub-installer.git Package: grub-installer -Architecture: i386 hurd-i386 amd64 kfreebsd-i386 kfreebsd-amd64 powerpc mipsel +Architecture: i386 hurd-i386 amd64 kfreebsd-i386 kfreebsd-amd64 powerpc ppc64el mipsel XB-Subarchitecture: ${subarch} Provides: bootable-system Depends: cdebconf-udeb, kernel-installer, created-fstab, di-utils (>= 1.15), di-utils-mapdevfs, os-prober, partman-utils diff -Nru grub-installer-1.91/debian/grub-installer.install grub-installer-1.91/debian/grub-installer.install --- grub-installer-1.91/debian/grub-installer.install 2011-07-31 01:01:26.000000000 +0000 +++ grub-installer-1.91/debian/grub-installer.install 2014-05-16 14:39:53.000000000 +0000 @@ -3,3 +3,4 @@ functions.sh usr/share/grub-installer otheros.sh usr/share/grub-installer ensure-active usr/lib/grub-installer +prep-bootdev usr/lib/grub-installer diff -Nru grub-installer-1.91/grub-installer grub-installer-1.91/grub-installer --- grub-installer-1.91/grub-installer 2013-07-13 07:09:07.000000000 +0000 +++ grub-installer-1.91/grub-installer 2014-05-16 14:35:00.000000000 +0000 @@ -331,6 +331,9 @@ grub_package="grub-ieee1275" experimental_arch ;; + ppc64el/*) + grub_package="grub-ieee1275" + ;; mipsel/loongson-2f) grub_package="grub-yeeloong" ;; @@ -581,6 +584,10 @@ fi fi ;; + ppc64el/*:grub-ieee1275) + bootdev="$(/usr/lib/grub-installer/prep-bootdev)" + state=3 + ;; *) # No need for install device selection on other platforms. bootdev=dummy @@ -765,9 +772,16 @@ grub_install_params="$grub_install_params --force" fi + case $ARCH:$grub_package in + ppc64el/*:grub-ieee1275) + info "Wiping PReP partition $bootdev" + log-output -t grub-installer dd if=/dev/zero of="$bootdev" bs=512 count="$(blockdev --getsz "$bootdev")" + ;; + esac + CODE=0 case $ARCH:$grub_package in - *:grub|*:grub-pc|*:grub-efi|sparc:grub-ieee1275) + *:grub|*:grub-pc|*:grub-efi|sparc:grub-ieee1275|ppc64el/*:grub-ieee1275) info "Running $chroot $ROOT grub-install $grub_install_params \"$bootdev\"" log-output -t grub-installer $chroot $ROOT grub-install $grub_install_params "$bootdev" || CODE=$? ;; @@ -780,7 +794,7 @@ info "grub-install ran successfully" else case $ARCH:$grub_package in - *:grub|*:grub-pc|*:grub-efi|sparc:grub-ieee1275) + *:grub|*:grub-pc|*:grub-efi|sparc:grub-ieee1275|ppc64el/*:grub-ieee1275) error "Running 'grub-install $grub_install_params \"$bootdev\"' failed." ;; *) diff -Nru grub-installer-1.91/Makefile grub-installer-1.91/Makefile --- grub-installer-1.91/Makefile 2011-07-31 01:01:26.000000000 +0000 +++ grub-installer-1.91/Makefile 2014-05-16 14:39:53.000000000 +0000 @@ -1,9 +1,12 @@ CFLAGS := -Os -g -Wall -all: ensure-active +all: ensure-active prep-bootdev ensure-active: ensure-active.c $(CC) $(CFLAGS) $^ -o $@ -lparted +prep-bootdev: prep-bootdev.c + $(CC) $(CFLAGS) $^ -o $@ -lparted + clean: - rm -f ensure-active + rm -f ensure-active prep-bootdev diff -Nru grub-installer-1.91/prep-bootdev.c grub-installer-1.91/prep-bootdev.c --- grub-installer-1.91/prep-bootdev.c 1970-01-01 00:00:00.000000000 +0000 +++ grub-installer-1.91/prep-bootdev.c 2014-05-21 15:16:14.000000000 +0000 @@ -0,0 +1,39 @@ +#include <stdio.h> +#include <stdlib.h> +#include <parted/parted.h> + +int +main(int argc, char *argv[]) +{ + PedDevice *dev; + + ped_exception_fetch_all(); + ped_device_probe_all(); + for (dev = ped_device_get_next(NULL); dev; + dev = ped_device_get_next(dev)) { + PedDisk *disk; + PedPartition *part; + + disk = ped_disk_new(dev); + if (!disk) + continue; + + for (part = ped_disk_next_partition(disk, NULL); part; + part = ped_disk_next_partition(disk, part)) { + if (ped_partition_is_active(part) && + ped_partition_get_flag(part, PED_PARTITION_PREP)) { + char *path; + + path = ped_partition_get_path(part); + if (path) { + printf("%s\n", path); + free(path); + return 0; + } + free(path); + } + } + } + + return 0; +}