From: Stephen Warren <swarren@wwwdotorg.org>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH] fs: make it possible to read the filesystem UUID
Date: Mon, 03 Nov 2014 14:00:40 -0700 [thread overview]
Message-ID: <5457ECF8.9090603@wwwdotorg.org> (raw)
In-Reply-To: <1414768103-31231-1-git-send-email-christian.gmeiner@gmail.com>
On 10/31/2014 09:08 AM, Christian Gmeiner wrote:
> Some filesystems have a UUID stored in its superblock. To
> allow using root=UUID=... for the kernel command line we
> need a way to read-out the filesystem UUID.
>
> Hit any key to stop autoboot: 0
> => fsuuid
> fsuuid - Look up a filesystem UUID
>
> Usage:
> fsuuid <interface> <dev>:<part>
> - print filesystem UUID
> fsuuid <interface> <dev>:<part> <varname>
> - set environment variable to filesystem UUID
>
> => fsuuid mmc 0:1
> d9f9fc05-45ae-4a36-a616-fccce0e4f887
> => fsuuid mmc 0:2
> eb3db83c-7b28-499f-95ce-9e0bb21cda81
> => fsuuid mmc 0:1 uuid1
> => fsuuid mmc 0:2 uuid2
> => printenv uuid1
> uuid1=d9f9fc05-45ae-4a36-a616-fccce0e4f887
> => printenv uuid2
> uuid2=eb3db83c-7b28-499f-95ce-9e0bb21cda81
> =>
Acked-by: Stephen Warren <swarren@nvidia.com>
It'd be nice if you could implement fat_uuid() too, and plumb that in.
That could be a separate commit though I suppose.
IIRC, the kernel accepts the format NNNNNNNN-MM where NNNNNNNN is the
32-bit FAT disk ID (I don't recall the exact correct term) in 0-filled
hex and MM is the partition number in 0-filled decimal.
> diff --git a/fs/fs.c b/fs/fs.c
> +int fs_uuid(char *uuid_str)
> +{
> + struct fstype_info *info = fs_get_info(fs_type);
> + int ret = -ENOSYS;
> +
> + if (info->uuid)
> + ret = info->uuid(uuid_str);
> +
> + return ret;
> +}
Actually, that might be better as:
return info->uuid(uuid_str);
To make that work, you'd need to implement a fs_uuid_unsuported()
function and fill it in for all the fs types in fstypes[]. That would be
more consistent with the way other optional functionality works in this
file.
next prev parent reply other threads:[~2014-11-03 21:00 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-10-31 15:08 [U-Boot] [PATCH] fs: make it possible to read the filesystem UUID Christian Gmeiner
2014-11-01 15:13 ` Simon Glass
2014-11-03 10:47 ` Christian Gmeiner
2014-11-04 18:41 ` Simon Glass
2014-11-11 12:21 ` Christian Gmeiner
2014-11-03 21:00 ` Stephen Warren [this message]
2014-11-11 12:18 ` Christian Gmeiner
2014-11-04 6:31 ` Simon Glass
2014-11-11 12:20 ` Christian Gmeiner
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=5457ECF8.9090603@wwwdotorg.org \
--to=swarren@wwwdotorg.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox