summaryrefslogtreecommitdiffstats
path: root/meta-phosphor/common
diff options
context:
space:
mode:
Diffstat (limited to 'meta-phosphor/common')
-rw-r--r--meta-phosphor/common/recipes-bsp/u-boot/files/0001-config-ast-common-Add-conditional-factory-reset-comm.patch46
-rw-r--r--meta-phosphor/common/recipes-bsp/u-boot/u-boot.inc3
-rw-r--r--meta-phosphor/common/recipes-core/base-files/base-files/fstab4
-rw-r--r--meta-phosphor/common/recipes-core/base-files/base-files_%.bbappend2
-rw-r--r--meta-phosphor/common/recipes-phosphor/flash/phosphor-software-manager.bb1
-rw-r--r--meta-phosphor/common/recipes-phosphor/flash/phosphor-software-manager/obmc-flash-bmc26
-rw-r--r--meta-phosphor/common/recipes-phosphor/flash/phosphor-software-manager/obmc-flash-bmc-reset.service9
-rw-r--r--meta-phosphor/common/recipes-phosphor/mount-overlay-help/mount-overlay-help.bb5
-rw-r--r--meta-phosphor/common/recipes-phosphor/mount-overlay-help/mount-overlay-help/mount-machine-id.service14
-rw-r--r--meta-phosphor/common/recipes-phosphor/mount-overlay-help/mount-overlay-help/prepare-overlay.service9
-rw-r--r--meta-phosphor/common/recipes-phosphor/preinit-mounts/preinit-mounts.bb10
-rw-r--r--meta-phosphor/common/recipes-phosphor/preinit-mounts/preinit-mounts/init19
12 files changed, 89 insertions, 59 deletions
diff --git a/meta-phosphor/common/recipes-bsp/u-boot/files/0001-config-ast-common-Add-conditional-factory-reset-comm.patch b/meta-phosphor/common/recipes-bsp/u-boot/files/0001-config-ast-common-Add-conditional-factory-reset-comm.patch
new file mode 100644
index 000000000..7cef7aa2e
--- /dev/null
+++ b/meta-phosphor/common/recipes-bsp/u-boot/files/0001-config-ast-common-Add-conditional-factory-reset-comm.patch
@@ -0,0 +1,46 @@
+From 90cdc1aa6079d0f2d5894807cbfee4e8125e2b5b Mon Sep 17 00:00:00 2001
+From: "Edward A. James" <eajames@us.ibm.com>
+Date: Thu, 9 Nov 2017 11:39:10 -0600
+Subject: [PATCH] config/ast-common: Add conditional factory reset command
+
+Factory reset (removing persistant rwfs) has to occur before we've
+mounted the rwfs. However, the variable to determine whether or not to
+do the reset is stored in the u-boot env. This is tricky to access
+before rwfs is mounted except in u-boot. So, check it before every boot.
+
+Signed-off-by: Edward A. James <eajames@us.ibm.com>
+---
+ include/configs/ast-common.h | 6 +++++-
+ 1 file changed, 5 insertions(+), 1 deletion(-)
+
+diff --git a/include/configs/ast-common.h b/include/configs/ast-common.h
+index 8150265..41d196a 100644
+--- a/include/configs/ast-common.h
++++ b/include/configs/ast-common.h
+@@ -121,6 +121,8 @@
+ #define CONFIG_ENV_SIZE 0x10000 /* Total Size of Environment Sector */
+ #define CONFIG_ENV_SIZE_REDUND 0x10000
+
++#define CONFIG_RWFS_SIZE 0x400000
++
+ #if 0
+ #define CONFIG_BOOTCOMMAND \
+ "fdt addr 20080000; " \
+@@ -137,11 +139,13 @@
+ "kernelname=kernel-0 \0" \
+ "loadaddr=" __stringify(CONFIG_LOADADDR) "\0" \
+ "set_bootargs=setenv bootargs " CONFIG_BOOTARGS " ubi.block=\${ubiblock} root=\${root} \0" \
+- "obmc_bootcmd=ubi part obmc-ubi; ubi read ${loadaddr} ${kernelname}; bootm ${loadaddr} \0" \
++ "obmc_bootcmd=ubi part obmc-ubi; run do_rwreset; ubi read ${loadaddr} ${kernelname}; bootm ${loadaddr} \0" \
+ "verify=yes\0" \
+ "spi_dma=yes\0" \
+ "mtdids=" MTDIDS_DEFAULT "\0" \
+ "mtdparts=" MTDPARTS_DEFAULT "\0" \
++ "rwfs_size=" __stringify(CONFIG_RWFS_SIZE) "\0" \
++ "do_rwreset=if test \"\${rwreset}\" = \"true\"; then ubi remove rwfs; ubi create rwfs \${rwfs_size}; fi \0" \
+ ""
+
+ #endif /* __AST_COMMON_CONFIG_H */
+--
+1.8.3.1
+
diff --git a/meta-phosphor/common/recipes-bsp/u-boot/u-boot.inc b/meta-phosphor/common/recipes-bsp/u-boot/u-boot.inc
index 5cc320fbc..a5be9f8fc 100644
--- a/meta-phosphor/common/recipes-bsp/u-boot/u-boot.inc
+++ b/meta-phosphor/common/recipes-bsp/u-boot/u-boot.inc
@@ -10,7 +10,8 @@ SRC_URI += "file://0001-configs-ast-Add-redundnant-env.patch"
SRC_URI += "${@bb.utils.contains('MACHINE_FEATURES', 'obmc-ubi-fs', \
'file://0001-config-ast-common-hack-bootopts.patch \
- file://0004-config-ast-common-ubi-bootops.patch', '', d)}"
+ file://0004-config-ast-common-ubi-bootops.patch \
+ file://0001-config-ast-common-Add-conditional-factory-reset-comm.patch', '', d)}"
python do_configure () {
if ((d.getVar("MACHINE_FEATURES", True)) == "obmc-ubi-fs"):
diff --git a/meta-phosphor/common/recipes-core/base-files/base-files/fstab b/meta-phosphor/common/recipes-core/base-files/base-files/fstab
index 7d6ac6c6c..4a0766876 100644
--- a/meta-phosphor/common/recipes-core/base-files/base-files/fstab
+++ b/meta-phosphor/common/recipes-core/base-files/base-files/fstab
@@ -4,8 +4,6 @@
proc /proc proc defaults 0 0
devpts /dev/pts devpts mode=0620,gid=5 0 0
tmpfs /run tmpfs mode=0755,nodev,nosuid,strictatime 0 0
-ubi0:rwfs /var ubifs defaults,x-systemd.requires=obmc-flash-bmc-reset.service 0 0
-overlay /etc overlay defaults,x-systemd.requires=prepare-overlay.service,lowerdir=/etc,upperdir=/var/persist/etc,workdir=/var/persist/etc-work 0 0
tmpfs /var/volatile tmpfs defaults 0 0
tmpfs /media tmpfs defaults 0 0
-/var/persist/home /home none bind,x-systemd.requires=prepare-overlay.service 0 0
+/var/persist/home /home none bind 0 0
diff --git a/meta-phosphor/common/recipes-core/base-files/base-files_%.bbappend b/meta-phosphor/common/recipes-core/base-files/base-files_%.bbappend
index f282cde90..e632d563c 100644
--- a/meta-phosphor/common/recipes-core/base-files/base-files_%.bbappend
+++ b/meta-phosphor/common/recipes-core/base-files/base-files_%.bbappend
@@ -2,7 +2,7 @@ inherit obmc-phosphor-utils
FILESEXTRAPATHS_prepend := "${@mf_enabled(d, 'obmc-ubi-fs', '${THISDIR}/${PN}:')}"
-RDEPENDS_${PN}_append += "${@mf_enabled(d, 'obmc-ubi-fs', 'mount-overlay-help')}"
+RDEPENDS_${PN}_append += "${@mf_enabled(d, 'obmc-ubi-fs', 'preinit-mounts')}"
do_install_append() {
install -d ${D}/srv
diff --git a/meta-phosphor/common/recipes-phosphor/flash/phosphor-software-manager.bb b/meta-phosphor/common/recipes-phosphor/flash/phosphor-software-manager.bb
index b18002230..ed8de0b33 100644
--- a/meta-phosphor/common/recipes-phosphor/flash/phosphor-software-manager.bb
+++ b/meta-phosphor/common/recipes-phosphor/flash/phosphor-software-manager.bb
@@ -79,7 +79,6 @@ SYSTEMD_SERVICE_${PN}-updater += " \
reboot-guard-enable.service \
reboot-guard-disable.service \
obmc-flash-bmc-cleanup.service \
- obmc-flash-bmc-reset.service \
"
# Name of the mtd device where the ubi volumes should be created
diff --git a/meta-phosphor/common/recipes-phosphor/flash/phosphor-software-manager/obmc-flash-bmc b/meta-phosphor/common/recipes-phosphor/flash/phosphor-software-manager/obmc-flash-bmc
index 1a206604b..40ec06824 100644
--- a/meta-phosphor/common/recipes-phosphor/flash/phosphor-software-manager/obmc-flash-bmc
+++ b/meta-phosphor/common/recipes-phosphor/flash/phosphor-software-manager/obmc-flash-bmc
@@ -59,6 +59,14 @@ findname() {
echo "${n}"
}
+# Set the u-boot env command that performs the factory reset if requested
+set_do_rwreset() {
+ if ! fw_printenv do_rwreset; then
+ fw_setenv do_rwreset "if test \"\${rwreset}\" = \"true\"; then ubi remove rwfs; ubi create rwfs 0x400000; fi"
+ fw_setenv obmc_bootcmd "ubi part obmc-ubi; run do_rwreset; ubi read \${loadaddr} \${kernelname}; bootm \${loadaddr}"
+ fi
+}
+
# Make space on flash before creating new volumes. This can be enhanced
# determine current flash usage. For now only keep a "keepmax" number of them
ubi_remove_volumes()
@@ -239,6 +247,8 @@ remount_ubi() {
fi
done
done
+
+ set_do_rwreset
}
# Read the current env variable and set it on the alternate boot env
@@ -323,19 +333,6 @@ create_vol_in_alt() {
fi
}
-factory_reset() {
- # A lock file for printenv exists on /var, which isn't mounted when this
- # function is called. We have to read the rwreset variable out of file.
- ubootmtd="$(findmtd "u-boot-env")"
- grep -q -x "rwreset=true" /dev/$ubootmtd
- if [ "$?" = "0" ]; then
- ubi_remove "rwfs"
- reqmtd="bmc"
- name="rwfs"
- ubi_rw
- fi
-}
-
case "$1" in
mtduboot)
reqmtd="$2"
@@ -396,9 +393,6 @@ case "$1" in
rebootguarddisable)
rebootguarddisable
;;
- reset)
- factory_reset
- ;;
*)
echo "Invalid argument"
exit 1
diff --git a/meta-phosphor/common/recipes-phosphor/flash/phosphor-software-manager/obmc-flash-bmc-reset.service b/meta-phosphor/common/recipes-phosphor/flash/phosphor-software-manager/obmc-flash-bmc-reset.service
deleted file mode 100644
index 38dc60e0f..000000000
--- a/meta-phosphor/common/recipes-phosphor/flash/phosphor-software-manager/obmc-flash-bmc-reset.service
+++ /dev/null
@@ -1,9 +0,0 @@
-[Unit]
-Description=Factory reset BMC if reset enabled
-DefaultDependencies=no
-
-[Service]
-Type=oneshot
-RemainAfterExit=no
-ExecStart=/usr/bin/env obmc-flash-bmc reset
-SyslogIdentifier=obmc-flash-bmc
diff --git a/meta-phosphor/common/recipes-phosphor/mount-overlay-help/mount-overlay-help.bb b/meta-phosphor/common/recipes-phosphor/mount-overlay-help/mount-overlay-help.bb
deleted file mode 100644
index 4125fd07d..000000000
--- a/meta-phosphor/common/recipes-phosphor/mount-overlay-help/mount-overlay-help.bb
+++ /dev/null
@@ -1,5 +0,0 @@
-inherit obmc-phosphor-license
-
-SYSTEMD_SERVICE_${PN} = "prepare-overlay.service mount-machine-id.service"
-
-inherit obmc-phosphor-systemd
diff --git a/meta-phosphor/common/recipes-phosphor/mount-overlay-help/mount-overlay-help/mount-machine-id.service b/meta-phosphor/common/recipes-phosphor/mount-overlay-help/mount-overlay-help/mount-machine-id.service
deleted file mode 100644
index 0d72f0a8e..000000000
--- a/meta-phosphor/common/recipes-phosphor/mount-overlay-help/mount-overlay-help/mount-machine-id.service
+++ /dev/null
@@ -1,14 +0,0 @@
-[Unit]
-Description=Mount machine-id
-Requires=etc.mount
-After=etc.mount
-DefaultDependencies=false
-ConditionPathExists=!/var/persist/etc/machine-id
-
-[Install]
-RequiredBy=local-fs.target
-
-[Service]
-ExecStart=/bin/sh -c "mount --bind /run/machine-id /etc/machine-id"
-Type=oneshot
-RemainAfterExit=no
diff --git a/meta-phosphor/common/recipes-phosphor/mount-overlay-help/mount-overlay-help/prepare-overlay.service b/meta-phosphor/common/recipes-phosphor/mount-overlay-help/mount-overlay-help/prepare-overlay.service
deleted file mode 100644
index 66843b32c..000000000
--- a/meta-phosphor/common/recipes-phosphor/mount-overlay-help/mount-overlay-help/prepare-overlay.service
+++ /dev/null
@@ -1,9 +0,0 @@
-[Unit]
-Description=Prepare for overlay fs
-RequiresMountsFor=/var
-DefaultDependencies=false
-
-[Service]
-ExecStart=/bin/sh -c "if ! mountpoint /etc; then rm -rf /var/persist/etc-work && mkdir -p /var/persist/etc-work; fi; mkdir -p /var/persist/etc /var/persist/home/root"
-Type=oneshot
-RemainAfterExit=no
diff --git a/meta-phosphor/common/recipes-phosphor/preinit-mounts/preinit-mounts.bb b/meta-phosphor/common/recipes-phosphor/preinit-mounts/preinit-mounts.bb
new file mode 100644
index 000000000..e3aaf546b
--- /dev/null
+++ b/meta-phosphor/common/recipes-phosphor/preinit-mounts/preinit-mounts.bb
@@ -0,0 +1,10 @@
+inherit obmc-phosphor-license
+
+SRC_URI += "file://init"
+
+FILES_${PN} += "/sbin/init"
+
+do_install() {
+ install -d ${D}/sbin
+ install -m 0755 ${WORKDIR}/init ${D}/sbin/init
+}
diff --git a/meta-phosphor/common/recipes-phosphor/preinit-mounts/preinit-mounts/init b/meta-phosphor/common/recipes-phosphor/preinit-mounts/preinit-mounts/init
new file mode 100644
index 000000000..91f8038f9
--- /dev/null
+++ b/meta-phosphor/common/recipes-phosphor/preinit-mounts/preinit-mounts/init
@@ -0,0 +1,19 @@
+#!/bin/sh
+
+if ! mount ubi0:rwfs /var -t ubifs -o defaults; then
+ if ! mount ubi0:rwfs /var -t ubifs -o defaults,ro; then
+ mount tmpfs /var -t tmpfs -o defaults
+ fi
+fi
+
+mkdir -p /var/persist/etc /var/persist/etc-work /var/persist/home/root
+
+rm -rf /var/persist/etc-work/*
+# rm -rf specifically skips . and .. directories; pipe all output to null to avoid the error message
+rm -rf /var/persist/etc-work/.* > /dev/null 2>&1
+
+if ! mount overlay /etc -t overlay -o defaults,lowerdir=/etc,upperdir=/var/persist/etc,workdir=/var/persist/etc-work; then
+ mount overlay /etc -t overlay -o defaults,lowerdir=/etc:/var/persist/etc
+fi
+
+exec /lib/systemd/systemd
OpenPOWER on IntegriCloud