Bug 9691

Summary: new dosfstools changes sectors-per-track, breaks image generation
Product: [Build System, Metadata & Runtime] OE-Core Reporter: Jussi Kukkonen <jku>
Component: devtools / tool chainAssignee: Jussi Kukkonen <jku>
Status: RESOLVED FIXED QA Contact: Francisco Pedraza <francisco.j.pedraza.gonzalez>
Severity: normal    
Priority: High CC: bluelightning, jose.perez.carranza, meta.mr.watcher, meta.watcher
Version: unspecified   
Target Milestone: 2.2 M1   
Hardware: x86   
OS: Multiple   
Whiteboard:
OS type for building Yocto: --- Type of Regression: New (Never tested)
Verified: Documentation change: No (bug/feature does not impact docs)

Description Jussi Kukkonen 2016-05-31 18:45:44 UTC
Our image generation scripts got to some lengths to ensure that the number of sectors on a filesystem is divisible by sectors-per-track because "mcopy" has a sanity check for that. sectors-per-track is (AFAIK) a made up number decided by
dosfstools and is not configurable.

This has become quite tricky with new dosfstools:
* dosfstools < 4.0 uses 32 sectors-per-track as the default
* dosfstools 4.0 uses 63 sectors-per-track as the default
* dosfstools git master uses a variable sectors-per-track
  (32 for small fs, 63 for larger ones)

To make matters worse we have two versions of dosfstools (2.11 and the current one).

Options:
* Fix the image generation scripts to use correct sectors-per-track for 4.0 as in http://git.yoctoproject.org/cgit/cgit.cgi/poky-contrib/log/?h=jku/dosfstools . This won't work for the next version and won't work with 2.11...
* Make mcopy work even if the sanity check fails. I think this will work, but am not 100% sure -- will some other tool barf on the 'broken' filesystem?
* Modify one of the dosfstools versions to do the same thing as the other
Comment 1 Jussi Kukkonen 2016-06-02 08:34:04 UTC
> * Make mcopy work even if the sanity check fails

After reading a little more about it and talking to dosfstools maintainer, this is the solution I'm going with. Sending patches shortly.
Comment 2 Jussi Kukkonen 2016-06-20 12:43:34 UTC
commit 469e56b1a7c8da38cb4c572c5609c86b8c9768dd
Author: Jussi Kukkonen <jussi.kukkonen@intel.com>
Date:   Thu Jun 2 13:49:33 2016 +0300

    image-live, image-vm, wic: Remove fs size workaround
    
    Since mtools has been patched to live with filesystems with sizes
    not divisible by sectors-per-track, we no longer need to try to
    set the size based on our guess of the sectors-per-track dosfstools is
    going to use.
    
    (From OE-Core rev: 334e32af88b310ff1ed950d127a6dedeb460f8d0)
    
    Signed-off-by: Jussi Kukkonen <jussi.kukkonen@intel.com>
    Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>

commit 48bc62378a3705730f376ca03c2d6efe7a98d924
Author: Jussi Kukkonen <jussi.kukkonen@intel.com>
Date:   Thu Jun 2 13:49:32 2016 +0300

    mtools: Patch out a useless sanity check
    
    The sanity check is ensuring that filesystem size is divisible by
    sectors-per-track. That seems to be just an optimization for ancient
    media, and quite tricky to accomplish as different dosfstools versions
    produce filesystems with different sectors-per-track.
    
    Continue processing even if filesystem size is not divisible by
    sectors-per-track.
    
    (From OE-Core rev: 970cdbe26d9b6d0bd93325c8e734416e679010df)
    
    Signed-off-by: Jussi Kukkonen <jussi.kukkonen@intel.com>
    Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>