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

Bug#751704: bug#18289: libparted ped_disk_clobber() overwrites firmware on some arm systems



On Mon, Aug 18, 2014 at 09:59:49AM -0700, Brian C. Lane wrote:
> On Mon, Aug 18, 2014 at 08:19:17AM +0200, Karsten Merker wrote:
> > Hello,
> > 
> > the following is a discussion from the Debian bugtracking system regarding
> > Debian Bug#751704 (https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=751704).
> > It needs involvement from parted upstream, therefore I am forwarding it to 
> > bug-parted@gnu.org.
> 
> Thanks for forwarding this. parted should only be clobbering these extra
> sectors when a new disklabel is applied (eg. mklabel in the ui) which, I
> think, is the appropriate thing to do.
> 
> If you are operating on an existing disklabel and want to preserver a
> boot loader in the space before the 1st partition you shouldn't be
> calling ped_disk_new_fresh(). If you are creating a new disklabel then
> any boot loader code should be installed after partitioning.
> 
> I don't think parted needs any changes.

Hello,

thanks for your swift reply. I fully understand your position,
but unfortunately things on arm are fundamentally different from
the PC world.  U-Boot is more of a BIOS than a bootloader like
GRUB; it is highly board specific and handles low-level stuff
such as setting the IO pinmuxing for the specific board and
configuring the DRAM controller.  Without it, the board is
completely dead from a user perspective.

On a PC, the BIOS is always available in ROM/Flash even when all
disk devices have been wiped and the user can still select some
other device (such as the network, a CDROM drive or a USB memory
stick) to boot from.  On the arm systems we are talking about,
there is no ROM BIOS and the u-boot image on the SD card (or on
an eMMC chip) is the only way to interact with the system at all. 
The usual case is that the u-boot image is written raw onto the
storage medium, i.e. there is no partition table or filesystem
on it by default, so we need to create a new disklabel in the
installer.

You are fully right that normally a bootloader should be
installed after partitioning.  This works well for the case of a
bootloader that uses universally available BIOS functions and is
not hardware-specific, such as is the case on PCs.  In the case
of u-boot on the other hand, in PC-lingo we would have to provide
the installer with the ability to flash the BIOS for every PC
model on the market as part of the operating system installation,
which is not feasible.  We might be able to do that for a small
selection of devices, but not for all of them --> we need to keep
the u-boot image that is on the device even when creating a new
disklabel, but we are unsure what is the best way to handle this.

The approach in https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=751704#60
(setting PedDisk.needs_clobber to 0 before calling ped_disk_commit
for specific devices) works in practice, but the question was
whether it is ok for the calling application to fiddle around with
the needs_clobber flag, or whether we should take some other
approach.

Kind Regards,
Karsten
-- 
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.


Reply to: