All of lore.kernel.org
 help / color / mirror / Atom feed
From: AKASHI Takahiro <takahiro.akashi@linaro.org>
To: u-boot@lists.denx.de
Subject: fat: handle Windows formatted partition (thru USB Mass Storage)
Date: Thu, 16 Jan 2020 11:01:10 +0900	[thread overview]
Message-ID: <20200116020108.GH28530@linaro.org> (raw)
In-Reply-To: <20200115001258.GG28530@linaro.org>

On Wed, Jan 15, 2020 at 09:12:59AM +0900, AKASHI Takahiro wrote:
> On Tue, Jan 14, 2020 at 02:43:43PM +0200, Andy Shevchenko wrote:
> > On Tue, Jan 14, 2020 at 10:23 AM Andy Shevchenko
> > <andy.shevchenko@gmail.com> wrote:
> > > On Tue, Jan 14, 2020 at 10:21 AM Andy Shevchenko
> > > <andy.shevchenko@gmail.com> wrote:
> > > > On Tue, Jan 14, 2020 at 1:14 AM Heinrich Schuchardt <xypron.glpk@gmx.de> wrote:
> > > > > On 1/13/20 10:52 PM, Andy Shevchenko wrote:
> > >
> > > ...
> > >
> > > > > This image loads fine on current U-Boot, see below.
> > > >
> > > > Of course it does *in the test case you have done*.
> > > > I'm describing different one. The provided image must be a *partition*
> > > > on the real disk.
> > > >
> > > > So, before use it the preparatory steps must be made.
> > > >
> > > > Something like
> > > >
> > > > % dd if=/dev/zero of=image-file bs=1M count=1000
> > > > % fdisk image-file
> > > >  ...create a partition table, where one partition has a (similar) size
> > > > of the image I provided
> > > > % mount -o loop,offset=... image-file /mnt # use *partition* as a disk!
> > > > % dd --sparse if=mmc-fat-part of=/mnt
> > > > % umount /mnt
> > > >
> > > > And use image-file instead.
> > >
> > > Should I prepare it for you or you can do it yourself?
> > 
> > It's there under name image-file.gz
> 
> ===8<===
> $ hd image-file
> 00000000  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
> *
> 000001b0  00 00 00 00 00 00 00 00  59 02 8c 89 00 00 00 20  |........Y...... |
> 000001c0  21 00 0c 08 27 62 00 08  00 00 01 00 18 00 00 00  |!...'b..........|
> 000001d0  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
> *
> (snip)
> 00100000  eb 3c 90 6d 6b 64 6f 73  66 73 00 00 02 20 01 00  |.<.mkdosfs... ..|
> 00100010  02 00 02 00 00 f8 c0 00  10 00 04 00 00 00 00 00  |................|
> 00100020  00 00 18 00 80 00 29 ea  36 23 57 20 20 20 20 20  |......).6#W     |
> 00100030  20 20 20 20 20 20 46 41  54 31 36 20 20 20 0e 1f  |      FAT16   ..|
> (snip)
> 001001d0  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
> *
> 001001f0  00 00 00 00 00 00 00 00  00 00 00 00 00 00 55 aa  |..............U.|
> 00100200  f8 ff ff ff 00 00 00 00  00 00 00 00 00 00 00 00  |................|
> 00100210  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
> *
> 00110000  eb 58 90 4d 53 44 4f 53  35 2e 30 00 02 08 1a 14  |.X.MSDOS5.0.....|
> 00110010  02 00 00 00 00 f8 00 00  3f 00 ff 00 80 00 00 00  |........?.......|
> 00110020  00 e8 17 00 f3 05 00 00  00 00 00 00 02 00 00 00  |................|
> 00110030  01 00 06 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
> 00110040  80 00 29 f8 a9 74 d0 4e  4f 20 4e 41 4d 45 20 20  |..)..t.NO NAME  |
> 00110050  20 20 46 41 54 33 32 20  20 20 33 c9 8e d1 bc f4  |  FAT32   3.....|
> (snip)
> ===>8===
> 
> [0x100000-0x100200) looks to be PBR.
> [0x110000-0x110050) looks to be MBR.
> But I don't know what is [0x0-0x100000).

(Correction)
[0x0-0x200) is actually a partition table:

00000000  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
*
000001b0  00 00 00 00 00 00 00 00  59 02 8c 89 00 00/00/20  |........Y...... |
                                                     ^^:boot_ind
			boot_ind: not ACTIVE
000001c0  21 00 0c 08 27 62/00 08  00 00/01 00 18 00/00 00  |!...'b..........|
                            p1's start   p1's size
                        start: 0x00000800 sector (= 0x100000)
                        size:  0x00180000 sectors
000001d0  00 00/00 00 00 00/00 00  00 00/00 00 00 00/00 00  |................|
*
000001f0  00 00 00 00 00 00 00 00  00 00 00 00 00 00 55 aa  |..............U.|
                                                     ^^^^^:magic number

And [0x100000-0x100200) is a PBR, which then points to a next-level
partition:

00100000  eb 3c 90 6d 6b 64 6f 73  66 73 00 00 02 20 01 00  |.<.mkdosfs... ..|
(snip)
001001b0  00 00 00 00 00 00 00 00  8c 60 88 d5 00 00/00/02/ |.........`......|
001001c0  03 00 0c fe 3f 60/80 00  00 00/00 e8 17 00/00 00  |....?`..........|
                            start        size
                        start: 0x00000080
                        size:  0x0017e800

> Obviously U-Boot's fat code cannot handle it.

So precisely, U-Boot cannot handle nested partition( table)s?

-Takahiro Akashi

> 
> Thanks,
> -Takahiro Akashi
> 
> 
> > Commit messages have the commands I performed to get this image cooked.
> > 
> > -- 
> > With Best Regards,
> > Andy Shevchenko

  reply	other threads:[~2020-01-16  2:01 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-26  8:29 [U-Boot] [PATCH] fs: fat: handle deleted directory entries correctly AKASHI Takahiro
2019-11-27  4:34 ` AKASHI Takahiro
2019-12-05 22:09 ` Tom Rini
2020-01-13 10:52   ` fat: handle Windows formatted partition (thru USB Mass Storage) Andy Shevchenko
2020-01-13 10:53     ` Fwd: " Andy Shevchenko
2020-01-13 16:34     ` Tom Rini
2020-01-13 17:55       ` Heinrich Schuchardt
2020-01-13 19:15         ` Andy Shevchenko
2020-01-13 19:22           ` Andy Shevchenko
2020-01-13 20:58             ` Andy Shevchenko
2020-01-13 21:05               ` Heinrich Schuchardt
2020-01-13 21:52                 ` Andy Shevchenko
2020-01-13 23:14                   ` Heinrich Schuchardt
2020-01-14  8:21                     ` Andy Shevchenko
2020-01-14  8:23                       ` Andy Shevchenko
2020-01-14 12:43                         ` Andy Shevchenko
2020-01-14 13:16                           ` Andy Shevchenko
2020-01-15  0:12                           ` AKASHI Takahiro
2020-01-16  2:01                             ` AKASHI Takahiro [this message]
2020-01-16 10:39                               ` Andy Shevchenko
2020-01-16 19:20                                 ` Heinrich Schuchardt
2020-01-16 20:31                                   ` Andy Shevchenko
2020-01-17  6:12                                     ` AKASHI Takahiro
2020-01-17  9:47                                       ` Andy Shevchenko
2020-01-17 14:51                                         ` Tom Rini
2020-01-21  0:39                                         ` AKASHI Takahiro
2020-01-21 16:13                                           ` Andy Shevchenko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200116020108.GH28530@linaro.org \
    --to=takahiro.akashi@linaro.org \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.