1Mounting root file system via SMB (cifs.ko)
2===========================================
3
4Written 2019 by Paulo Alcantara <palcantara@suse.de>
5Written 2019 by Aurelien Aptel <aaptel@suse.com>
6
7The CONFIG_CIFS_ROOT option enables experimental root file system
8support over the SMB protocol via cifs.ko.
9
10It introduces a new kernel command-line option called 'cifsroot='
11which will tell the kernel to mount the root file system over the
12network by utilizing SMB or CIFS protocol.
13
14In order to mount, the network stack will also need to be set up by
15using 'ip=' config option. For more details, see
16Documentation/filesystems/nfs/nfsroot.txt.
17
18A CIFS root mount currently requires the use of SMB1+UNIX Extensions
19which is only supported by the Samba server. SMB1 is the older
20deprecated version of the protocol but it has been extended to support
21POSIX features (See [1]). The equivalent extensions for the newer
22recommended version of the protocol (SMB3) have not been fully
23implemented yet which means SMB3 doesn't support some required POSIX
24file system objects (e.g. block devices, pipes, sockets).
25
26As a result, a CIFS root will default to SMB1 for now but the version
27to use can nonetheless be changed via the 'vers=' mount option.  This
28default will change once the SMB3 POSIX extensions are fully
29implemented.
30
31Server configuration
32====================
33
34To enable SMB1+UNIX extensions you will need to set these global
35settings in Samba smb.conf:
36
37    [global]
38    server min protocol = NT1
39    unix extension = yes        # default
40
41Kernel command line
42===================
43
44root=/dev/cifs
45
46This is just a virtual device that basically tells the kernel to mount
47the root file system via SMB protocol.
48
49cifsroot=//<server-ip>/<share>[,options]
50
51Enables the kernel to mount the root file system via SMB that are
52located in the <server-ip> and <share> specified in this option.
53
54The default mount options are set in fs/cifs/cifsroot.c.
55
56server-ip
57	IPv4 address of the server.
58
59share
60	Path to SMB share (rootfs).
61
62options
63	Optional mount options. For more information, see mount.cifs(8).
64
65Examples
66========
67
68Export root file system as a Samba share in smb.conf file.
69
70...
71[linux]
72	path = /path/to/rootfs
73	read only = no
74	guest ok = yes
75	force user = root
76	force group = root
77	browseable = yes
78	writeable = yes
79	admin users = root
80	public = yes
81	create mask = 0777
82	directory mask = 0777
83...
84
85Restart smb service.
86
87# systemctl restart smb
88
89Test it under QEMU on a kernel built with CONFIG_CIFS_ROOT and
90CONFIG_IP_PNP options enabled.
91
92# qemu-system-x86_64 -enable-kvm -cpu host -m 1024 \
93  -kernel /path/to/linux/arch/x86/boot/bzImage -nographic \
94  -append "root=/dev/cifs rw ip=dhcp cifsroot=//10.0.2.2/linux,username=foo,password=bar console=ttyS0 3"
95
96
971: https://wiki.samba.org/index.php/UNIX_Extensions
98