Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Yann E. MORIN <yann.morin.1998@free.fr>
To: buildroot@busybox.net
Subject: [Buildroot] [PATCH 2/5] fs/custom: generate complete, partition-based device images
Date: Sat, 4 Jan 2014 18:43:03 +0100	[thread overview]
Message-ID: <20140104174303.GC3417@free.fr> (raw)
In-Reply-To: <CAGduivzPoHPtq3x9se0sEpaJDGvfK7R8GM3GZ9akyMBvqzBsbw@mail.gmail.com>

Maxime, All,

Thanks for the review! :-)

On 2014-01-04 17:38 +0100, Maxime Hadjinlian spake thusly:
> When doing scripting in Buildroot, do we accept the uses of various
> bash-ism or do we want to stick to POSIX shell ?

bash is already a hard-dependency of Buildroot.

> On Fri, Jan 3, 2014 at 6:19 PM, Yann E. MORIN <yann.morin.1998@free.fr> wrote:
[--SNIP--]
> > diff --git a/docs/manual/customize-filesystems.txt b/docs/manual/customize-filesystems.txt
> > new file mode 100644
> > index 0000000..fd65c97
> > --- /dev/null
> > +++ b/docs/manual/customize-filesystems.txt
> > @@ -0,0 +1,36 @@
[--SNIP--]
> How about comments ? Are they supported ?
> In a next step, it would be really nice to have support for "human"
> input for the different size, like 1G/M/K.

Yes, comments are supported; I've now added that to the manual.

I've also added that values can be expresed as shell arith,metic
expansion, such as $((16*1048576)) (aka 16MiB).

Not that G/M/k are SI-prefixes that respectively mean 10^9, 10^6 and
10^3. The binary prefixes are Gi/Mi/ki, respectively 2^30, 2^20 and
2^10.

If/when we add support for this kind of values, we'll need to add both
decimal and binary prefixes.

> > diff --git a/fs/custom/boot/gpt b/fs/custom/boot/gpt
> > new file mode 100644
> > index 0000000..f978524
> > --- /dev/null
> > +++ b/fs/custom/boot/gpt
> > @@ -0,0 +1,129 @@
[--SNIP--]
> > +#   Simg = 512 + 2*(Sgpt) + ?( aligned(Spart,512) )
> Don't we want only ASCII char there ?

I don't know.

I find it convenient not to limit ourselves to ASCII.

[--SNIP--]
> > +# Sicne 4k-large sectors are not really explained on Wikipedia, we can
> Small typo here.

Thanks, fixed.

[--SNIP--]
> > +    dd if=/dev/zero of="${img}"     \
> > +       bs=1 seek=${begin} count=0   \
> > +       conv=sparse                  2>/dev/null
> Why the redirect to /dev/null ? Don't we want to see if there was an
> error ? I know it's unlikely to happen but you never know.
> I have noticed you did several times so maybe there is a reason I am
> not seeing here.

dd will always print something to stderr, even if successful. We do not
want it to pollute the output, since we're using nice traces.

[--SNIP--]
> > +    ret=${?}
> > +    [ ${ret} -eq 0 ] || exit ${ret}
> Why not doing: [ ${ret} -ne 0 ] && exit ${ret} ?

Same answer as to your comment in squashfs, since we're using set -e.

But here, it's a bit complex. POSIX does not specify whether a sub-shell
that exits with a return code !0 should be caught by set -e. And bash-4.0
does not catch it, while bash-4.2 does catch it. Both are POSIX complianti
in this respect, since POSIX does not state what should be done in this
case.

So, we have to explicitly store the return code, and test it.

But if ret==0, your test would fail, and the complete shell compound
command " [ ... ] && ... " would also be false, and we would create an
error that the shell would catch because of set -e, when there was no
error to begin with.

Thank you for the comments! :-)

Regards,
Yann E. MORIN.

-- 
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 223 225 172 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'

  reply	other threads:[~2014-01-04 17:43 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-01-03 17:19 [Buildroot] [PATCH 0/5 v4] SUBJECT Yann E. MORIN
2014-01-03 17:19 ` [Buildroot] [PATCH 1/5] package/squashfs: add selection for the host variant Yann E. MORIN
2014-02-03 14:53   ` Thomas De Schampheleire
2014-02-08 22:20   ` Peter Korsgaard
2014-01-03 17:19 ` [Buildroot] [PATCH 2/5] fs/custom: generate complete, partition-based device images Yann E. MORIN
2014-01-04 16:38   ` Maxime Hadjinlian
2014-01-04 17:43     ` Yann E. MORIN [this message]
2014-01-04 17:52       ` Maxime Hadjinlian
2014-04-09 13:28   ` Andreas Naumann
2014-04-09 17:09     ` Yann E. MORIN
2014-04-10 13:53       ` Andreas Naumann
2014-01-03 17:19 ` [Buildroot] [PATCH 3/5] board/raspberrypi: provide partition description for the new genimages Yann E. MORIN
2014-01-04 16:40   ` Maxime Hadjinlian
2014-01-04 17:05     ` Yann E. MORIN
2014-01-04 17:12       ` Maxime Hadjinlian
2014-01-04 17:50         ` Yann E. MORIN
2014-01-04 17:57           ` Maxime Hadjinlian
2014-01-03 17:19 ` [Buildroot] [PATCH 4/5] fs/custom: add support for squashfs Yann E. MORIN
2014-01-04 16:43   ` Maxime Hadjinlian
2014-01-04 17:01     ` Yann E. MORIN
2014-01-03 17:19 ` [Buildroot] [PATCH 5/5] fs/custom: add support for raw device/partition content Yann E. MORIN
2014-01-03 17:22 ` [Buildroot] [PATCH 0/5 v4] SUBJECT Yann E. MORIN
  -- strict thread matches above, loose matches on Subject: below --
2017-08-29 11:27 [Buildroot] [PATCH 2/5] fs/custom: generate complete, partition-based device images Jan Schmidt
2017-08-29 21:24 ` Yann E. MORIN

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=20140104174303.GC3417@free.fr \
    --to=yann.morin.1998@free.fr \
    --cc=buildroot@busybox.net \
    /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