~ubuntu-branches/debian/sid/partman-base/sid

« back to all changes in this revision

Viewing changes to parted_server.c

  • Committer: Package Import Robot
  • Author(s): Cyril Brulebois
  • Date: 2014-11-23 12:38:26 UTC
  • Revision ID: package-import@ubuntu.com-20141123123826-pw5isxg1odm9sya4
Tags: 180
Avoid overwriting the bootloader area on more platforms: detect
Freescale and AM33XX systems along with Allwinner ones, and disable
ped_disk_clobber on such systems, when the device is /dev/mmcblk0
(Closes: #770666). With many thanks to Vagrant Cascadian!

Show diffs side-by-side

added added

removed removed

Lines of Context:
1330
1330
        oprintf("OK\n");
1331
1331
}
1332
1332
 
1333
 
/* Check whether we are running on a sunxi-based system. */
 
1333
/* Check whether we are running on a sunxi-based, freescale-based, or
 
1334
   AM33XX (beaglebone black) system. */
1334
1335
int
1335
 
is_sunxi_system()
 
1336
is_system_with_firmware_on_disk()
1336
1337
{
1337
1338
        int cpuinfo_handle;
1338
1339
        int result = 0;
1345
1346
                        buf[length]='\0';
1346
1347
                        if (strstr(buf, "Allwinner") != NULL)
1347
1348
                                result = 1;
 
1349
                        else if (strstr(buf, "Freescale") != NULL)
 
1350
                                result = 1;
 
1351
                        else if (strstr(buf, "AM33XX") != NULL)
 
1352
                                result = 1;
1348
1353
                }
1349
1354
                close(cpuinfo_handle);
1350
1355
        }
1365
1370
         * the firmware area, resulting in an unbootable system (see
1366
1371
         * bug #751704).
1367
1372
         */
1368
 
        if (is_sunxi_system() && !strcmp(disk->dev->path, "/dev/mmcblk0")) {
 
1373
        if (is_system_with_firmware_on_disk() && !strcmp(disk->dev->path, "/dev/mmcblk0")) {
1369
1374
                disk->needs_clobber = 0;
1370
 
                log("Sunxi platform detected. Disabling ped_disk_clobber " \
 
1375
                log("Sunxi/Freescale/AM33XX detected. Disabling ped_disk_clobber" \
1371
1376
                    "for the boot device %s to protect the firmware " \
1372
1377
                    "area.", disk->dev->path);
1373
1378
        }