Slides "Using Buildroot for real projects"
Hello,
At ELCE, I will be talking about "Using Buildroot for real projects". You can see my talk summary at
https://events.linuxfoundation.org/events/embedded-linux-conference-europe/petazzoni.
The current (unfinished) status of my slides is visible at:
http://free-electrons.com/~thomas/pub/using-buildroot-real-project.pdf
The goal of the talk is to give some recommendations and best practices on how to use Buildroot. As I'm sure I forgot a lot of things in my slides above, I'd like to know what you, Buildroot developers/users, would have to say on the topic, so that I can improve the contents of this presentation.
Regards,
Thomas
Signature · 4 lines
Thomas Petazzoni, Free Electrons Kernel, drivers, real-time and embedded Linux development, consulting, training and support. http://free-electrons.com
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
"Thomas" == Thomas Petazzoni <[email protected]> writes:
Thomas> Hello,
Thomas> At ELCE, I will be talking about "Using Buildroot for real projects". Thomas> You can see my talk summary at
Thomas> https://events.linuxfoundation.org/events/embedded-linux-conference-europe/petazzoni.
Thomas> The current (unfinished) status of my slides is visible at:
Thomas> http://free-electrons.com/~thomas/pub/using-buildroot-real-project.pdf
Thanks, a few quick comments:
p3: s/How it works?/How does it work?/
p5: minor, configuration doesn't match output on p6
p7: "It does not track which packages installs what" <- Is that
important to know how it works?
p9: use uclibc and rootfs size would be half ;)
p11: s/needs to build rebuilt/needs to be rebuilt/
p11: s/built with crosstool-NG/from above/
p12: s/knows some/contains presets for/
p12: s/well-known toolchains/well-known binary toolchains/
p14: s/for it build/for it to build/
p16: "Up to Buildroot 2011.11" reads a bit odd to me (E.G. is it now
fixed or not?) Perhaps simply say "Until recently, it wasn't easy to use Buildroot with a custom"
Signature · 1 line
Bye, Peter Korsgaard
Hi Thomas,
Quoted 4 lines · Thomas Petazzoni
At ELCE, I will be talking about "Using Buildroot for real projects". You can see my talk summary at
https://events.linuxfoundation.org/events/embedded-linux-conference-europe/petazzoni.
Quoted 8 lines
The current (unfinished) status of my slides is visible at:
http://free-electrons.com/~thomas/pub/using-buildroot-real-project.pdfThe goal of the talk is to give some recommendations and best practices on how to use Buildroot. As I'm sure I forgot a lot of things in my slides above, I'd like to know what you, Buildroot developers/users, would have to say on the topic, so that I can improve the contents of this presentation.
A few comments.
1. Slide 7: maybe elaborate a bit on the meaning of "It does not track which package installs what", i.e. you can't uninstall (or install) a package form the target.
2. Slide 14 header: maybe "External toolchains: HOWTO"
3. Slide 19: the sysroot copying stage seems to be missing
4. Slide 22: the 'echo' command is missing '-e'?
5. Slides 23-26: headers should be "... (x/5)"
6. Slide 27: old style CMAKETARGETS
By the way, is there a link to the TeX (or DocBook?) source of this presentation. I'd really like to learn a few Beamer tricks, like the source box in slides 17, 18.
baurch
Signature · 3 lines
~. .~ Tk Open Systems
=}------------------------------------------------ooO--U--Ooo------------{=
- baruch at tkos.co.il - tel: +972.2.679.5364, http://www.tkos.co.il -Hi Thomas,
Quoted 6 lines · Thomas Petazzoni
Hello,
At ELCE, I will be talking about "Using Buildroot for real projects". You can see my talk summary at
https://events.linuxfoundation.org/events/embedded-linux-conference-europe/petazzoni.
Quoted 8 lines
The current (unfinished) status of my slides is visible at:
?http://free-electrons.com/~thomas/pub/using-buildroot-real-project.pdfThe goal of the talk is to give some recommendations and best practices on how to use Buildroot. As I'm sure I forgot a lot of things in my slides above, I'd like to know what you, Buildroot developers/users, would have to say on the topic, so that I can improve the contents of this presentation.
First of all, I think it is a very interesting presentation. It should definitely become part of the official buildroot documentation, so that companies starting with buildroot get a better feeling about the best practices.
Some typos and comments, in addition to the previous replies:
p2 s/intagration/integration/
p3 s/Example of systems/Examples of systems/
p3 s/Toolchain recommandations/Toolchain recommendations/ p7 s/in a .config files/in a .config file/
p7 s/starts by/starts with/
p8 s/What does it generates/What does it generate/
p11 s/CodeSoucery/CodeSourcery/
p15 s/recommandation/recommendation/
p16 s/Kernel and bootloaders changes/Kernel and bootloader changes/ p16 s/separatly/separately/
p16 close parentheses after BR2_LINUX_KERNEL_PATCH
p 11: "Buildroot builds a toolchain. This is limited to uClibc based toolchains, and needs to build rebuilt completely at every Buildroot rebuild."
I think this is confusing: to me it gives the impression that the toolchain is rebuilt at every invocation of 'make'. Maybe adding the word 'complete' as with crosstool-ng makes it more clear.
p 14: "Generate a custom toolchain, and store it pre-built next to the Buildroot directory, or in some internal HTTP server"
It could be anywhere on the filesystem, plus doesn't buildroot support FTP either? Moreover, patches are coming to add scp support as well. My point is that mentioning 'http' explicitly is maybe too restrictive.
p27: It's a pity that the dependencies don't fit completely in the box. Maybe use MY_APP instead of MY_APPLICATION or something?
p28: "storage in configs/": I think it would be better to explicitly mention that the file 'defconfig' should be stored in configs/
p30: Future: would you consider mentioning that support for Mercurial repositories and 'scp' downloads for LAN-based locations is in queue?
As I side note : I read that you use /rootfs-additions/ to add additional stuff in the root filesystem. I'm doing exactly the same thing (called target_skeleton_extras). I feel this may be a good thing to officialize: let the user specify an overlay to the target skeleton. What do you think? (we may want to discuss this in a separate topic)
Good luck with the presentation!
Thomas
Quoted 5 lines · Thomas Petazzoni
The goal of the talk is to give some recommendations and best practices on how to use Buildroot. As I'm sure I forgot a lot of things in my slides above, I'd like to know what you, Buildroot developers/users, would have to say on the topic, so that I can improve the contents of this presentation.
Of course, I can't stay behind with giving my comments! They're a bit
broader than the earlier comments, though.
For the 'What is Buildroot slide', I would split it in a 'What' and a 'Why' slide (bottom/top half). Also, the goal for me is to build a complete Linux-based embedded system with the minimum amount of hassle. That means:
- minimal dependency on the build host's operating system (no specific bitbake or whatever package needs to be installed);
- reproducible builds;
- builds everything.
About the "Buildroot can import external toolchains": it's not the option that I would advise at this time. A major disadvantage is that there may be inconsistencies between what buildroot thinks the toolchain can do and what it actually can (unless it's a CodeSourcery toolchain, but those use glibc) - you have to define yourself what extra stuff the toolchain has.
The board/<company>/<project>/linux-patches setup is exactly what I typically use as well. I would like some future version of buildroot to simplify such a setup, i.e. you just configure board/<company>/<project> and buildroot looks for all the patches there. But that's not for this presentation :-)
One typical use case that is missing: in a company with several developers, you would put a download mirror in some central location and either pointBR2_DL_DIR or BR2_PRIMARY_SITE to it. (BTW, now I notice that the help text of BR2_PRIMARY_SITE incorrectly claims that it only works for AUTOTARGETS.)
Another important hint: to debug, you should use output/host/usr/bin/<arch>-gdb -ex 'set solib-absolute-prefix output/staging'.
And it may be worthwhile to talk about how you can contribute :-) DCO, coding style, where to send it.
Regards,
Arnout
Signature · 6 lines
Arnout Vandecappelle arnout at mind be Senior Embedded Software Architect +32-16-286540 Essensium/Mind http://www.mind.be G.Geenslaan 9, 3001 Leuven, Belgium BE 872 984 063 RPR Leuven LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle GPG fingerprint: 31BB CF53 8660 6F88 345D 54CC A836 5879 20D7 CF43
Hi Arnout,
Quoted 16 lines · Arnout Vandecappelle
Quoted 5 lines · Thomas Petazzoni
The goal of the talk is to give some recommendations and best practices on how to use Buildroot. As I'm sure I forgot a lot of things in my slides above, I'd like to know what you, Buildroot developers/users, would have to say on the topic, so that I can improve the contents of this presentation.
?Of course, I can't stay behind with giving my comments! ?They're a bit broader than the earlier comments, though.
?For the 'What is Buildroot slide', I would split it in a 'What' and a 'Why' slide (bottom/top half). ?Also, the goal for me is to build a complete Linux-based embedded system with the minimum amount of hassle. ?That means:
?- minimal dependency on the build host's operating system (no specific bitbake or whatever package needs to be installed);
?- reproducible builds;
?- builds everything.
Quoted 6 lines
?About the "Buildroot can import external toolchains": it's not the option that I would advise at this time. ?A major disadvantage is that there may be inconsistencies between what buildroot thinks the toolchain can do and what it actually can (unless it's a CodeSourcery toolchain, but those use glibc) - you have to define yourself what extra stuff the toolchain has.
?The board/<company>/<project>/linux-patches setup is exactly what I typically use as well. ?I would like some future version of buildroot to simplify such a setup, i.e. you just configure board/<company>/<project> and buildroot looks for all the patches there. ?But that's not for this presentation :-)
?One typical use case that is missing: in a company with several developers, you would put a download mirror in some central location and either point
BR2_DL_DIRorBR2_PRIMARY_SITEto it. ?(BTW, now I notice that the help text ofBR2_PRIMARY_SITEincorrectly claims that it only works for AUTOTARGETS.)
I noticed this as well. I fixed this in my hg/scp support patch that I will send shortly.
Quoted 2 lines
?Another important hint: to debug, you should use output/host/usr/bin/<arch>-gdb -ex 'set solib-absolute-prefix output/staging'.
Is this really needed?
I'm under the impression that setting sysroot is enough: 'set sysroot output/staging'
Quoted 2 lines
?And it may be worthwhile to talk about how you can contribute :-) ?DCO, coding style, where to send it.
Best regards,
Thomas
Le Mon, 17 Oct 2011 18:47:18 +0200,
Thomas Petazzoni <[email protected]> a ?crit :
Quoted 2 lines
The current (unfinished) status of my slides is visible at:
http://free-electrons.com/~thomas/pub/using-buildroot-real-project.pdf
First of all, I'd like to thank Peter, Baruch, Thomas, Arnout and Will who gave some useful comments about my slides.
At the same URL above, I have published a new version, which hopefully addresses your comments, and also adds some more slides on various topics. The slides should now, at least in terms of contents, represent what I had in mind for this talk.
Now, if you're still willing to spend some time on this, I'd like to have comments on:
* remaining english typos, wording improvements, etc.
* suggestions of additional contents/topics if there is something I missed. Like if you use best practices that aren't described in those slides.
Thanks again!
Thomas
Signature · 4 lines
Thomas Petazzoni, Free Electrons Kernel, drivers, real-time and embedded Linux development, consulting, training and support. http://free-electrons.com
Le Tue, 18 Oct 2011 09:26:38 +0200,
Baruch Siach <[email protected]> a ?crit :
Quoted 3 lines
By the way, is there a link to the TeX (or DocBook?) source of this presentation. I'd really like to learn a few Beamer tricks, like the source box in slides 17, 18.
It's just
\begin{block}{}
\small
\begin{verbatim}
Some code here.
\end{verbatim}
\end{block}
I've attached the .tex source for reference, however it won't build since it depends on a Free Electrons stylesheet (but I can share it as well if you need). Some day, we'll have an publicly accessible Git repository for all our training materials and conference slides.
Thanks for your comments!
Thomas
Signature · 11 lines
Thomas Petazzoni, Free Electrons Kernel, drivers, real-time and embedded Linux development, consulting, training and support. http://free-electrons.com -------------- next part -------------- A non-text attachment was scrubbed... Name: using-buildroot-real-project.tex Type: text/x-tex Size: 27204 bytes Desc: not available URL: <http://lists.busybox.net/pipermail/buildroot/attachments/20111021/1d48eb6a/attachment-0001.tex>
Quoted 14 lines · Thomas Petazzoni
Le Mon, 17 Oct 2011 18:47:18 +0200,
Thomas Petazzoni <[email protected]> a ?crit :Quoted 2 lines
The current (unfinished) status of my slides is visible at:
? http://free-electrons.com/~thomas/pub/using-buildroot-real-project.pdfFirst of all, I'd like to thank Peter, Baruch, Thomas, Arnout and Will who gave some useful comments about my slides.
At the same URL above, I have published a new version, which hopefully addresses your comments, and also adds some more slides on various topics. The slides should now, at least in terms of contents, represent what I had in mind for this talk.
Quoted 6 lines
Now, if you're still willing to spend some time on this, I'd like to have comments on:
?* remaining english typos, wording improvements, etc.
?* suggestions of additional contents/topics if there is something I ? missed. Like if you use best practices that aren't described in ? those slides.
thanks for sharing this slides. I found some really useful issues I have never thought about before.
Page 23 (setting root password):
1. what have you set?
2. $TARGET_DIR is not working for me, but $1/etc/shadow is working
Yegor
Le Fri, 21 Oct 2011 15:51:51 +0200,
Yegor Yefremov <[email protected]> a ?crit :
Quoted 2 lines
thanks for sharing this slides. I found some really useful issues I have never thought about before.
You're welcome. Nice to see it is useful.
Quoted 3 lines
Page 23 (setting root password):
1. what have you set?
The root password.
Quoted 1 line
2. $TARGET_DIR is not working for me, but $1/etc/shadow is working
Fixed. I usually do TARGETDIR=$1 or TARGET_DIR=$1 at the beginning of the script.
Thanks for the review!
Thomas
Signature · 4 lines
Thomas Petazzoni, Free Electrons Kernel, drivers, real-time and embedded Linux development, consulting, training and support. http://free-electrons.com
Quoted 5 lines
Quoted 3 lines
Page 23 (setting root password):
1. what have you set?
The root password.
What is root password: 'root', 'linux' or something else? I tried both, but failed. I mean, if someone tries to copy this line, he won't be able to login.
Perhaps some howto about how to generate own root password and put it in the script could be also useful. On the other hand it could be included in the main documentation later.
Yegor
Quoted 5 lines · Thomas Petazzoni
Le Mon, 17 Oct 2011 18:47:18 +0200,
Thomas Petazzoni<[email protected]> a ?crit :Quoted 2 lines
The current (unfinished) status of my slides is visible at:
http://free-electrons.com/~thomas/pub/using-buildroot-real-project.pdf
<snip>
Quoted 3 lines
Now, if you're still willing to spend some time on this, I'd like to have comments on:
* remaining english typos, wording improvements, etc.
Couple of minor points on the English (Still very impressive from a non native speaker)
p8: "Buildroot starts by the toolchain" should be "starts with the" p16 "Any other project specific file" should perhaps be "files"
p17: "kernel and bootloaders often" shouldn't it be singular bootloader?
p17: "drawback is that Buildroot does directly" unless I misunderstand the use case, don't you mean doesn't?
p21: "I don't recommend this, ..." I'm not sure if you are not recommending changing the skeleton or using a script to modify it
p30: "finds automagically" should be "automagically finds"
p37: "assignements" should be assignments
p37: "allows to tell" should be "allows you to tell"
Quoted 3 lines
* suggestions of additional contents/topics if there is something I missed. Like if you use best practices that aren't described in those slides.
One thing I'd love to get written up somewhere is best practice for NFS mounting a filesystem image, but I realise this may not be relevant to your talk.
Otherwise your slides are very good at explaining how it all works.
Will
Le Fri, 21 Oct 2011 15:33:30 +0100,
Will Wagner <[email protected]> a ?crit :
Quoted 2 lines
Couple of minor points on the English (Still very impressive from a non native speaker)
Thanks!
Quoted 1 line
p8: "Buildroot starts by the toolchain" should be "starts with the"
Funny, because Will Moore told me to do the exact opposite (in a review he sent me privately yesterday):
"""
Slide 7, "Buildroot starts with the toolchain" not "Buildroot starts by the toolchain".
"""
Now I understand why I fail to further improve my english. It's because it's a fuzzy logic language ! :-)
Quoted 1 line
p16 "Any other project specific file" should perhaps be "files"
I have changed to "All other project specific files", maybe it's more correct?
Quoted 2 lines
p17: "kernel and bootloaders often" shouldn't it be singular bootloader?
Not necessarily. On AT91 platforms, you have two bootloaders:
at91boostrap and u-boot, and I both patch them and build them within Buildroot.
Quoted 2 lines
p17: "drawback is that Buildroot does directly" unless I misunderstand the use case, don't you mean doesn't?
Fixed, thanks, that was a major typo.
Quoted 2 lines
p21: "I don't recommend this, ..." I'm not sure if you are not recommending changing the skeleton or using a script to modify it
Ok, I tried to clarify it:
"""I don't recommend this solution as it consists in duplicating the default skeleton, which would prevent from taking advantage of future improvements of the default skeleton."""
Quoted 1 line
p30: "finds automagically" should be "automagically finds"
Fixed.
Quoted 1 line
p37: "assignements" should be assignments
Fixed.
Quoted 1 line
p37: "allows to tell" should be "allows you to tell"
Fixed.
Quoted 3 lines
One thing I'd love to get written up somewhere is best practice for NFS mounting a filesystem image, but I realise this may not be relevant to your talk.
Ah, good point. I'll include a slide about this.
Thanks!
Thomas
Signature · 4 lines
Thomas Petazzoni, Free Electrons Kernel, drivers, real-time and embedded Linux development, consulting, training and support. http://free-electrons.com
Le Fri, 21 Oct 2011 16:24:03 +0200,
Yegor Yefremov <[email protected]> a ?crit :
Quoted 3 lines
What is root password: 'root', 'linux' or something else? I tried both, but failed. I mean, if someone tries to copy this line, he won't be able to login.
Ah, my mistake, I copy pasted the hashed password from a project, and the password is not 'root'. I've fixed that in the slides, will be part of the next version I'll upload.
Quoted 3 lines
Perhaps some howto about how to generate own root password and put it in the script could be also useful. On the other hand it could be included in the main documentation later.
Just use mkpasswd from the whois package in Debian/Ubuntu distributions.
Thomas
Signature · 4 lines
Thomas Petazzoni, Free Electrons Kernel, drivers, real-time and embedded Linux development, consulting, training and support. http://free-electrons.com
Hi Thomas,
Quoted 14 lines · Thomas Petazzoni
Le Mon, 17 Oct 2011 18:47:18 +0200,
Thomas Petazzoni <[email protected]> a ?crit :Quoted 2 lines
The current (unfinished) status of my slides is visible at:
? http://free-electrons.com/~thomas/pub/using-buildroot-real-project.pdfFirst of all, I'd like to thank Peter, Baruch, Thomas, Arnout and Will who gave some useful comments about my slides.
At the same URL above, I have published a new version, which hopefully addresses your comments, and also adds some more slides on various topics. The slides should now, at least in terms of contents, represent what I had in mind for this talk.
Quoted 6 lines
Now, if you're still willing to spend some time on this, I'd like to have comments on:
?* remaining english typos, wording improvements, etc.
?* suggestions of additional contents/topics if there is something I ? missed. Like if you use best practices that aren't described in ? those slides.
p4: s/build a kernel image/a kernel image/ (the 'build' is already
mentioned in the header)
p4: for symmetry reasons, I would suggest to start the last point also with 'It builds' instead of 'Builds'
p4: the 'composed of Busybox' seems odd to me, because 'Busybox' is one item. Maybe a native English speaker (Will?) can give feedback on this. Suggestions from me are 'containing Busybox' or 'based on Busybox'.
p4/5 title: on page 4 there is a question mark, not so on page 5.
p5: I'm unsure what you're trying to say with 'Standard languages used'. If you refer to make, that was already covered on the previous slide and may be redundant here.
p5: you're mainly typing full sentences, which is good IMO. But the 'Need to do complete rebuilds' is not consistent with that. I'd suggest 'You need to ...'.
p10/11: reminder: still lists a TODO about build time
p12: s/more choice/more choices/ (at least, that's my feeling)
p12: first bullet says: "Buildroot complete rebuild", second says:
"complete Buildroot rebuild". This should be consistent. I prefer the second one.
p24: s/Creating/Create/
p31: s/Mouting/Mounting/
Thanks for the credit, and:
Great job!
Best regards,
Thomas
Hi Thomas,
Quoted 14 lines · Thomas Petazzoni
Le Mon, 17 Oct 2011 18:47:18 +0200,
Thomas Petazzoni <[email protected]> a ?crit :Quoted 2 lines
The current (unfinished) status of my slides is visible at:
http://free-electrons.com/~thomas/pub/using-buildroot-real-project.pdfFirst of all, I'd like to thank Peter, Baruch, Thomas, Arnout and Will who gave some useful comments about my slides.
At the same URL above, I have published a new version, which hopefully addresses your comments, and also adds some more slides on various topics. The slides should now, at least in terms of contents, represent what I had in mind for this talk.
Quoted 8 lines
Now, if you're still willing to spend some time on this, I'd like to have comments on:
* remaining english typos, wording improvements, etc.
* suggestions of additional contents/topics if there is something I missed. Like if you use best practices that aren't described in those slides.Thanks again!
Two of my earlier comments still stand.
1. Slide 23: missing -e in the 'echo' command
$ echo "/dev/mtdblock7\t\t/applog\tjffs2\tdefaults\t\t0\t0" /dev/mtdblock7\t\t/applog\tjffs2\tdefaults\t\t0\t0
$ echo -e "/dev/mtdblock7\t\t/applog\tjffs2\tdefaults\t\t0\t0" /dev/mtdblock7 /applog jffs2 defaults 0 0
2. Slides 24-27: header should be "Project-specific packages (x/5)", instead of "... (x/4)". (Can't TeX do this automatically somehow?)
baruch
Signature · 3 lines
~. .~ Tk Open Systems
=}------------------------------------------------ooO--U--Ooo------------{=
- baruch at tkos.co.il - tel: +972.2.679.5364, http://www.tkos.co.il -Le Sun, 23 Oct 2011 14:37:55 +0200,
Baruch Siach <[email protected]> a ?crit :
Quoted 7 lines
1. Slide 23: missing -e in the 'echo' command
$ echo "/dev/mtdblock7\t\t/applog\tjffs2\tdefaults\t\t0\t0" /dev/mtdblock7\t\t/applog\tjffs2\tdefaults\t\t0\t0$ echo -e "/dev/mtdblock7\t\t/applog\tjffs2\tdefaults\t\t0\t0" /dev/mtdblock7 /applog jffs2 defaults 0 0
-e is not needed with sh:
$ echo "bla\nbli" bla bli $ echo -e "bla\nbli" -e bla bli
Quoted 2 lines
2. Slides 24-27: header should be "Project-specific packages (x/5)", instead of "... (x/4)". (Can't TeX do this automatically somehow?)
Fixed. I don't know if TeX can do this automatically. Maybe.
Thanks for the comments. I also fixed the various comments raised by Thomas. Thanks again!
Thomas
Signature · 4 lines
Thomas Petazzoni, Free Electrons Kernel, drivers, real-time and embedded Linux development, consulting, training and support. http://free-electrons.com
Thomas, All,
Quoted 5 lines · On Monday 24 October 2011 17:32:50 Thomas Petazzoni wrote:
Le Sun, 23 Oct 2011 14:37:55 +0200,
Baruch Siach <[email protected]> a ?crit :Quoted 2 lines
1. Slide 23: missing -e in the 'echo' command
Quoted 7 lines
Quoted 5 lines
$ echo "/dev/mtdblock7\t\t/applog\tjffs2\tdefaults\t\t0\t0" /dev/mtdblock7\t\t/applog\tjffs2\tdefaults\t\t0\t0$ echo -e "/dev/mtdblock7\t\t/applog\tjffs2\tdefaults\t\t0\t0" /dev/mtdblock7 /applog jffs2 defaults 0 0-e is not needed with sh:
The problem is that /bin/sh might be whatever. With a POSIX-conformant /bin/sh (eg. dash), this is true. With bash, it is not. Alas, many systems still have bash as /bin/sh.
$ ls -l /bin/sh lrwxrwxrwx 1 root root 4 May 17 23:53 /bin/sh -> bash $ echo "bli\nbla" bli\nbla $ /bin/bash $ echo "bli\nbla" bli\nbla $ exit $ /bin/dash $ echo "bli\nbla" bli bla
The answer it to use printf [0].
I now use printf as much as I can. printf is in POSIX and does not suffer from all the discrepancies there are in the many echo implementations.
Quoted 6 lines
$ echo "bla\nbli" bla bli $ echo -e "bla\nbli" -e bla bli
[0] http://pubs.opengroup.org/onlinepubs/9699919799/utilities/printf.html
Regards,
Yann E. MORIN.
Signature · 6 lines
.-----------------.--------------------.------------------.--------------------. | 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. | '------------------------------^-------^------------------^--------------------'
Le Mon, 24 Oct 2011 18:42:06 +0200,
"Yann E. MORIN" <[email protected]> a ?crit :
Quoted 17 lines
The problem is that
/bin/shmight be whatever. With a POSIX-conformant/bin/sh(eg. dash), this is true. With bash, it is not. Alas, many systems still have bash as/bin/sh.$ ls -l /bin/sh lrwxrwxrwx 1 root root 4 May 17 23:53 /bin/sh -> bash $ echo "bli\nbla" bli\nbla $ /bin/bash $ echo "bli\nbla" bli\nbla $ exit $ /bin/dash $ echo "bli\nbla" bli bla
Quoted 4 lines
The answer it to use printf [0].
I now use printf as much as I can. printf is in POSIX and does not suffer from all the discrepancies there are in the many echo implementations.
Ah, nice to know. Thanks!
For the moment, I've been using echo, knowing that its behavior is not consistent across systems. But indeed printf is much better.
Thanks!
Thomas
Signature · 4 lines
Thomas Petazzoni, Free Electrons Kernel, drivers, real-time and embedded Linux development, consulting, training and support. http://free-electrons.com