Gentoo Archives: gentoo-user

From: Francisco Ares <frares@×××××.com>
To: gentoo-user <gentoo-user@l.g.o>
Subject: [gentoo-user] trying to build an embedded (x86) system almost with no tweaks
Date: Fri, 18 Oct 2013 18:20:14
Message-Id: CAHH9eM4a+DiGdXvCEuUVPmCNL=qP0X_jdjNZXuqRkYQ0BK1BUw@mail.gmail.com
1 Hi.
2
3 I am trying to build an embedded system to be deployed in a SATA flash
4 disk, and most of the file system will be read-only.
5
6 There will be a tempfs on /temp and a read-write partition for /var (in
7 fact, a unionfs with the static part of /var and that read-write partition)
8 and the rest of the root tree will (has to) be read-only.
9
10 There is already a development system with everything working as expected
11 on the final system.
12
13 Adjusting a few files, when I try to simply put it to a squashfs, the
14 system boots with several errors, when trying to write to "/etc" and "/var"
15 (this last one looks obvious, but there are some init process trying to
16 create temporary files on "/etc").
17
18 But even so, I got a prompt, this because one of these adjusted files is
19 "/etc/inittab", where I set up "agetty" to auto-login a user. The system
20 claims that it does not know who is this user (permissions problem,
21 probably).
22
23 Now, looking on that new issue regarding "/usr" and "/" being on a
24 different partitions, I have found the file in "/etc/initramfs.mounts" ,
25 that claims to automagicaly mount specified fstab entries before initramfs
26 gives way to real-root environment.
27
28 So in this system, for now, there is the directory structure bellow:
29
30 /.var.rw - here a r/w ext4 partition is to be mounted;
31 /.var.ro - here there are all files and directories expected to be on a
32 usual /var;
33 /var - here a unionfs mount is to join the ones above
34
35 The part from fstab for this is ("/.var.ro" is present on the squashfs root
36 file system):
37
38 /dev/sda2 / squashfs
39 noatime,ro 0 1
40 /dev/sda3 /.var.rw ext4
41 noatime,defaults 0 2
42 none /var unionfs
43 nonempty,cow,umask=022,dirs=/.var.rw/=rw:/.var.ro/=ro 0 0
44
45 I said it is not yet fully functional because it seems there is something
46 wrong with permissions, because it ends up with a unknown user prompt from
47 which I could list the root directories (something similar is being made to
48 "/etc", so the same results):
49
50 total 9,0K
51 drwxr-xr-x 23 root root 385 Out 18 14:18 ./
52 drwxr-xr-x 4 root root 4,0K Set 24 09:46 ../
53 drwxr-xr-x 47 root root 2,6K Out 17 16:03 .etc.ro/
54 drwxr-xr-x 2 root root 40 Out 18 15:09 .etc.rw/
55 drwxr-xr-x 11 root root 262 Out 17 16:03 .var.ro/
56 drwxr-xr-x 6 root root 4,0K Out 18 14:33 .var.rw/
57 drwxr-xr-x 2 root root 1,4K Out 7 14:46 bin/
58 drwxr-xr-x 4 root root 1,0K Out 18 14:15 boot/
59 d????????? 3 root root 2,3K Ago 1 00:17 dev/
60 drwxr-xr-x 1 root root 2,6K Out 17 16:03 etc/
61 drwxr-xr-x 3 root root 54 Ago 22 07:55 home/
62 lrwxrwxrwx 1 root root 5 Out 7 14:05 lib -> lib64/
63 drwxr-xr-x 12 root root 3,2K Out 17 08:51 lib64/
64 drwxr-xr-x 2 root root 28 Ago 1 00:16 media/
65 drwxr-xr-x 2 root root 28 Ago 1 00:16 opt/
66 drwxr-xr-x 2 root root 3 Jul 31 22:22 proc/
67 drwxr-xr-x 2 root root 136 Out 18 14:18 root/
68 drwxr-xr-x 5 root root 120 Ago 30 08:59 run/
69 drwxr-xr-x 2 root root 2,9K Out 17 08:51 sbin/
70 drwxr-xr-x 2 root root 28 Ago 1 00:16 sys/
71 drwxrwxrwt 2 root root 3 Out 18 14:18 tmp/
72 drwxr-xr-x 13 root root 267 Out 17 11:18 usr/
73 d????????? 1 root root 262 Out 17 16:03 var/
74
75 Any hints?
76
77 Thanks
78 Francisco