summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKari Hormi <kari.hormi@qt.io>2019-01-29 13:58:21 +0200
committerKari Hormi <kari.hormi@qt.io>2019-02-01 08:07:02 +0000
commitfdefea451f43061df5d2ea979cf8a27f1ebb3d6a (patch)
tree8f15eb00fa704467edd2df1b88ac82e4a2f1d0cc
parent526c468b393fe32b697ec06e5f204185aeb90046 (diff)
downloadmeta-boot2qt-fdefea451f43061df5d2ea979cf8a27f1ebb3d6a.tar.gz
Implement NFS mounting for Intel NUCs
This commit includes the following changes: - Implement NFS mounting support to initramfs - Load network card driver and configure it with dhcp in initramfs Change-Id: If9c6d30050713cdfc844b198e67dfba316c5a719 Reviewed-by: Samuli Piippo <samuli.piippo@qt.io>
-rw-r--r--meta-intel-extras/recipes/images/core-image-minimal-initramfs.bbappend10
-rw-r--r--meta-intel-extras/recipes/initrdscripts/initramfs-framework/network47
-rwxr-xr-xmeta-intel-extras/recipes/initrdscripts/initramfs-framework/rootfs79
-rw-r--r--meta-intel-extras/recipes/initrdscripts/initramfs-framework_1.0.bbappend17
4 files changed, 148 insertions, 5 deletions
diff --git a/meta-intel-extras/recipes/images/core-image-minimal-initramfs.bbappend b/meta-intel-extras/recipes/images/core-image-minimal-initramfs.bbappend
index c1918ba..fd7559a 100644
--- a/meta-intel-extras/recipes/images/core-image-minimal-initramfs.bbappend
+++ b/meta-intel-extras/recipes/images/core-image-minimal-initramfs.bbappend
@@ -27,5 +27,11 @@
27## 27##
28############################################################################ 28############################################################################
29 29
30INITRAMFS_SCRIPTS += "initramfs-module-rtsx-pci-sdmmc" 30INITRAMFS_SCRIPTS += "\
31PACKAGE_INSTALL += "kernel-module-rtsx-pci-sdmmc" 31 initramfs-module-rtsx-pci-sdmmc \
32 initramfs-module-r8169 \
33 "
34PACKAGE_INSTALL += "\
35 kernel-module-rtsx-pci-sdmmc \
36 kernel-module-r8169 \
37 "
diff --git a/meta-intel-extras/recipes/initrdscripts/initramfs-framework/network b/meta-intel-extras/recipes/initrdscripts/initramfs-framework/network
new file mode 100644
index 0000000..134a70a
--- /dev/null
+++ b/meta-intel-extras/recipes/initrdscripts/initramfs-framework/network
@@ -0,0 +1,47 @@
1#!/bin/sh
2
3############################################################################
4##
5## Copyright (C) 2019 The Qt Company Ltd.
6## Contact: https://www.qt.io/licensing/
7##
8## This file is part of the Boot to Qt meta layer.
9##
10## $QT_BEGIN_LICENSE:GPL$
11## Commercial License Usage
12## Licensees holding valid commercial Qt licenses may use this file in
13## accordance with the commercial license agreement provided with the
14## Software or, alternatively, in accordance with the terms contained in
15## a written agreement between you and The Qt Company. For licensing terms
16## and conditions see https://www.qt.io/terms-conditions. For further
17## information use the contact form at https://www.qt.io/contact-us.
18##
19## GNU General Public License Usage
20## Alternatively, this file may be used under the terms of the GNU
21## General Public License version 3 or (at your option) any later version
22## approved by the KDE Free Qt Foundation. The licenses are as published by
23## the Free Software Foundation and appearing in the file LICENSE.GPL3
24## included in the packaging of this file. Please review the following
25## information to ensure the GNU General Public License requirements will
26## be met: https://www.gnu.org/licenses/gpl-3.0.html.
27##
28## $QT_END_LICENSE$
29##
30############################################################################
31
32network_enabled() {
33 return 0
34}
35
36network_run() {
37 if [ -n "$bootparam_ip" ]; then
38 load_kernel_module r8169
39 if [ "${bootparam_ip}" -ne "dhcp" ]; then
40 echo "WARN: DHCP only supported at this time."
41 fi
42 ip link set dev eth0 up
43 udhcpc
44 fi
45}
46
47
diff --git a/meta-intel-extras/recipes/initrdscripts/initramfs-framework/rootfs b/meta-intel-extras/recipes/initrdscripts/initramfs-framework/rootfs
new file mode 100755
index 0000000..c93c9c2
--- /dev/null
+++ b/meta-intel-extras/recipes/initrdscripts/initramfs-framework/rootfs
@@ -0,0 +1,79 @@
1#!/bin/sh
2# Copyright (C) 2011 O.S. Systems Software LTDA.
3# Licensed on MIT
4
5rootfs_enabled() {
6 return 0
7}
8
9rootfs_run() {
10 if [ -z "$ROOTFS_DIR" ]; then
11 return
12 fi
13 C=0
14 delay=${bootparam_rootdelay:-1}
15 timeout=${bootparam_roottimeout:-5}
16 while [ ! -d $ROOTFS_DIR/dev ]; do
17 if [ $(( $C * $delay )) -gt $timeout ]; then
18 fatal "root '$bootparam_root' doesn't exist or does not contain a /dev."
19 fi
20
21 if [ -n "$bootparam_root" ]; then
22 debug "No e2fs compatible filesystem has been mounted, mounting $bootparam_root..."
23
24 if [ "`echo ${bootparam_root} | cut -c1-5`" = "UUID=" ]; then
25 root_uuid=`echo $bootparam_root | cut -c6-`
26 bootparam_root="/dev/disk/by-uuid/$root_uuid"
27 fi
28
29 if [ "`echo ${bootparam_root} | cut -c1-9`" = "PARTUUID=" ]; then
30 root_uuid=`echo $bootparam_root | cut -c10-`
31 bootparam_root="/dev/disk/by-partuuid/$root_uuid"
32 fi
33
34 if [ "`echo ${bootparam_root} | cut -c1-6`" = "LABEL=" ]; then
35 root_label=`echo $bootparam_root | cut -c7-`
36 bootparam_root="/dev/disk/by-label/$root_label"
37 fi
38
39 if [ "${bootparam_root}" = "/dev/nfs" ]; then
40 bootparam_rootfstype="nfs"
41 bootparam_root=`echo $bootparam_nfsroot | cut -f1 -d","`
42 bootparam_nfsopts=`echo $bootparam_nfsroot | cut -f2- -d","`
43 fi
44
45 if [ -e "$bootparam_root" ] || [ "${bootparam_rootfstype}" = "nfs" ]; then
46 flags=""
47 if [ -n "$bootparam_ro" ] && ! echo "$bootparam_rootflags" | grep -w -q "ro"; then
48 if [ -n "$bootparam_rootflags" ]; then
49 bootparam_rootflags="$bootparam_rootflags,"
50 fi
51 bootparam_rootflags="${bootparam_rootflags}ro"
52 fi
53 if [ -n "$bootparam_nfsopts" ]; then
54 if [ -n "$bootparam_rootflags" ]; then
55 bootparam_rootflags="$bootparam_rootflags,"
56 fi
57 bootparam_rootflags="${bootparam_rootflags}${bootparam_nfsopts}"
58 fi
59 if [ -n "$bootparam_rootflags" ]; then
60 flags="$flags -o$bootparam_rootflags"
61 fi
62 if [ -n "$bootparam_rootfstype" ]; then
63 flags="$flags -t$bootparam_rootfstype"
64 fi
65 mount $flags $bootparam_root $ROOTFS_DIR
66 if [ -d $ROOTFS_DIR/dev ]; then
67 break
68 else
69 # It is unlikely to change, but keep trying anyway.
70 # Perhaps we pick a different device next time.
71 umount $ROOTFS_DIR
72 fi
73 fi
74 fi
75 debug "Sleeping for $delay second(s) to wait root to settle..."
76 sleep $delay
77 C=$(( $C + 1 ))
78 done
79}
diff --git a/meta-intel-extras/recipes/initrdscripts/initramfs-framework_1.0.bbappend b/meta-intel-extras/recipes/initrdscripts/initramfs-framework_1.0.bbappend
index cfd05cd..2a8ac89 100644
--- a/meta-intel-extras/recipes/initrdscripts/initramfs-framework_1.0.bbappend
+++ b/meta-intel-extras/recipes/initrdscripts/initramfs-framework_1.0.bbappend
@@ -1,6 +1,6 @@
1############################################################################ 1############################################################################
2## 2##
3## Copyright (C) 2018 The Qt Company Ltd. 3## Copyright (C) 2019 The Qt Company Ltd.
4## Contact: https://www.qt.io/licensing/ 4## Contact: https://www.qt.io/licensing/
5## 5##
6## This file is part of the Boot to Qt meta layer. 6## This file is part of the Boot to Qt meta layer.
@@ -29,14 +29,25 @@
29 29
30FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:" 30FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"
31 31
32SRC_URI += "file://rtsx_pci_sdmmc" 32SRC_URI += "\
33 file://rtsx_pci_sdmmc \
34 file://network \
35 "
33 36
34do_install_append() { 37do_install_append() {
35 install -m 0755 ${WORKDIR}/rtsx_pci_sdmmc ${D}/init.d/20-rtsx_pci_sdmmc 38 install -m 0755 ${WORKDIR}/rtsx_pci_sdmmc ${D}/init.d/20-rtsx_pci_sdmmc
39 install -m 0755 ${WORKDIR}/network ${D}/init.d/30-network
36} 40}
37 41
38PACKAGES += "initramfs-module-rtsx-pci-sdmmc" 42PACKAGES += "\
43 initramfs-module-rtsx-pci-sdmmc \
44 initramfs-module-r8169 \
45 "
39 46
40SUMMARY_initramfs-module-rtsx-pci-sdmmc = "initramfs support for rtsx_pci_sdmmc" 47SUMMARY_initramfs-module-rtsx-pci-sdmmc = "initramfs support for rtsx_pci_sdmmc"
41RDEPENDS_initramfs-module-rtsx-pci-sdmmc = "${PN}-base" 48RDEPENDS_initramfs-module-rtsx-pci-sdmmc = "${PN}-base"
42FILES_initramfs-module-rtsx-pci-sdmmc = "/init.d/20-rtsx_pci_sdmmc" 49FILES_initramfs-module-rtsx-pci-sdmmc = "/init.d/20-rtsx_pci_sdmmc"
50
51SUMMARY_initramfs-module-r8169 = "initramfs support for Realtek LAN driver"
52RDEPENDS_initramfs-module-r8169 = "${PN}-base"
53FILES_initramfs-module-r8169 = "/init.d/30-network"