Merge pull request #203 from williamspatrick/yocto-cleanup

Yocto cleanup
diff --git a/meta-openbmc-machines/meta-openpower/meta-rackspace/meta-barreleye/recipes-kernel/linux/linux-obmc/barreleye.cfg b/meta-openbmc-machines/meta-openpower/meta-rackspace/meta-barreleye/recipes-kernel/linux/linux-obmc/barreleye.cfg
new file mode 100644
index 0000000..086f191
--- /dev/null
+++ b/meta-openbmc-machines/meta-openpower/meta-rackspace/meta-barreleye/recipes-kernel/linux/linux-obmc/barreleye.cfg
@@ -0,0 +1,3 @@
+CONFIG_PMBUS=y
+CONFIG_SENSORS_PMBUS=y
+CONFIG_SENSORS_ADM1275=y
diff --git a/meta-openbmc-machines/meta-openpower/meta-rackspace/meta-barreleye/recipes-kernel/linux/linux-obmc/hwmon_adm1278.patch b/meta-openbmc-machines/meta-openpower/meta-rackspace/meta-barreleye/recipes-kernel/linux/linux-obmc/hwmon_adm1278.patch
new file mode 100644
index 0000000..074d39f
--- /dev/null
+++ b/meta-openbmc-machines/meta-openpower/meta-rackspace/meta-barreleye/recipes-kernel/linux/linux-obmc/hwmon_adm1278.patch
@@ -0,0 +1,165 @@
+diff --git a/drivers/hwmon/pmbus/adm1275.c b/drivers/hwmon/pmbus/adm1275.c
+index 188af4c..a45075d 100644
+--- a/drivers/hwmon/pmbus/adm1275.c
++++ b/drivers/hwmon/pmbus/adm1275.c
+@@ -24,7 +24,7 @@
+ #include <linux/bitops.h>
+ #include "pmbus.h"
+ 
+-enum chips { adm1075, adm1275, adm1276, adm1293, adm1294 };
++enum chips { adm1075, adm1275, adm1276, adm1278, adm1293, adm1294 };
+ 
+ #define ADM1275_MFR_STATUS_IOUT_WARN2	BIT(0)
+ #define ADM1293_MFR_STATUS_VAUX_UV_WARN	BIT(5)
+@@ -70,6 +70,22 @@ enum chips { adm1075, adm1275, adm1276, adm1293, adm1294 };
+ #define ADM1075_VAUX_OV_WARN		BIT(7)
+ #define ADM1075_VAUX_UV_WARN		BIT(6)
+ 
++#define ADM1278_PMON_CONTROL		0xd3
++#define ADM1278_PMON_CONFIG		0xd4
++#define ADM1278_CFG_TSFLT		BIT(15)
++#define ADM1278_CFG_SIMULTANEOUS	BIT(14)
++#define ADM1278_CFG_PMON_MODE		BIT(4)
++#define ADM1278_CFG_TEMP1_EN		BIT(3)
++#define ADM1278_CFG_VIN_EN		BIT(2)
++#define ADM1278_CFG_VOUT_EN		BIT(1)
++#define ADM1278_PEAK_TEMPERATURE	0xd7
++
++#define ADM1278_R_SENSE	1000	/* R_sense resistor value in microohmsi */
++
++static int r_sense = ADM1278_R_SENSE;
++module_param(r_sense, int, 0644);
++MODULE_PARM_DESC(r_sense, "Rsense resistor value in microohms");
++
+ struct adm1275_data {
+ 	int id;
+ 	bool have_oc_fault;
+@@ -186,6 +202,11 @@ static int adm1275_read_word_data(struct i2c_client *client, int page, int reg)
+ 	case PMBUS_VIRT_READ_VIN_MAX:
+ 		ret = pmbus_read_word_data(client, 0, ADM1275_PEAK_VIN);
+ 		break;
++	case PMBUS_VIRT_READ_TEMP_MAX:
++		if (data->id != adm1278)
++			return -ENODATA;
++		ret = pmbus_read_word_data(client, 0, ADM1278_PEAK_TEMPERATURE);
++		break;
+ 	case PMBUS_VIRT_READ_PIN_MIN:
+ 		if (!data->have_pin_min)
+ 			return -ENXIO;
+@@ -199,6 +220,7 @@ static int adm1275_read_word_data(struct i2c_client *client, int page, int reg)
+ 	case PMBUS_VIRT_RESET_IOUT_HISTORY:
+ 	case PMBUS_VIRT_RESET_VOUT_HISTORY:
+ 	case PMBUS_VIRT_RESET_VIN_HISTORY:
++	case PMBUS_VIRT_RESET_TEMP_HISTORY:
+ 		break;
+ 	case PMBUS_VIRT_RESET_PIN_HISTORY:
+ 		if (!data->have_pin_max)
+@@ -239,6 +261,9 @@ static int adm1275_write_word_data(struct i2c_client *client, int page, int reg,
+ 	case PMBUS_VIRT_RESET_VIN_HISTORY:
+ 		ret = pmbus_write_word_data(client, 0, ADM1275_PEAK_VIN, 0);
+ 		break;
++	case PMBUS_VIRT_RESET_TEMP_HISTORY:
++		ret = pmbus_write_word_data(client, 0, ADM1278_PEAK_TEMPERATURE, 0);
++		break;
+ 	case PMBUS_VIRT_RESET_PIN_HISTORY:
+ 		ret = pmbus_write_word_data(client, 0, ADM1276_PEAK_PIN, 0);
+ 		if (!ret && data->have_pin_min)
+@@ -312,6 +337,7 @@ static const struct i2c_device_id adm1275_id[] = {
+ 	{ "adm1075", adm1075 },
+ 	{ "adm1275", adm1275 },
+ 	{ "adm1276", adm1276 },
++	{ "adm1278", adm1278 },
+ 	{ "adm1293", adm1293 },
+ 	{ "adm1294", adm1294 },
+ 	{ }
+@@ -335,6 +361,8 @@ static int adm1275_probe(struct i2c_client *client,
+ 				     | I2C_FUNC_SMBUS_BLOCK_DATA))
+ 		return -ENODEV;
+ 
++	/* i2c_aspeed driver does not handle i2c_smbus_read_block_data correctly */
++#if 0
+ 	ret = i2c_smbus_read_block_data(client, PMBUS_MFR_ID, block_buffer);
+ 	if (ret < 0) {
+ 		dev_err(&client->dev, "Failed to read Manufacturer ID\n");
+@@ -363,6 +391,7 @@ static int adm1275_probe(struct i2c_client *client,
+ 		dev_notice(&client->dev,
+ 			   "Device mismatch: Configured %s, detected %s\n",
+ 			   id->name, mid->name);
++#endif
+ 
+ 	config = i2c_smbus_read_byte_data(client, ADM1275_PMON_CONFIG);
+ 	if (config < 0)
+@@ -377,7 +406,9 @@ static int adm1275_probe(struct i2c_client *client,
+ 	if (!data)
+ 		return -ENOMEM;
+ 
+-	data->id = mid->driver_data;
++	/* i2c_aspeed driver does not handle i2c_smbus_read_block_data correctly */
++	//data->id = mid->driver_data;
++	data->id = adm1278;
+ 
+ 	info = &data->info;
+ 
+@@ -460,6 +491,62 @@ static int adm1275_probe(struct i2c_client *client,
+ 			info->func[0] |=
+ 			  PMBUS_HAVE_VOUT | PMBUS_HAVE_STATUS_VOUT;
+ 		break;
++	case adm1278:
++		/* Configure monitoring */
++		ret = i2c_smbus_write_byte_data(client,
++			ADM1278_PMON_CONTROL, 0);
++		if (ret < 0)
++			return ret;
++		ret = i2c_smbus_read_word_data(client, ADM1275_PMON_CONFIG);
++		ret = i2c_smbus_write_word_data(client, ADM1275_PMON_CONFIG,
++						ADM1278_CFG_PMON_MODE |
++						ADM1278_CFG_TEMP1_EN |
++						ADM1278_CFG_VIN_EN |
++						ADM1278_CFG_VOUT_EN);
++		if (ret < 0)
++			return ret;
++		ret = i2c_smbus_read_word_data(client, ADM1275_PMON_CONFIG);
++		dev_info(&client->dev, "adm1278 config: 0x%x\n", ret);
++		ret = i2c_smbus_write_byte_data(client, ADM1278_PMON_CONTROL,1);
++		if (ret < 0)
++			return ret;
++
++		info->func[0] |= PMBUS_HAVE_VIN
++			| PMBUS_HAVE_VOUT | PMBUS_HAVE_STATUS_VOUT
++			| PMBUS_HAVE_PIN
++			| PMBUS_HAVE_STATUS_INPUT
++			| PMBUS_HAVE_TEMP | PMBUS_HAVE_STATUS_TEMP;
++
++		data->have_oc_fault = false;
++		data->have_uc_fault = false;
++		data->have_vout = true;
++		data->have_vaux_status = false;
++		data->have_mfr_vaux_status = false;
++		data->have_iout_min = false;
++		data->have_pin_min = false;
++		data->have_pin_max = true;
++
++		info->m[PSC_VOLTAGE_IN] = 19599;
++		info->b[PSC_VOLTAGE_IN] = 0;
++		info->R[PSC_VOLTAGE_IN] = -2;
++
++		info->m[PSC_VOLTAGE_OUT] = 19599;
++		info->b[PSC_VOLTAGE_OUT] = 0;
++		info->R[PSC_VOLTAGE_OUT] = -2;
++
++		info->m[PSC_CURRENT_OUT] = 800 * r_sense / 1000;
++		info->b[PSC_CURRENT_OUT] = 20475;
++		info->R[PSC_CURRENT_OUT] = -1;
++
++		info->m[PSC_POWER] = 6123 * r_sense / 1000;
++		info->b[PSC_POWER] = 0;
++		info->R[PSC_POWER] = -2;
++
++		info->format[PSC_TEMPERATURE] = direct;
++		info->m[PSC_TEMPERATURE] = 42;
++		info->b[PSC_TEMPERATURE] = 31880;
++		info->R[PSC_TEMPERATURE] = -1;
++		break;
+ 	case adm1293:
+ 	case adm1294:
+ 		data->have_iout_min = true;
diff --git a/meta-openbmc-machines/meta-openpower/meta-rackspace/meta-barreleye/recipes-kernel/linux/linux-obmc/readme_adm1278.txt b/meta-openbmc-machines/meta-openpower/meta-rackspace/meta-barreleye/recipes-kernel/linux/linux-obmc/readme_adm1278.txt
new file mode 100644
index 0000000..e86d977
--- /dev/null
+++ b/meta-openbmc-machines/meta-openpower/meta-rackspace/meta-barreleye/recipes-kernel/linux/linux-obmc/readme_adm1278.txt
@@ -0,0 +1,78 @@
+README for adm1278 hwmon driver
+==================================
+Yi Li <shliyi@cn.ibm.com>
+
+
+This is a temporary kernel patch to enable hwmon driver for adm1278 chip on Barreleye.
+When this patch is merged into linux kernel, this patch will be removed from openbmc.
+
+The adm1278 driver is created according to datasheet:
+http://www.analog.com/media/en/technical-documentation/data-sheets/ADM1278.pdf
+
+The patch heavily re-used adm1278 enabling code from: https://github.com/facebook/openbmc/blob/master/meta-aspeed/recipes-kernel/linux/files/patch-2.6.28.9/0000-linux-openbmc.patch.
+
+This patch has been tested on barreleye, by following these steps:
+
+1) There are 3 adm1278 devices on Barreleye
+
+I2C5: P12v_a for CPU0
+I2C6: P12v_b for CPU1
+I2C7: P12v_c for HDD and IO Board
+
+2) adm1278 driver is based on adm1275.c, which depends on pmbus. This patch builds
+adm1275 and pmbus into kernel.
+
+3) When kernel booted, initialize the adm1278 devices:
+
+root@barreleye:~# echo adm1278 0x10 > /sys/class/i2c-adapter/i2c-4/new_device
+root@barreleye:~# echo adm1278 0x10 > /sys/class/i2c-adapter/i2c-5/new_device
+root@barreleye:~# echo adm1278 0x10 > /sys/class/i2c-adapter/i2c-6/new_device
+
+There will be three new hwmon sysfs entries created:
+
+root@barreleye:~# ls /sys/class/hwmon/hwmon3/
+curr1_highest         in1_highest           in1_reset_history     in2_min_alarm         power1_label          temp1_input
+curr1_input           in1_input             in2_highest           in2_reset_history     power1_max            temp1_max
+curr1_label           in1_label             in2_input             name                  power1_reset_history  temp1_max_alarm
+curr1_max             in1_max               in2_label             power/                subsystem/            temp1_reset_history
+curr1_max_alarm       in1_max_alarm         in2_max               power1_alarm          temp1_crit            uevent
+curr1_reset_history   in1_min               in2_max_alarm         power1_input          temp1_crit_alarm
+device/               in1_min_alarm         in2_min               power1_input_highest  temp1_highest
+root@barreleye:~# ls /sys/class/hwmon/hwmon4/
+curr1_highest         in1_highest           in1_reset_history     in2_min_alarm         power1_label          temp1_input
+curr1_input           in1_input             in2_highest           in2_reset_history     power1_max            temp1_max
+curr1_label           in1_label             in2_input             name                  power1_reset_history  temp1_max_alarm
+curr1_max             in1_max               in2_label             power/                subsystem/            temp1_reset_history
+curr1_max_alarm       in1_max_alarm         in2_max               power1_alarm          temp1_crit            uevent
+curr1_reset_history   in1_min               in2_max_alarm         power1_input          temp1_crit_alarm
+device/               in1_min_alarm         in2_min               power1_input_highest  temp1_highest
+root@barreleye:~# ls /sys/class/hwmon/hwmon5/
+curr1_highest         in1_highest           in1_reset_history     in2_min_alarm         power1_label          temp1_input
+curr1_input           in1_input             in2_highest           in2_reset_history     power1_max            temp1_max
+curr1_label           in1_label             in2_input             name                  power1_reset_history  temp1_max_alarm
+curr1_max             in1_max               in2_label             power/                subsystem/            temp1_reset_history
+curr1_max_alarm       in1_max_alarm         in2_max               power1_alarm          temp1_crit            uevent
+curr1_reset_history   in1_min               in2_max_alarm         power1_input          temp1_crit_alarm
+device/               in1_min_alarm         in2_min               power1_input_highest  temp1_highest
+
+4) For details of what each hwmon sysfs attributes mean, please refer to:
+https://www.kernel.org/doc/Documentation/hwmon/pmbus
+For short, 'curr1_*' refers to 'IOUT', 'in1_*' refers to 'vin', 'in2_*' refers to 'vout', 'power1_*' refers to 'input power',
+'temp1_*' for 'temperature'.
+
+5) Remaining issue:
+
+5.1) Currently, i2c_aspeed driver does not handle "i2c_smbus_read_block_data()" correctly. So this patch has to bypass some detection code.
+We need to fix this issue when the patch is merged to kernel.
+5.2) According to adm1278 datasheet, there is a sense resistor used to measure power and current. The resistor will affect conversion between
+adm1278 register value to real-world value for current and power. I am not very sure about the resistor value. So using 1 mili-ohms (or 1000 micro-ohms) as default value. When build the adm1275 driver as kernel module, we can set this resistor value by:
+
+# insmod adm1275.ko r_sense=500
+
+This will set the 'sense resistor' to 500 micro-ohms.
+5.3) Some of the sensor value, e.g, 'temp1_input' seems not reasonable, e.g:
+
+root@barreleye:~# cat /sys/class/hwmon/hwmon4/temp1_input
+-270952
+
+Need further check on that.
diff --git a/meta-openbmc-machines/meta-openpower/meta-rackspace/meta-barreleye/recipes-kernel/linux/linux-obmc_%.bbappend b/meta-openbmc-machines/meta-openpower/meta-rackspace/meta-barreleye/recipes-kernel/linux/linux-obmc_%.bbappend
new file mode 100644
index 0000000..b6e8e16
--- /dev/null
+++ b/meta-openbmc-machines/meta-openpower/meta-rackspace/meta-barreleye/recipes-kernel/linux/linux-obmc_%.bbappend
@@ -0,0 +1,3 @@
+FILESEXTRAPATHS_prepend := "${THISDIR}/linux-obmc:"
+SRC_URI += "file://barreleye.cfg"
+SRC_URI += "file://hwmon_adm1278.patch"
diff --git a/meta-phosphor/classes/obmc-phosphor-image.bbclass b/meta-phosphor/classes/obmc-phosphor-image.bbclass
index 0d4a0d0..164da33 100644
--- a/meta-phosphor/classes/obmc-phosphor-image.bbclass
+++ b/meta-phosphor/classes/obmc-phosphor-image.bbclass
@@ -41,6 +41,7 @@
         packagegroup-obmc-phosphor-apps-extras \
         i2c-tools \
         screen \
+        inarp \
         "
 
 def build_overlay(d):
diff --git a/meta-phosphor/common/recipes-bsp/u-boot/u-boot-fw-utils_2013.07.bb b/meta-phosphor/common/recipes-bsp/u-boot/u-boot-fw-utils_2013.07.bb
index c8ae846..bfbdcf6 100644
--- a/meta-phosphor/common/recipes-bsp/u-boot/u-boot-fw-utils_2013.07.bb
+++ b/meta-phosphor/common/recipes-bsp/u-boot/u-boot-fw-utils_2013.07.bb
@@ -12,7 +12,7 @@
 # We use the revision in order to avoid having to fetch it from the
 # repo during parse
 # SRCREV = "62c175fbb8a0f9a926c88294ea9f7e88eb898f6c"
-SRCREV="${AUTOREV}"
+SRCREV="4b44678c11ac82c7c797bb115e276181752ad54d"
 
 PV = "v2013.07+git${SRCPV}"
 
diff --git a/meta-phosphor/common/recipes-bsp/u-boot/u-boot_2013.07.bb b/meta-phosphor/common/recipes-bsp/u-boot/u-boot_2013.07.bb
index 80715e7..6070fbf 100644
--- a/meta-phosphor/common/recipes-bsp/u-boot/u-boot_2013.07.bb
+++ b/meta-phosphor/common/recipes-bsp/u-boot/u-boot_2013.07.bb
@@ -12,7 +12,7 @@
 
 # This revision corresponds to the tag "v2013.07"
 # We use the revision in order to avoid having to fetch it from the repo during parse
-SRCREV = "${AUTOREV}"
+SRCREV = "4b44678c11ac82c7c797bb115e276181752ad54d"
 
 PV = "v2013.07+git${SRCPV}"
 
diff --git a/meta-phosphor/common/recipes-phosphor/clear-once/clear-once.bb b/meta-phosphor/common/recipes-phosphor/clear-once/clear-once.bb
new file mode 100644
index 0000000..61e3c20
--- /dev/null
+++ b/meta-phosphor/common/recipes-phosphor/clear-once/clear-once.bb
@@ -0,0 +1,8 @@
+
+SUMMARY = "Clear boot-once variables"
+DESCRIPTION = "Clear u-boot variables used for one-time boot flow"
+
+RPROVIDES_${PN} += "clear-once"
+
+inherit obmc-phosphor-systemd
+inherit obmc-phosphor-license
diff --git a/meta-phosphor/common/recipes-phosphor/clear-once/clear-once/clear-once.service b/meta-phosphor/common/recipes-phosphor/clear-once/clear-once/clear-once.service
new file mode 100644
index 0000000..a7641e6
--- /dev/null
+++ b/meta-phosphor/common/recipes-phosphor/clear-once/clear-once/clear-once.service
@@ -0,0 +1,15 @@
+[Unit]
+Description=Clear one time boot overrides
+
+ConditionFileNotEmpty=/etc/fw_env.config
+RequiresMountsFor=/run /sbin /etc
+
+[Service]
+Type=oneshot
+RemainAfterExit=yes
+
+# It took 7 seconds to erase and write flash, be conservative
+TimeoutStartSec=60
+Restart=no
+
+ExecStart=/sbin/fw_setenv openbmconce
diff --git a/meta-phosphor/common/recipes-phosphor/host-ipmid/host-ipmid-oem.bb b/meta-phosphor/common/recipes-phosphor/host-ipmid/host-ipmid-oem.bb
index 0e647a8..1a6959a 100644
--- a/meta-phosphor/common/recipes-phosphor/host-ipmid/host-ipmid-oem.bb
+++ b/meta-phosphor/common/recipes-phosphor/host-ipmid/host-ipmid-oem.bb
@@ -19,7 +19,7 @@
 
 SRC_URI += "git://github.com/openbmc/openpower-host-ipmi-oem"
 
-SRCREV = "caa755e97b49d332e6100c086f5921d92be31c25"
+SRCREV = "345932324ce63d42fd88e762cb539c864167b008"
 
 FILES_${PN} += "${libdir}/host-ipmid/*.so"
 FILES_${PN}-dbg += "${libdir}/host-ipmid/.debug"
diff --git a/meta-phosphor/common/recipes-phosphor/host-ipmid/host-ipmid.bb b/meta-phosphor/common/recipes-phosphor/host-ipmid/host-ipmid.bb
index 74f16f4..ba1eaaf 100644
--- a/meta-phosphor/common/recipes-phosphor/host-ipmid/host-ipmid.bb
+++ b/meta-phosphor/common/recipes-phosphor/host-ipmid/host-ipmid.bb
@@ -14,11 +14,12 @@
 
 TARGET_CFLAGS   += "-fpic"
 
+RDEPENDS_${PN} += "clear-once"
 RDEPENDS_${PN} += "settings"
 RDEPENDS_${PN} += "network"
 SRC_URI += "git://github.com/openbmc/phosphor-host-ipmid"
 
-SRCREV = "4bc8baeadbcc3cda3c2106e163fe4249f4ce3ff2"
+SRCREV = "b7e01a16951e868b076f3d68ecb0688a5209aa5b"
 
 S = "${WORKDIR}/git"
 INSTALL_NAME = "ipmid"
diff --git a/meta-phosphor/common/recipes-phosphor/host-ipmid/host-ipmid/host-ipmid.service b/meta-phosphor/common/recipes-phosphor/host-ipmid/host-ipmid/host-ipmid.service
index ee9ce1a..ce96dbc 100644
--- a/meta-phosphor/common/recipes-phosphor/host-ipmid/host-ipmid/host-ipmid.service
+++ b/meta-phosphor/common/recipes-phosphor/host-ipmid/host-ipmid/host-ipmid.service
@@ -1,5 +1,7 @@
 [Unit]
 Description=Phosphor OpenBMC IPMI daemon
+Wants=clear-once.service
+After=clear-once.service
 
 [Service]
 ExecStart=/usr/sbin/ipmid
diff --git a/meta-phosphor/common/recipes-phosphor/inarp/inarp.bb b/meta-phosphor/common/recipes-phosphor/inarp/inarp.bb
new file mode 100644
index 0000000..a36bba1
--- /dev/null
+++ b/meta-phosphor/common/recipes-phosphor/inarp/inarp.bb
@@ -0,0 +1,17 @@
+SUMMARY = "Inverse ARP daemon"
+DESCRIPTION = "Daemon to respond to Inverse-ARP requests"
+HOMEPAGE = "http://github.com/openbmc/inarp"
+PR = "r1"
+
+inherit obmc-phosphor-license
+inherit obmc-phosphor-c-daemon
+
+TARGET_CFLAGS   += "-fpic -O2"
+
+RDEPENDS_${PN} += "network"
+SRC_URI += "git://github.com/openbmc/inarp"
+
+SRCREV = "19ed5170356495f5fc67189513c5739780ee6a81"
+
+S = "${WORKDIR}/git"
+INSTALL_NAME = "inarp"
diff --git a/meta-phosphor/common/recipes-phosphor/inarp/inarp/inarp.service b/meta-phosphor/common/recipes-phosphor/inarp/inarp/inarp.service
new file mode 100644
index 0000000..55517ab
--- /dev/null
+++ b/meta-phosphor/common/recipes-phosphor/inarp/inarp/inarp.service
@@ -0,0 +1,8 @@
+[Unit]
+Description=Phosphor Inverse ARP daemon
+
+[Service]
+ExecStart=/usr/sbin/inarp
+
+[Install]
+WantedBy=multi-user.target
diff --git a/meta-phosphor/common/recipes-phosphor/network/network.bb b/meta-phosphor/common/recipes-phosphor/network/network.bb
index 55bc627..1c48c05 100644
--- a/meta-phosphor/common/recipes-phosphor/network/network.bb
+++ b/meta-phosphor/common/recipes-phosphor/network/network.bb
@@ -10,7 +10,7 @@
 
 SRC_URI += "git://github.com/openbmc/phosphor-networkd"
 
-SRCREV = "9f804290dd0bf200a1ba28e107eae55bdb4076da"
+SRCREV = "448e8d839d37532d2667b9a38bb3aadb6c804e2e"
 
 S = "${WORKDIR}/git"
 
diff --git a/meta-phosphor/common/recipes-phosphor/obmc-phosphor-initfs/files/obmc-init.sh b/meta-phosphor/common/recipes-phosphor/obmc-phosphor-initfs/files/obmc-init.sh
index 12c5a2f..c37b3d5 100644
--- a/meta-phosphor/common/recipes-phosphor/obmc-phosphor-initfs/files/obmc-init.sh
+++ b/meta-phosphor/common/recipes-phosphor/obmc-phosphor-initfs/files/obmc-init.sh
@@ -44,6 +44,84 @@
 	echo ${fst:=jffs2}
 }
 
+# This fw_get_env_var is a possibly broken version of fw_printenv that
+# does not check the crc or flag byte.
+# The u-boot environemnt starts with a crc32, followed by a flag byte
+# when a redundannt environment is configured, followed by var=value\0 sets.
+# The flag byte for nand is a 1 byte counter; for nor it is a 1 or 0 byte.
+
+get_fw_env_var() {
+	# do we have 1 or 2 copies of the environment?
+	# count non-blank non-comment lines
+	# copies=$(grep -v ^# /etc/fw_env.config | grep -c [::alnum::])
+	# ... we could if we had the fw_env.config in the initramfs
+	copies=1
+
+	# * Change \n to \r and \0 to \n
+	# * Skip to the 5th byte to skip over crc
+	# * then skip to the first or 2nd byte to skip over flag if it exists
+	# * stop parsing at first empty line corresponding to the
+	#   double \0 at the end of the environment.
+	# * print the value of the variable name passed as argument
+
+	cat /run/fw_env | 
+	tr '\n\000' '\r\n' |
+	tail -c +5 | tail -c +${copies-1} | 
+	sed -ne '/^$/,$d' -e "s/^$1=//p"
+}
+
+setup_resolv() {
+	runresolv=/run/systemd/resolve/resolv.conf
+	etcresolv=/etc/resolv.conf
+
+	if test ! -e $etcresolv -a ! -L $etcresolv
+	then
+		mkdir -p ${runresolv%/*}
+		ln -s $runresolv $etcresolv
+	fi
+	if test ! -f $runresolv
+	then
+		cat  /proc/net/pnp > $runresolv
+	fi
+
+	return 0
+}
+
+try_tftp() {
+	# split into  tftp:// host:port/ path/on/remote
+	# then spilt off / and then :port from the end of host:port/
+	# and : from the beginning of port
+
+	rest="${1#tftp://}"
+	path=${rest#*/}
+	host=${rest%$path}
+	host="${host%/}"
+	port="${host#${host%:*}}"
+	host="${host%$port}"
+	port="${port#:}"
+
+	setup_resolv
+
+	if test -z "$host" -o -z "$path"
+	then
+		debug_takeover "Invalid tftp download url '$url'."
+	elif echo "Downloading '$url' from $host ..."  &&
+		! tftp -g -r "$path" -l /run/image-rofs "$host" ${port+"$port"}
+	then
+		debug_takeover "Download of '$url' failed."
+	fi
+}
+
+try_wget() {
+	setup_resolv
+
+	echo "Downloading '$1' ..."
+	if ! wget -O /run/image-rofs "$1"
+	then
+		debug_takeover "Download of '$url' failed."
+	fi
+}
+
 debug_takeover() {
 	echo "$@"
 	test -n "$@" && echo Enter password to try to manually fix.
@@ -88,6 +166,10 @@
 # Set to y for yes, anything else for no.
 force_rwfst_jffs2=y
 flash_images_before_init=n
+consider_download_files=y
+consider_download_tftp=y
+consider_download_http=y
+consider_download_ftp=y
 
 rofst=squashfs
 rwfst=$(probe_fs_type $rwdev)
@@ -101,24 +183,94 @@
 fsckbase=/sbin/fsck.
 fsck=$fsckbase$rwfst
 fsckopts=-a
+optfile=/run/initramfs/init-options
+urlfile=/run/initramfs/init-download-url
+update=/run/initramfs/update
+
+if test -e /${optfile##*/}
+then
+	cp /${optfile##*/} $optfile
+fi
+
+if test ! -f $optfile
+then
+	cat /proc/cmdline > $optfile
+	get_fw_env_var openbmcinit >> $optfile
+	get_fw_env_var openbmconce >> $optfile
+fi
 
 echo rofs = $rofs $rofst   rwfs = $rwfs $rwfst
 
-if grep -w debug-init-sh /proc/cmdline
+if grep -w debug-init-sh $optfile
 then
 	debug_takeover "Debug initial shell requested by command line."
 fi
 
-# If there are images in root move them to run/initramfs/ now.
-imagebasename=${image##*/}
-if test -n "${imagebasename}" -a "x$flash_images_before_init" = xy &&
-	ls /${imagebasename}* > /dev/null 2>&1
+if test "x$consider_download_files" = xy &&
+	grep -w openbmc-init-download-files $optfile
 then
-	echo "Pending flash updates found."
-	mv /${imagebasename}* ${image%$imagebasename}
+	if test -f ${urlfile##*/}
+	then
+		cp ${urlfile##*/} $urlfile
+	fi
+	if test ! -f $urlfile
+	then
+		get_fw_env_var openbmcinitdownloadurl > $urlfile
+	fi
+	url="$(cat $urlfile)"
+	rest="${url#*://}"
+	proto="${url%$rest}"
+
+	if test -z "$url"
+	then
+		echo "Download url empty.  Ignoring download request."
+	elif test -z "$proto"
+	then
+		echo "Download failed."
+	elif test "$proto" = tftp://
+	then
+		if test "x$consider_download_tftp" = xy
+		then
+			try_tftp "$url"
+		else
+			echo "Download failed."
+		fi
+	elif test "$proto" = http://
+	then
+		if test "x$consider_download_http" = xy
+		then
+			try_wget "$url"
+		else
+			echo "Download failed."
+		fi
+	elif test "$proto" = ftp://
+	then
+		if test "x$consider_download_ftp" = xy
+		then
+			try_wget "$url"
+		else
+			echo "Download failed."
+		fi
+	else
+		echo "Download failed."
+	fi
 fi
 
-if grep -w clean-rwfs-filesystem /proc/cmdline
+# If there are images in root move them to /run/initramfs/ or /run/ now.
+imagebasename=${image##*/}
+if test -n "${imagebasename}" && ls /${imagebasename}* > /dev/null 2>&1
+then
+	if test "x$flash_images_before_init" = xy
+	then
+		echo "Flash images found, will update before starting init."
+		mv /${imagebasename}* ${image%$imagebasename}
+	else
+		echo "Flash images found, will use but deferring flash update."
+		mv /${imagebasename}* /run/
+	fi
+fi
+
+if grep -w clean-rwfs-filesystem $optfile
 then
 	echo "Cleaning of read-write overlay filesystem requested."
 	touch $trigger
@@ -132,27 +284,64 @@
 
 if ls $image* > /dev/null 2>&1
 then
-	if ! test -x /update
+	if ! test -x $update
 	then
-		debug_takeover "Flash update requested but /update missing!"
+		debug_takeover "Flash update requested but $update missing!"
 	elif test -f $trigger -a ! -s $trigger
 	then
 		echo "Saving selected files from read-write overlay filesystem."
-		/update && rm -f $image*
+		$update --no-restore-files
 		echo "Clearing read-write overlay filesystem."
 		flash_eraseall /dev/$rwfs
 		echo "Restoring saved files to read-write overlay filesystem."
 		touch $trigger
-		/update 
-		rm -rf /save $trigger
+		$update --no-save-files --clean-saved-files
 	else
-		/update && rm -f $image*
+		$update --clean-saved-files
 	fi
 
 	rwfst=$(probe_fs_type $rwdev)
 	fsck=$fsckbase$rwfst
 fi
 
+if grep -w overlay-filesystem-in-ram $optfile
+then
+	rwfst=none
+fi
+
+copyfiles=
+if grep -w copy-files-to-ram $optfile
+then
+	rwfst=none
+	copyfiles=y
+fi
+
+# It would be nice to do this after fsck but that mean rofs is mounted
+# which triggers the mtd is mounted check
+if test "$rwfst$copyfiles" = noney
+then
+	touch $trigger
+	$update --copy-files --clean-saved-files --no-restore-files
+fi
+
+if grep -w copy-base-filesystem-to-ram $optfile &&
+	test ! -e /run/image-rofs && ! cp $rodev /run/image-rofs
+then
+	# Remove any partial copy to avoid attempted usage later
+	if test -e  /run/image-rofs
+	then
+		ls -l /run/image-rofs
+		rm -f /run/image-rofs
+	fi
+	debug_takeover "Copying $rodev to /run/image-rofs failed."
+fi
+
+if test -s /run/image-rofs
+then
+	rodev=/run/image-rofs
+	roopts=$roopts,loop
+fi
+
 mount $rodev $rodir -t $rofst -o $roopts
 
 if test -x $rodir$fsck
@@ -171,12 +360,16 @@
 	then
 		debug_takeover "fsck of read-write fs on $rwdev failed (rc=$rc)"
 	fi
-elif test $fsck != /sbin/fsck.jffs2
+elif test "$rwfst" != jffs2 -a "$rwfst" != none
 then
 	echo "No '$fsck' in read only fs, skipping fsck."
 fi
 
-if ! mount $rwdev $rwdir -t $rwfst -o $rwopts
+if test "$rwfst" = none
+then
+	echo "Running with read-write overlay in RAM for this boot."
+	echo "No state will be preserved unless flash update performed."
+elif ! mount $rwdev $rwdir -t $rwfst -o $rwopts
 then
 	msg="$(cat)" << HERE
 
diff --git a/meta-phosphor/common/recipes-phosphor/obmc-phosphor-initfs/files/obmc-shutdown.sh b/meta-phosphor/common/recipes-phosphor/obmc-phosphor-initfs/files/obmc-shutdown.sh
index fc359c5..8d5d0c9 100644
--- a/meta-phosphor/common/recipes-phosphor/obmc-phosphor-initfs/files/obmc-shutdown.sh
+++ b/meta-phosphor/common/recipes-phosphor/obmc-phosphor-initfs/files/obmc-shutdown.sh
@@ -30,30 +30,37 @@
 done
 set +x
 
+update=/run/initramfs/update
 image=/run/initramfs/image-
+
 if test -s /run/fw_env -a -c /run/mtd:u-boot-env -a ! -e ${image}u-boot-env &&
 	! cmp /run/mtd:u-boot-env /run/fw_env
 then
 	ln -sn /run/fw_env ${image}u-boot-env
 fi
 
-if test -x /update && ls $image* > /dev/null 2>&1
+if ls $image* > /dev/null 2>&1
 then
-	/update ${1+"$@"}
+	if test -x $update
+	then
+		$update --clean-saved-files
+	else
+		echo 1>&2 "Flash update requested but $update program missing!"
+	fi
 fi
 
 echo Remaining mounts:
 cat /proc/mounts
 
-test "umount_proc" && umount /proc && rmdir /proc
+test "$umount_proc" && umount /proc && rmdir /proc
 
-# ioctl(TIOC_DRAIN) to drain tty messages to console
+# tcsattr(tty, TIOCDRAIN, mode) to drain tty messages to console
 test -t 1 && stty cooked 0<&1
 
 # Execute the command systemd told us to ...
 if test -d /oldroot  && test "$1"
 then
-	if test "$1" == kexec
+	if test "$1" = kexec
 	then
 		$1 -f -e
 	else
diff --git a/meta-phosphor/common/recipes-phosphor/obmc-phosphor-initfs/files/obmc-update.sh b/meta-phosphor/common/recipes-phosphor/obmc-phosphor-initfs/files/obmc-update.sh
index 367c302..aa8fd89 100755
--- a/meta-phosphor/common/recipes-phosphor/obmc-phosphor-initfs/files/obmc-update.sh
+++ b/meta-phosphor/common/recipes-phosphor/obmc-phosphor-initfs/files/obmc-update.sh
@@ -55,15 +55,57 @@
 rwopts=rw
 rorwopts=ro${rwopts#rw}
 
-rwdir=rw
+rwdir=/run/initramfs/rw
 upper=$rwdir/cow
-save=save/${upper##*/}
+save=/run/save/${upper##*/}
 
-if test -n "$rwfs" && test -s whitelist
+mounted=
+doclean=
+dosave=y
+dorestore=y
+toram=
+
+whitelist=/run/initramfs/whitelist
+image=/run/initramfs/image-
+
+while test "$1" != "${1#-}"
+do
+	case "$1" in
+	--no-clean-saved-files)
+		doclean=
+		shift ;;
+	--clean-saved-files)
+		doclean=y
+		shift ;;
+	--no-save-files)
+		dosave=
+		shift ;;
+	--save-files)
+		dosave=y
+		shift ;;
+	--no-restore-files)
+		dorestore=
+		shift ;;
+	--restore-files)
+		dorestore=y
+		shift ;;
+	--copy-files)
+		toram=y
+		shift ;;
+	*)
+		echo 2>&1 "Unknown option $1"
+		exit 1 ;;
+	esac
+done
+
+if test "x$dosave" = xy
 then
-
-	mkdir -p $rwdir
-	mount $rwdev $rwdir -t $(probe_fs_type $rwdev) -o $rorwopts
+	if test ! -d $upper -a -n "$rwfs"
+	then
+		mkdir -p $rwdir
+		mount $rwdev $rwdir -t $(probe_fs_type $rwdev) -o $rorwopts
+		mounted=$rwdir
+	fi
 
 	while read f
 	do
@@ -74,12 +116,14 @@
 		d="$save/$f"
 		mkdir -p "${d%/*}"
 		cp -rp $upper/$f "${d%/*}/"
-	done < whitelist
+	done < $whitelist
 
-	umount $rwdir
+	if test -n "$mounted"
+	then
+		umount $mounted
+	fi
 fi
 
-image=/run/initramfs/image-
 for f in $image*
 do
 	m=$(findmtd ${f#$image})
@@ -92,17 +136,40 @@
 
 for f in $image*
 do
+	if test ! -s $f
+	then
+		echo "Skipping empty update of ${f#$image}."
+		rm $f
+		continue
+	fi
 	m=$(findmtd ${f#$image})
 	echo "Updating ${f#$image}..."
-	# flasheraseall /dev/$m && dd if=$f of=/dev/$m
-	flashcp -v $f /dev/$m
+	flashcp -v $f /dev/$m && rm $f
 done
 
-if test -d $save
+if test "x$toram" = xy
 then
+	mkdir -p $upper
+	cp -rp $save/. $upper/
+fi
+
+if test -d $save -a "x$dorestore" = xy
+then
+	odir=$rwdir
+	rwdir=/run/rw
+	upper=$rwdir${upper#$odir}
+
+	mkdir -p $rwdir
 	mount $rwdev $rwdir -t $(probe_fs_type $rwdev) -o $rwopts
+	mkdir -p $upper
 	cp -rp $save/. $upper/
 	umount $rwdir
+	rmdir $rwdir
+fi
+
+if test "x$doclean" = xy
+then
+	rm -rf $save
 fi
 
 exit
diff --git a/meta-phosphor/common/recipes-phosphor/obmc-phosphor-initfs/obmc-phosphor-init.bb b/meta-phosphor/common/recipes-phosphor/obmc-phosphor-initfs/obmc-phosphor-init.bb
index 68ee00d..3fa88c9 100644
--- a/meta-phosphor/common/recipes-phosphor/obmc-phosphor-initfs/obmc-phosphor-init.bb
+++ b/meta-phosphor/common/recipes-phosphor/obmc-phosphor-initfs/obmc-phosphor-init.bb
@@ -12,6 +12,13 @@
 SRC_URI += "file://whitelist"
 
 do_install() {
+	for f in init-download-url init-options
+	do
+		if test -e $f
+		then
+			install -m 0755 ${WORKDIR}/$f ${D}/$f
+		fi
+	done
         install -m 0755 ${WORKDIR}/obmc-init.sh ${D}/init
         install -m 0755 ${WORKDIR}/obmc-shutdown.sh ${D}/shutdown
         install -m 0755 ${WORKDIR}/obmc-update.sh ${D}/update
@@ -21,3 +28,4 @@
 }
 
 FILES_${PN} += " /init /shutdown /update /whitelist /dev "
+FILES_${PN} += " /init-options /init-download-url "
diff --git a/meta-phosphor/common/recipes-phosphor/obmc-phosphor-user/obmc-phosphor-user.bb b/meta-phosphor/common/recipes-phosphor/obmc-phosphor-user/obmc-phosphor-user.bb
index d1e7637..b0328cd 100644
--- a/meta-phosphor/common/recipes-phosphor/obmc-phosphor-user/obmc-phosphor-user.bb
+++ b/meta-phosphor/common/recipes-phosphor/obmc-phosphor-user/obmc-phosphor-user.bb
@@ -11,7 +11,7 @@
 
 SRC_URI += "git://github.com/openbmc/phosphor-networkd"
 
-SRCREV = "cb3613575fd6fb18a7d2f7e7d86e7b6fd75f4269"
+SRCREV = "448e8d839d37532d2667b9a38bb3aadb6c804e2e"
 
 S = "${WORKDIR}/git"
 INSTALL_NAME = "userman.py"
diff --git a/meta-phosphor/common/recipes-phosphor/skeleton/skeleton.bb b/meta-phosphor/common/recipes-phosphor/skeleton/skeleton.bb
index ba873aa..08e4d33 100644
--- a/meta-phosphor/common/recipes-phosphor/skeleton/skeleton.bb
+++ b/meta-phosphor/common/recipes-phosphor/skeleton/skeleton.bb
@@ -16,7 +16,7 @@
 RDEPENDS_${PN} += "python-subprocess python-compression libsystemd"
 SRC_URI += "git://github.com/openbmc/skeleton"
 
-SRCREV = "ad8c3d3b7be6cc5cda80a2f215b40eae16381b09"
+SRCREV = "27ca44ad1a96f90d42dcb50183700e5ca5358642"
 
 S = "${WORKDIR}"