Orange Pi5 kernel

Deprecated Linux kernel 5.10.110 for OrangePi 5/5B/5+ boards

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