Skip to contentSkip to conversation

makedevs and symbolic links

Buildroot New Aras Vaichas 5 participants 10 messages Feb 6, 2013 – Feb 8, 2013 Kbuild

lore
Share & tools
lore
#0 lore raw

I use Buildroot with my own custom root fs skeleton. My skeleton contains a few symbolic links that I'd like to move out either into
the BR2_ROOTFS_POST_BUILD_SCRIPT or somewhere else.

makedevs seemed logical but it doesn't support symbolic link creation.

Is there a reason for this?

Would it be useful to add it?

Aras
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.busybox.net/pipermail/buildroot/attachments/20130206/d9f9abbf/attachment.html>

#1 lore raw

Dear Aras Vaichas,

Quoted 9 lines · Aras Vaichas

I use Buildroot with my own custom root fs skeleton. My skeleton contains a few symbolic links that I'd like to move out either into
the BR2_ROOTFS_POST_BUILD_SCRIPT or somewhere else.

makedevs seemed logical but it doesn't support symbolic link creation.

Is there a reason for this?

Would it be useful to add it?

From my point of view, makedevs is here to do the things you can't do without being root: create device nodes and adjust ownership.

Symbolic links can be created as non-root in a post-build script for example, so I'm not sure there's really a need to have support for symbolic links in makedevs.

Or maybe I'm missing the point?

Best 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
#2 lore raw
Quoted 14 lines · Thomas Petazzoni

Dear Aras Vaichas,

Quoted 1 line · Aras Vaichas

I use Buildroot with my own custom root fs skeleton. My skeleton

contains a

Quoted 8 lines

few symbolic links that I'd like to move out either into the BR2_ROOTFS_POST_BUILD_SCRIPT or somewhere else.

makedevs seemed logical but it doesn't support symbolic link creation.

Is there a reason for this?

Would it be useful to add it?

Quoted 9 lines

From my point of view, makedevs is here to do the things you can't do without being root: create device nodes and adjust ownership.

Symbolic links can be created as non-root in a post-build script for example, so I'm not sure there's really a need to have support for symbolic links in makedevs.

Or maybe I'm missing the point?

Hi Thomas,

I understand that it doesn't make sense if you approach it from a non-root user point of view.

From a maintenance point of view, it's a "nice to have" if the creation of the root fs can be defined in as few places as possible. I like how makedevs works because I can look at a single file and I see a nice list of all the files in my system. Ideally it would be great if I could remove my skeleton/ directory and put everything into the BR2_ROOTFS_DEVICE_TABLE file.

makedevs currently creates regular files, directories, char dev files, block dev files, and fifos. Adding symbolic links would make it "feature complete".

regards,

Aras
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.busybox.net/pipermail/buildroot/attachments/20130206/8730bcef/attachment.html>

#3 lore raw

Dear Aras Vaichas,

Quoted 9 lines · Aras Vaichas

I understand that it doesn't make sense if you approach it from a non-root user point of view.

From a maintenance point of view, it's a "nice to have" if the creation of the root fs can be defined in as few places as possible. I like how makedevs works because I can look at a single file and I see a nice list of all the files in my system. Ideally it would be great if I could remove my skeleton/ directory and put everything into the BR2_ROOTFS_DEVICE_TABLE file.

I don't see how this would be possible. The skeleton have files with contents in them. makedevs doesn't allow to create a /etc/inittab that contains something, a /etc/passwd that contains something, etc.

The current design is really:

* We have a base skeleton in system/skeleton that generally never needs to be modified. The base system/device_table.txt and system/device_table_dev.txt take care of setting the appropriate permissions/ownerships on the files part of the base skeleton.

* For each project, we encourage people to create a rootfs overlay in board/<company>/<project>/rootfs-overlay/, where they can add their specific configuration files, symbolic links and so on. And a project-specific device table in board/<company>/<project>/device_table.txt sets the appropriate owernship for the files part of the rootfs-overlay.

I think a real filesystem view (be it in the skeleton or in the overlay) is much nicer to look at and modify than the device table.

Best 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
#4 lore raw
Quoted 7 lines · Thomas Petazzoni

The current design is really:

* We have a base skeleton in system/skeleton that generally never needs to be modified. The base system/device_table.txt and system/device_table_dev.txt take care of setting the appropriate permissions/ownerships on the files part of the base skeleton.

Quoted 7 lines

* For each project, we encourage people to create a rootfs overlay in board/<company>/<project>/rootfs-overlay/, where they can add their specific configuration files, symbolic links and so on. And a project-specific device table in board/<company>/<project>/device_table.txt sets the appropriate owernship for the files part of the rootfs-overlay.

Aaah, I don't have that version of Buildroot. I'm using 2012.11. I can see from the mailing lists now that patches were added for the "rootfs-overlay".

I might have to leave that until it's in the stable release. I'm currently documenting how to use Buildroot for my employer (a company with almost zero Linux knowledge) on their hardware, so I'd rather stick to official release versions for now. I can update my documentation later.

My current employer wants me to put my Buildroot configuration into their version control system (MKS). So I am looking at ways that I can avoid using empty directories and symbolic links to make it diff and MKS friendly. I guess there's no getting around using multiple files and scripts to achieve this.

Crazy idea: If only patch/diff handled empty directories, symlinks, devices, permissions and ownerships. Then it could be done entirely in a single file that would be 100% friendly in all cases on all operating systems.

Thanks!

regards

Aras Vaichas
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.busybox.net/pipermail/buildroot/attachments/20130207/36b694d7/attachment-0001.html>

#5 lore raw

Dear Aras Vaichas,

Quoted 2 lines · Aras Vaichas

Aaah, I don't have that version of Buildroot. I'm using 2012.11. I can see from the mailing lists now that patches were added for the "rootfs-overlay".

This new "rootfs-overlay" thing is really just a little sugar. You can already do this "rootfs-overlay" by copying board/<company>/<project>/rootfs-overlay/* to $(TARGET_DIR) in your custom post-build script. I've been doing that for 2+ years.

Quoted 11 lines

I might have to leave that until it's in the stable release. I'm currently documenting how to use Buildroot for my employer (a company with almost zero Linux knowledge) on their hardware, so I'd rather stick to official release versions for now. I can update my documentation later.

My current employer wants me to put my Buildroot configuration into their version control system (MKS). So I am looking at ways that I can avoid using empty directories and symbolic links to make it diff and MKS friendly. I guess there's no getting around using multiple files and scripts to achieve this.

Quoted 4 lines

Crazy idea: If only patch/diff handled empty directories, symlinks, devices, permissions and ownerships. Then it could be done entirely in a single file that would be 100% friendly in all cases on all operating systems.

It is not possible: you can't create device files without being root, and you can't change ownership without being root.

Best 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
#6 lore raw
In reply to Aras Vaichas
Quoted 5 lines · Aras Vaichas

My current employer wants me to put my Buildroot configuration into their version control system (MKS). So I am looking at ways that I can avoid using empty directories and symbolic links to make it diff and MKS friendly. I guess there's no getting around using multiple files and scripts to achieve this.

Empty directories, I forgot about that!

Patch coming up. It excludes the .empty files, so that you can create
an empty directory in your VCS by populating it with a '.empty' file. We use the same trick in the skeleton (git doesn't support empty directories either).

For symlinks, I don't see a reason to add a workaround in buildroot. A
VCS that doesn't have symlinks is broken. I have a customer who uses CVS, and their workaround is to put the overlay in a tar file and extract it before building.

Regards,
Arnout

Signature · 6 lines
Arnout Vandecappelle                          arnout at mind be
Senior Embedded Software Architect            +32-16-286500
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:  7CB5 E4CC 6C2E EFD4 6E3D A754 F963 ECAB 2450 2F1F
#7 lore raw

PATCH 1/1 rootfs-overlay: also exclude .empty files

In reply to Aras Vaichas

From: "Arnout Vandecappelle (Essensium/Mind)" <[email protected]>

This makes it possible to put empty directories in the overlay. Thanks to Aras Vaichas for pointing that out.

---
 Makefile                         |    3 ++-
 docs/manual/customize-rootfs.txt |    4 ++--
 2 files changed, 4 insertions(+), 3 deletions(-)
Makefile +2 -1
index d9e5f24..b50c4ed 100644
@@ -504,7 +504,8 @@ endif
 	@for dir in $(call qstrip,$(BR2_ROOTFS_OVERLAY)); do \
 		$(call MESSAGE,"Copying overlay $${dir}"); \
 		rsync -a \
-			--exclude .svn --exclude .git --exclude .hg --exclude '*~' \
+			--exclude .empty --exclude .svn --exclude .git \
+			--exclude .hg --exclude '*~' \
 			$${dir}/ $(TARGET_DIR); \
 	done
 
docs/manual/customize-rootfs.txt +2 -2
index fa04d85..1a47d7e 100644
@@ -26,8 +26,8 @@ there are a few ways to customize the resulting target filesystem.
 
 * Create a filesystem overlay: a tree of files that are copied directly
   over the target filesystem after it has been built.  Set
-  +BR2_ROOTFS_OVERLAY+ to the top of the tree.  +.git+, +.svn+,
-  +.hg+ directories and files ending with +~+ are excluded.
+  +BR2_ROOTFS_OVERLAY+ to the top of the tree.  +.git+, +.svn+, +.hg+
+  directories, +.empty+ files and files ending with +~+ are excluded.
   _Among these first 3 methods, this one should be preferred_.
 
 * In the Buildroot configuration, you can specify the path to a
Signature · 1 line
1.7.10.4
#9 lore raw

PATCH 1/1 rootfs-overlay: also exclude .empty files

In reply to Arnout Vandecappelle (Essensium/Mind)
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Arnout" == Arnout Vandecappelle (Essensium/Mind) <[email protected]> writes:

Arnout> From: "Arnout Vandecappelle (Essensium/Mind)" <[email protected]> Arnout> This makes it possible to put empty directories in the overlay. Arnout> Thanks to Aras Vaichas for pointing that out.

Committed, thanks.

Signature · 1 line
Bye, Peter Korsgaard