views:

66

answers:

3

Hi, all.

THE SCENARIO

I'm developing a Root FS for some embedded Linux device. It is sitting on the host, exported via NFS and my development board mounts is under "/". The workflows that I need are: - to share my FS to other developers(they have with their own dev. boards) - to backup my Root FS onto some "server" - to deploy my Root FS onto flash-disks or other media - track changes in specific files in my Root FS, branching&merging,roll back etc.

Guys, this seems to me as a Version Control scenario, and I even use git.

THE PROBLEM

As you know Git(and svn/mercurial/bazaar too !) 1) does not store special files (device files under /dev etc.) 2) does not store file owners and permissions. I want to store everything and AS IS.

THE QUESTION:

Do you know some VCS that will do the job ? Or may be you know about another (but simple) solution for doing my scenarios ?

IS IT A COMMON PROBLEM...

I believe that it is, because till now I've heard about scripts/hooks/custom soft that everybody(!) works out for his purposes. All I need is an all-eating-VSS

Thank you !!

+1  A: 

I know this seems a little obvious, but as you haven't mentioned it: Have you considered mechanisms to put all your special files into a regular file, like, for example, into a tar archive? You could store that just fine with any version control system, and as filesystems have lots of binary data anyway diffs between two revisions of a full root filesystem aren't that useful anyway, so you might even not lose too many of the features your version control system provides.

rafl
How will help the tar ? Now I have a directory tree. I can copy it(or parts/files from it)across computers (via NFS,rsync or whatever), but I cannot track changes,pull/push them with other developers,branch/merge etc. Archiving all the stuff will not change this situation.
LiMar
+3  A: 

Having done something similar (developing firmware for an embedded Linux OS), I've found that it's better to put device file creation into a script called by your build system, rather than to store device files directly on the development machine. Then the script that creates the files goes into version control, instead of the files themselves, and (BONUS) you don't need to be root to modify them. Run the build through fakeroot instead.

I suppose this doesn't directly answer your question, but it may be worth thinking about revising your development model. It's NEVER a good idea to run your build as root, because what happens if you accidentally have a "/" in front of a common path? You may inadvertently replace /bin with a whole bunch of links to busybox built for a different architecture.

Jonathan
Mmm. Well... I have no a "build system". At all. I do not need it. I've ran a debootstrap(or rootstock) and got basic system which I keep extending with newly packages, changed config files, my own binaries etc. I hate the fact everybody talking about "a script which will ..." just because we all are lacking a proper tool to store our files. I prefer to store my /dev untracked and rsync all my Root FS to other developers when they need it...And anyway ... thank you for the answer, man !
LiMar
Well, Git is open source... You could add support for device files. They've already done symlinks, which you could use as a reference. But I have to ask: Is this device you are building ever going to run on its own, without an NFS link to its own root file system? At that point, you may find that you need a build system...
Jonathan
The device will be standalolone, for sure. NFS is only for the development time. But we have already released similar device w/o any build system: RootFS-developer created RootFS on his hard drive (w/o any change-tracking/VCS) and other developers just sent him their binaries... I hate this practice, but at least it worked.And now... I am the RootFS developer.
LiMar
+1  A: 

initramfs is a good answer to the userid groupid, permissioon problem. In your kernel source directory, there is scripts/gen_initramfs_list.sh.
This script allows you to build an initramfs archive from several sources. You can for example, specify :

  • a directory : The files and directory found in this base directory will be at the root of your file system.

  • a file liste : it is a text file, very useful to create directory, files and special device files. See example below

If you develop as non root, and your rootfs is in rootfsdir, then probably the file in rootfsdir are owned by you. gen_initramfs_list can translate your uid, gid into 0, 0. Here is an exemple command line :

gen_initramfs_list -u $MYUID -o initramfs.gz rootfsdir/ device.txt 

Where device.txt contains :

# This is a very simple, default initramfs

dir /dev 0755 0 0
nod /dev/console 0600 0 0 c 5 1
dir /root 0700 0 0
# file /kinit usr/kinit/kinit 0755 0 0
# slink /init kinit 0755 0 0

Then you can use standard version control for your rootfsdir content, and add the device.txt file under version control, and here you are : content and file attribute are versionned :).

I don't know if you can change the permission and uid/gid of a file in a directory source via a filelist source, but this would be a logical feature.
Of course you can start with minimal root fs, from which you mount your existing nfs_export.

It is a common problem, and gen_initramfs_list is the tool to solve it.

shodanex
Wow. Interesting. I've never thought about initramfs as a Version Control helper... But how does it restore the permissions? I will explore your solution. I cannot mark it as a solution for a while, but I'm glad to hit a +1. Thank you !
LiMar