From a503da26738c901ad8583ac7b59747b8710e74cb Mon Sep 17 00:00:00 2001
From: Vadim Lomovtsev <vadim.lomovtsev@auriga.com>
Date: Thu, 2 Feb 2023 11:20:57 +0300
Subject: [PATCH] kos/image_builder/einit/CMakeLists.txt: add extra mount
 options for precompiled_vfsVfsNet

While working with NodeJS tests it was found that some of them (tests)
requires access to /etc/hosts file and so the getaddrinfo() call falls
to error.

The quote from developers:
> The issue was nailed down to the ramdisk access for the entity which
> implements network access (precompiled_vfsVfsNet). As appropriated
> partition hasn't been mounted for it (so it is not exists for it). The
> access to the ramdisk is covered by another entity, called
> precompiled_vfsVfsRamFs. So it is required to configure (allow) access
> for the precompiled_vfsVfsNet to the ramdisk over explicit properties.
>
> Besides of that it is required to add the 'hosts' file to the romfs
> image, to make it accessible by application over /etc mount from romfs.

TFS: #82

Signed-off-by: Vadim Lomovtsev <vadim.lomovtsev@auriga.com>
---
 kos/image_builder/einit/CMakeLists.txt | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/kos/image_builder/einit/CMakeLists.txt b/kos/image_builder/einit/CMakeLists.txt
index b8bdd66fc825ba..644696702516ca 100644
--- a/kos/image_builder/einit/CMakeLists.txt
+++ b/kos/image_builder/einit/CMakeLists.txt
@@ -111,6 +111,16 @@ set_target_properties (${certificate_storage_ENTITY} PROPERTIES
     EXTRA_ENV "\
     VFS_FILESYSTEM_BACKEND: client:${ROOTFS_ENTITY}")
 
+set_target_properties (${precompiled_vfsVfsNet} PROPERTIES
+    EXTRA_ARGS "\
+    - -l
+    - devfs /dev devfs 0
+    - -l
+    - romfs /etc romfs 0")
+
+# add hosts file to romfs image, to be used by application
+list (APPEND FILES $ENV{BUILD_ROOT}/image_builder/resources/rootfs/etc/hosts)
+
 set_target_properties (${FS_BACKEND} PROPERTIES
     EXTRA_ARGS "\
     - -l