Control: tag -1 patch On Wed, Jun 18, 2014 at 09:44:12PM +0200, Karsten Merker wrote:
[On sunxi-based systems, upon writing the partition table, partman overwrites parts of u-boot which are located between the end of the partition table and the beginning of the first partition.] Hello, the following patch solves the issue for me. I have run a successful jessie installation on a Cubietruck with this patch applied to a locally built d-i based on kernel 3.16 from experimental. If there are no objections, I would like apply it to the partman-base git repository. Regards, Karsten >From 35d41e3bfce60fd08c4da6dc0696a479c78bdcdd Mon Sep 17 00:00:00 2001 From: Karsten Merker <mer...@debian.org> Date: Tue, 12 Aug 2014 23:10:13 +0200 Subject: [PATCH] Take care of the firmware area on sunxi-based systems By default partman calls ped_disk_clobber when writing the partition table, but on sunxi-based systems this would overwrite the firmware area, resulting in an unbootable system (see bug #751704). Handle this as a special case in command_commit(). --- parted_server.c | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/parted_server.c b/parted_server.c index 55cf151..bc4523a 100644 --- a/parted_server.c +++ b/parted_server.c @@ -1330,6 +1330,25 @@ command_dump() oprintf("OK\n"); } +/* Check whether we are running on a sunxi-based system. */ +int +is_sunxi_system() +{ + int cpuinfo_handle; + int result=0; + char buf[4096]; + int length; + + if ((cpuinfo_handle = open("/proc/cpuinfo", O_RDONLY)) != -1 ) { + length = read(cpuinfo_handle, buf, sizeof(buf)-1); + buf[length]='\0'; + if (strstr(buf,"Allwinner")!=NULL) + result=1; + close(cpuinfo_handle); + } + return result; +} + void command_commit() { @@ -1337,6 +1356,21 @@ command_commit() if (dev == NULL) critical_error("The device %s is not opened.", device_name); log("command_commit()"); + + /* + * The boot device on sunxi-based systems needs special handling. + * By default partman calls ped_disk_clobber when writing the + * partition table, but on sunxi-based systems this would overwrite + * the firmware area, resulting in an unbootable system (see + * bug #751704). + */ + if (is_sunxi_system() && !strcmp(disk->dev->path, "/dev/mmcblk0")) { + disk->needs_clobber=0; + log("Sunxi platform detected. Disabling ped_disk_clobber " \ + "for the boot device %s to protect the firmware " \ + "area.", disk->dev->path); + } + open_out(); if (disk != NULL && named_is_changed(device_name)) ped_disk_commit(disk); -- 2.1.0.rc1 -- Gem. Par. 28 Abs. 4 Bundesdatenschutzgesetz widerspreche ich der Nutzung sowie der Weitergabe meiner personenbezogenen Daten für Zwecke der Werbung sowie der Markt- oder Meinungsforschung. -- To UNSUBSCRIBE, email to debian-boot-requ...@lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org Archive: https://lists.debian.org/20140812223858.ga9...@excalibur.cnev.de