[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Bug#770666: partman-base: partman overwrites parts of u-boot (imx6/am335x)



Vagrant Cascadian <vagrant@debian.org> (2014-11-22):
> Package: partman-base
> Version: 179
> Severity: important
> Tags: patch
> 
> Several armhf platforms have u-boot installed directly to the device
> in an area which gets wiped out by partman. This results in
> debian-installer producing a "successful" install, but zeros out the
> location of the bootloader in the process... so fails to boot.
> 
> This was fixed for sunxi/allwinner platforms (see:
> https://bugs.debian.org/751704), but other platforms such as imx6
> (Wandboard, CuBox-i) and am335x (BeagleBone Black) are still affected
> by the issue.
> 
> The following proof-of-concept patch may be a little too broad,
> affecting all Freescale or AM33XX systems, although it is limited to
> installs to /dev/mmcblk0. BeagleBone Black may also need this code
> when installing to /dev/mmcblk1...

I've committed it as-is for now, and uploaded partman-base 180.
debian-arm@ people may want to give daily images a shot once a build has
happened with that version.

Thanks!

Mraw,
KiBi.

> Essentially it renames the is_sunxi_system to
> is_system_with_firmware_on_disk, and adds cases for the additional
> platforms.
> 
> 
> diff --git a/parted_server.c b/parted_server.c
> index 808a85f..e9e72a0 100644
> --- a/parted_server.c
> +++ b/parted_server.c
> @@ -1330,9 +1330,10 @@ command_dump()
>          oprintf("OK\n");
>  }
>  
> -/* Check whether we are running on a sunxi-based system. */
> +/* Check whether we are running on a sunxi-based, freescale-based, or
> +   AM33XX (beaglebone black) system. */
>  int
> -is_sunxi_system()
> +is_system_with_firmware_on_disk()
>  {
>          int cpuinfo_handle;
>          int result = 0;
> @@ -1345,6 +1346,10 @@ is_sunxi_system()
>                          buf[length]='\0';
>                          if (strstr(buf, "Allwinner") != NULL)
>                                  result = 1;
> +                        else if (strstr(buf, "Freescale") != NULL)
> +                                result = 1;
> +                        else if (strstr(buf, "AM33XX") != NULL)
> +                                result = 1;
>                  }
>                  close(cpuinfo_handle);
>          }
> @@ -1365,9 +1370,9 @@ command_commit()
>           * the firmware area, resulting in an unbootable system (see
>           * bug #751704).
>           */
> -        if (is_sunxi_system() && !strcmp(disk->dev->path, "/dev/mmcblk0")) {
> +        if (is_system_with_firmware_on_disk() && !strcmp(disk->dev->path, "/dev/mmcblk0")) {
>                  disk->needs_clobber = 0;
> -                log("Sunxi platform detected. Disabling ped_disk_clobber " \
> +                log("Sunxi/Freescale/AM33XX detected. Disabling ped_disk_clobber" \
>                      "for the boot device %s to protect the firmware " \
>                      "area.", disk->dev->path);
>          }
> 
> 
> Thanks for considering!
> 
> live well,
>   vagrant

Attachment: signature.asc
Description: Digital signature


Reply to: