* [Buildroot] [PATCH 1/1] Add a filesystem option so a device can be booted over NFS.
@ 2014-07-15 13:21 Sagaert Johan
2014-07-15 13:52 ` Baruch Siach
` (2 more replies)
0 siblings, 3 replies; 6+ messages in thread
From: Sagaert Johan @ 2014-07-15 13:21 UTC (permalink / raw)
To: buildroot
This options allows specifying a directory where the target rootfs is
copied to so it can be used to boot a device over NFS.
Signed-off-by: Sagaert Johan <sagaert.johan@skynet.be>
---
Makefile | 5 +++++
fs/Config.in | 1 +
fs/nfs/Config.in | 13 +++++++++++++
fs/nfs/nfs.mk | 16 ++++++++++++++++
4 files changed, 35 insertions(+)
create mode 100644 fs/nfs/Config.in
create mode 100644 fs/nfs/nfs.mk
diff --git a/Makefile b/Makefile
index dcbf2b3..4c7a707 100644
--- a/Makefile
+++ b/Makefile
@@ -833,6 +833,11 @@ clean:
rm -rf $(TARGET_DIR) $(BINARIES_DIR) $(HOST_DIR) \
$(BUILD_DIR) $(BASE_DIR)/staging \
$(LEGAL_INFO_DIR)
+ifeq ($(BR2_TARGET_ROOTFS_NFS),y)
+ if [ -d $(TARGET_ROOTFS_NFS_PATH) ]; then \
+ rm -rf $(TARGET_ROOTFS_NFS_PATH) ;\
+ fi
+endif
distclean: clean
ifeq ($(DL_DIR),$(TOPDIR)/dl)
diff --git a/fs/Config.in b/fs/Config.in
index 5853113..aa1460b 100644
--- a/fs/Config.in
+++ b/fs/Config.in
@@ -7,6 +7,7 @@ source "fs/ext2/Config.in"
source "fs/initramfs/Config.in"
source "fs/iso9660/Config.in"
source "fs/jffs2/Config.in"
+source "fs/nfs/Config.in"
source "fs/romfs/Config.in"
source "fs/squashfs/Config.in"
source "fs/tar/Config.in"
diff --git a/fs/nfs/Config.in b/fs/nfs/Config.in
new file mode 100644
index 0000000..cf32619
--- /dev/null
+++ b/fs/nfs/Config.in
@@ -0,0 +1,13 @@
+config BR2_TARGET_ROOTFS_NFS
+ bool "create NFS boot directory"
+ help
+ Creates a directory that contains the rootfs for booting over NFS.
+
+if BR2_TARGET_ROOTFS_NFS
+config BR2_TARGET_ROOTFS_NFS_PATH
+ string "path to the directory used for booting over NFS"
+ default "~/nfsrootfs"
+ help
+ Path to the directory used for booting over NFS.
+ (This should also be added to your /etc/exports file.)
+endif
diff --git a/fs/nfs/nfs.mk b/fs/nfs/nfs.mk
new file mode 100644
index 0000000..003ce71
--- /dev/null
+++ b/fs/nfs/nfs.mk
@@ -0,0 +1,15 @@
+################################################################################
+#
+# create a directory for booting the device from an NFS.
+#
+################################################################################
+
+TARGET_ROOTFS_NFS_PATH := $(call qstrip,$(BR2_TARGET_ROOTFS_NFS_PATH))
+
+define ROOTFS_NFS_CMD
+ rm -rf $(TARGET_ROOTFS_NFS_PATH) ;\
+ mkdir -p $(TARGET_ROOTFS_NFS_PATH) ;\
+ cp -r $(TARGET_DIR)/* $(TARGET_ROOTFS_NFS_PATH)
+endef
+
+$(eval $(call ROOTFS_TARGET,nfs))
--
2.0.1
^ permalink raw reply related [flat|nested] 6+ messages in thread* [Buildroot] [PATCH 1/1] Add a filesystem option so a device can be booted over NFS.
2014-07-15 13:21 [Buildroot] [PATCH 1/1] Add a filesystem option so a device can be booted over NFS Sagaert Johan
@ 2014-07-15 13:52 ` Baruch Siach
2014-07-15 14:45 ` Danomi Manchego
2014-07-15 19:33 ` Thomas Petazzoni
2 siblings, 0 replies; 6+ messages in thread
From: Baruch Siach @ 2014-07-15 13:52 UTC (permalink / raw)
To: buildroot
Hi Sagaert,
On Tue, Jul 15, 2014 at 03:21:16PM +0200, Sagaert Johan wrote:
> This options allows specifying a directory where the target rootfs is
> copied to so it can be used to boot a device over NFS.
>
> Signed-off-by: Sagaert Johan <sagaert.johan@skynet.be>
> ---
> Makefile | 5 +++++
> fs/Config.in | 1 +
> fs/nfs/Config.in | 13 +++++++++++++
> fs/nfs/nfs.mk | 16 ++++++++++++++++
> 4 files changed, 35 insertions(+)
> create mode 100644 fs/nfs/Config.in
> create mode 100644 fs/nfs/nfs.mk
>
> diff --git a/Makefile b/Makefile
> index dcbf2b3..4c7a707 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -833,6 +833,11 @@ clean:
> rm -rf $(TARGET_DIR) $(BINARIES_DIR) $(HOST_DIR) \
> $(BUILD_DIR) $(BASE_DIR)/staging \
> $(LEGAL_INFO_DIR)
> +ifeq ($(BR2_TARGET_ROOTFS_NFS),y)
> + if [ -d $(TARGET_ROOTFS_NFS_PATH) ]; then \
> + rm -rf $(TARGET_ROOTFS_NFS_PATH) ;\
> + fi
Too many indentation tabs here.
> +endif
>
> distclean: clean
> ifeq ($(DL_DIR),$(TOPDIR)/dl)
> diff --git a/fs/Config.in b/fs/Config.in
> index 5853113..aa1460b 100644
> --- a/fs/Config.in
> +++ b/fs/Config.in
> @@ -7,6 +7,7 @@ source "fs/ext2/Config.in"
> source "fs/initramfs/Config.in"
> source "fs/iso9660/Config.in"
> source "fs/jffs2/Config.in"
> +source "fs/nfs/Config.in"
> source "fs/romfs/Config.in"
> source "fs/squashfs/Config.in"
> source "fs/tar/Config.in"
> diff --git a/fs/nfs/Config.in b/fs/nfs/Config.in
> new file mode 100644
> index 0000000..cf32619
> --- /dev/null
> +++ b/fs/nfs/Config.in
> @@ -0,0 +1,13 @@
> +config BR2_TARGET_ROOTFS_NFS
> + bool "create NFS boot directory"
> + help
> + Creates a directory that contains the rootfs for booting over NFS.
> +
> +if BR2_TARGET_ROOTFS_NFS
> +config BR2_TARGET_ROOTFS_NFS_PATH
> + string "path to the directory used for booting over NFS"
> + default "~/nfsrootfs"
> + help
> + Path to the directory used for booting over NFS.
> + (This should also be added to your /etc/exports file.)
> +endif
> diff --git a/fs/nfs/nfs.mk b/fs/nfs/nfs.mk
> new file mode 100644
> index 0000000..003ce71
> --- /dev/null
> +++ b/fs/nfs/nfs.mk
> @@ -0,0 +1,15 @@
> +################################################################################
> +#
> +# create a directory for booting the device from an NFS.
> +#
> +################################################################################
> +
> +TARGET_ROOTFS_NFS_PATH := $(call qstrip,$(BR2_TARGET_ROOTFS_NFS_PATH))
> +
> +define ROOTFS_NFS_CMD
> + rm -rf $(TARGET_ROOTFS_NFS_PATH) ;\
> + mkdir -p $(TARGET_ROOTFS_NFS_PATH) ;\
> + cp -r $(TARGET_DIR)/* $(TARGET_ROOTFS_NFS_PATH)
This doesn't look right. What about creating device nodes and SUID binaries?
You must be root for that, $(TARGET_DIR) doesn't carry this information
(fakeroot does that), and even if it did cp doesn't preserve these attributes.
A better approach would be to extract a generated tar image, but you still
must be root for that.
baruch
> +endef
> +
> +$(eval $(call ROOTFS_TARGET,nfs))
--
http://baruch.siach.name/blog/ ~. .~ Tk Open Systems
=}------------------------------------------------ooO--U--Ooo------------{=
- baruch at tkos.co.il - tel: +972.2.679.5364, http://www.tkos.co.il -
^ permalink raw reply [flat|nested] 6+ messages in thread* [Buildroot] [PATCH 1/1] Add a filesystem option so a device can be booted over NFS.
2014-07-15 13:21 [Buildroot] [PATCH 1/1] Add a filesystem option so a device can be booted over NFS Sagaert Johan
2014-07-15 13:52 ` Baruch Siach
@ 2014-07-15 14:45 ` Danomi Manchego
2014-07-15 14:49 ` Danomi Manchego
2014-07-15 16:29 ` Sagaert Johan
2014-07-15 19:33 ` Thomas Petazzoni
2 siblings, 2 replies; 6+ messages in thread
From: Danomi Manchego @ 2014-07-15 14:45 UTC (permalink / raw)
To: buildroot
On Tue, Jul 15, 2014 at 9:21 AM, Sagaert Johan <sagaert.johan@skynet.be> wrote:
> +define ROOTFS_NFS_CMD
> + rm -rf $(TARGET_ROOTFS_NFS_PATH) ;\
> + mkdir -p $(TARGET_ROOTFS_NFS_PATH) ;\
> + cp -r $(TARGET_DIR)/* $(TARGET_ROOTFS_NFS_PATH)
> +endef
> +
> +$(eval $(call ROOTFS_TARGET,nfs))
As Baruch suggested, using "cp" for this purpose is no good. Refer to
the buildroot manual and the warning file installed to the target dir:
http://buildroot.uclibc.org/downloads/manual/manual.html#_nfs_boot
http://git.buildroot.net/buildroot/tree/support/misc/target-dir-warning.txt
Instead, consider simply making a post-build script that does the
un-tar for you. Maybe something like this:
#!/bin/sh
NFSROOT=${NFS_SHARE:-/srv/my_nfsroot}
mkdir -p $NFS_SHARE
sudo tar -xavf ${BASE_DIR}/images.rootfs.tar -C $NFSROOT
(Not actually tested.)
Then no patch is needed.
Danomi -
^ permalink raw reply [flat|nested] 6+ messages in thread* [Buildroot] [PATCH 1/1] Add a filesystem option so a device can be booted over NFS.
2014-07-15 14:45 ` Danomi Manchego
@ 2014-07-15 14:49 ` Danomi Manchego
2014-07-15 16:29 ` Sagaert Johan
1 sibling, 0 replies; 6+ messages in thread
From: Danomi Manchego @ 2014-07-15 14:49 UTC (permalink / raw)
To: buildroot
On Tue, Jul 15, 2014 at 10:45 AM, Danomi Manchego
<danomimanchego123@gmail.com> wrote:
> Instead, consider simply making a post-build script that does the
> un-tar for you. Maybe something like this:
>
> #!/bin/sh
>
> NFSROOT=${NFS_SHARE:-/srv/my_nfsroot}
>
> mkdir -p $NFS_SHARE
> sudo tar -xavf ${BASE_DIR}/images.rootfs.tar -C $NFSROOT
Apologies - those two "NFS_SHARE" should have been "NFSROOT" - last
minute name change ...
Danomi -
^ permalink raw reply [flat|nested] 6+ messages in thread* [Buildroot] [PATCH 1/1] Add a filesystem option so a device can be booted over NFS.
2014-07-15 14:45 ` Danomi Manchego
2014-07-15 14:49 ` Danomi Manchego
@ 2014-07-15 16:29 ` Sagaert Johan
1 sibling, 0 replies; 6+ messages in thread
From: Sagaert Johan @ 2014-07-15 16:29 UTC (permalink / raw)
To: buildroot
-----Oorspronkelijk bericht-----
Van: Danomi Manchego [mailto:danomimanchego123 at gmail.com]
Verzonden: dinsdag 15 juli 2014 16:46
Aan: Sagaert Johan
CC: buildroot
Onderwerp: Re: [Buildroot] [PATCH 1/1] Add a filesystem option so a device can be booted over NFS.
On Tue, Jul 15, 2014 at 9:21 AM, Sagaert Johan <sagaert.johan@skynet.be> wrote:
> +define ROOTFS_NFS_CMD
> + rm -rf $(TARGET_ROOTFS_NFS_PATH) ;\
> + mkdir -p $(TARGET_ROOTFS_NFS_PATH) ;\
> + cp -r $(TARGET_DIR)/* $(TARGET_ROOTFS_NFS_PATH) endef
> +
> +$(eval $(call ROOTFS_TARGET,nfs))
As Baruch suggested, using "cp" for this purpose is no good. Refer to the buildroot manual and the warning file installed to the
target dir:
http://buildroot.uclibc.org/downloads/manual/manual.html#_nfs_boot
http://git.buildroot.net/buildroot/tree/support/misc/target-dir-warning.txt
>Instead, consider simply making a post-build script that does the un-tar for you. Maybe something like this:
>
> #!/bin/sh
>
> NFSROOT=${NFS_SHARE:-/srv/my_nfsroot}
>
> mkdir -p $NFS_SHARE
> sudo tar -xavf ${BASE_DIR}/images.rootfs.tar -C $NFSROOT
>(Not actually tested.)
>Then no patch is needed.
>Danomi -
Hi all
Right, until now I always used a post script that extracted the rootfs.tar.
So I tought I could integrate this into br.
And yes, I run linux in a vm and am to lazy to create a user and use sudo,
so on my virtual linux machine, I am always logged in as root.
Regards, Johan
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Buildroot] [PATCH 1/1] Add a filesystem option so a device can be booted over NFS.
2014-07-15 13:21 [Buildroot] [PATCH 1/1] Add a filesystem option so a device can be booted over NFS Sagaert Johan
2014-07-15 13:52 ` Baruch Siach
2014-07-15 14:45 ` Danomi Manchego
@ 2014-07-15 19:33 ` Thomas Petazzoni
2 siblings, 0 replies; 6+ messages in thread
From: Thomas Petazzoni @ 2014-07-15 19:33 UTC (permalink / raw)
To: buildroot
Dear Sagaert Johan,
On Tue, 15 Jul 2014 15:21:16 +0200, Sagaert Johan wrote:
>
> This options allows specifying a directory where the target rootfs is
> copied to so it can be used to boot a device over NFS.
>
> Signed-off-by: Sagaert Johan <sagaert.johan@skynet.be>
How to boot from NFS is explained at
http://buildroot.org/downloads/manual/manual.html#_nfs_boot, and the
solution you propose requires root privileges to extract the tarball
image, which is not acceptable as Buildroot doesn't run as root.
Therefore, I'll have to mark your patch as Rejected in our patch
tracking system. Do not hesitate to let us know if you disagree and see
a better way of doing things.
Thanks,
Thomas
--
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2014-07-15 19:33 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-07-15 13:21 [Buildroot] [PATCH 1/1] Add a filesystem option so a device can be booted over NFS Sagaert Johan
2014-07-15 13:52 ` Baruch Siach
2014-07-15 14:45 ` Danomi Manchego
2014-07-15 14:49 ` Danomi Manchego
2014-07-15 16:29 ` Sagaert Johan
2014-07-15 19:33 ` Thomas Petazzoni
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox