All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH openbmc 0/6] Persistent 1
@ 2016-01-20 23:10 OpenBMC Patches
  2016-01-20 23:10 ` [PATCH openbmc 1/6] create obmc-phosphor-initfs OpenBMC Patches
                   ` (6 more replies)
  0 siblings, 7 replies; 16+ messages in thread
From: OpenBMC Patches @ 2016-01-20 23:10 UTC (permalink / raw)
  To: openbmc

Announcing the persistent file system ready for testing


I hereby submit for your consideration the bitbake metadata
to build a persistent, upgradeable file system for openbmc
phosphor stack systems.

The openbmc-phosphor include has been updated to build two
file systems: an initramfs packaged into an initrd for
setting up the root file system, and a read-only squashfs
with xz compression to hold the main data.  The final 4MB
of the 32MB flash is used to hold a read/write overlay over
the squashfs maintaining updates for any files changed
that are not mounted in a tmpfs directory.

Warning: the main file system is using several parts of the
flash.  Updating those partitions while running will likely
crash your system.

The initramfs clones itself for a shutdown and update
located at /run/initramfs/.  The shutdown script is invoked
when a normal (not -f) shutdown, halt, or poweroff command
is run via systemd.  More documentation on that interface is
available at [1].

To schedule an update, simply drop images for the partitions
you want to update into /run/initramfs/image-{mtd-name}, where
{mtd-name} is the label of the mtd partition or whole flash.
This can be obtained from /proc/mtd or via the name attribute 
under the /sys/class/mtd/ directory.  Files listed in the
/run/initramfs/whitelist will be copied from the overlay before
applying images and restored afterwards.  This file is configured
to hold password, group, shadow, systemd networkd settings, and
the dropbear rsa host key file.   You can add additional files
as needed.

[1]http://www.freedesktop.org/wiki/Software/systemd/InitrdInterface/


Tips and Tricks:

To preserve your u-boot environment with your mac address, u-boot
network settings and bootargs overrides execute:

	cp /dev/mtd2 /run/initramfs/image-u-boot-env

To get a shell with the file systems unmounted but available (will
probably change in the future):

	touch /run/initramfs/image-break

from that shell (prompt update-fs# ) you can mount the file systems,
copy additional images, etc.   When done unmount file systems and
either do

	mv /image-break /image-rwfs
	/update reboot

or if you have preserved the rwfs and do not wish to update, simply

	reboot -f

You can download images either while running, or from the reboot/init
environment.  Full busybox with ifconfig, route, wget, and tftp commands
are available.   If your flash is corrupted but you have not overwritten
u-boot (and don't have a crazy 0-timeout boot script), you can recover
by downloading the kernel and initrd and booting into it.  Assuming the
default 43000000 tftp default address, setup the environment as needed:

	setenv ethaddr xx:xx:xx:xx:xx:xx
	setenv ipaddr xxx.xxx.xxx.xxx
	setenv netmask xxx.xxx.xxx.xxx
	setenv gateway xxx.xxx.xxx.xxx
	setenv server xxx.xxx.xxx.xxx
	saveenv

(the above IP addresses can also acquired by DHCP).

	tftp initrd
	tftp 40080000 cuImage
	bootm 40080000 43000000

The above commands could be packaged into a u-boot script that is packaged
with the mkimage command for scripted booting.


Known Limitations, BUGS, and TODOs:

The read/write overlay is ext4 without a journal (too few blocks), but
no fsck repair is available to fix it after a forced reboot.  The 
existing ext4 tools are too big for the space allocated in the fs.
This may be fixable by running them from the ro squashfs, by copying
fsck and libraries to the /run/initramfs shutdown environment, or
by copying a fresh empty overlay to /run/initramfs/image-rwfs.

Erasing the flash, executed as part of the flashcp command, is extremely
slow.  It is calling erase for each 4k sector and printing a message, but
the print does not seem to make a significant difference to the speed.
Expect a full 32MB flash to take approximately 35 minutes, plus 5 min
to reboot with a clean overlay as first-boot items are run.

The first-boot is triggering systemd-update-hwdb.service which is trying
to recreate a 60MB file in our 4MB file system.  It obviously fails, but
it also sometimes times out and causes the ttyS4.device and ttyS0.device
files that are trying to run concurrently to also fail.   This causes the
console getty to not be started.  If this occurs you can login over the
network if you had previously setup systemd (or set ip= in bootargs from
u-boot), otherwise you will need to reboot then address the unclean ext4
fsck issue above.

The u-boot-fw-utils fw_setenv and fw_printenv are not building correctly
and are therefore not in the image.  These will allow us to update
the u-boot environment for such things as Ethernet mac address, net-boot,
and other overrides such as passing kernel command line via bootargs
that could be used to trigger init to update.

Generating the flash needs to be given a layout with images for each type
and their sizes.  This should also create a dtsi with the flash partitions.

Making the overlay should take FSTYPE parameters (actually OVERLAY_BASETYPE)
for the additional options, in addition some user and some system.

The an empty rwfs should be able to be created via mkfs in the initrd
environment.  The fsck should be applied.

Mounting the rwfs and rofs and several other commands should be error trapped.
Today if the rwfs fails to mount the underlying tmpfs of /run will be
the overlay, resulting in writable but ram-backed non-persistent booting.
Providing a image-rwfs will probably copy the whitelisted files to the image
from this error state.

More systemd setup should be in the base layer: systemd tmpfiles service
changes /etc/mtab from /proc/mounts in base-files to /proc/self/mounts, and
there are several service user ids added to the passwd and group databases.

The updated passwd and shadow files should be copied into run/initramfs under
some policy for the sulogin recovery of shutdown.  Some parameter to trigger
admin sulogin should be available (eg the sulogin allowing a touch of /takeover
to takeover pid 1 in the init script).


https://github.com/openbmc/openbmc/pull/140

Milton D. Miller II (6):
  create obmc-phosphor-initfs
  phosphor: modify use obmc-phosphor-initfs
  linux-obmc: apply the aspeed-spi-nor controller patchset
  u-boot : switch to repro, add fw_env.config
  create u-boot-fw-utils for our u-boot version
  phosphor: Create image class image-overlay and move phosphor to use it

 .../recipes-bsp/u-boot/files/fw_env.config         |   4 +-
 .../u-boot/u-boot-fw-utils_2013.07%.bbappend       |  13 +
 .../recipes-bsp/u-boot/u-boot_2013.07%.bbappend    |   7 +-
 ...-Add-SPI-memory-controllers-for-ASPEED-AS.patch | 686 +++++++++++++++++++++
 .../0001-rtc-aspeed-month-is-off-by-one.patch      |  35 ++
 .../recipes-kernel/linux/linux-obmc/defconfig      |   5 +
 .../linux/linux-obmc/spinor-dts.patch              | 147 +++++
 .../recipes-kernel/linux/linux-obmc_%.bbappend     |   5 +-
 meta-phosphor/classes/image-overlay.bbclass        |  18 +
 .../obmc-phosphor-image_types_uboot.bbclass        |  55 +-
 meta-phosphor/classes/obmc-phosphor-initfs.bbclass |   4 +
 .../recipes-bsp/u-boot/u-boot-fw-utils_2013.07.bb  |  52 ++
 .../common/recipes-bsp/u-boot/u-boot_2013.07.bb    |   9 +-
 .../images/core-image-minimal-initramfs.bbappend   |   3 +
 .../obmc-phosphor-initfs/files/obmc-init.sh        |  78 +++
 .../obmc-phosphor-initfs/files/obmc-shutdown.sh    |  55 ++
 .../obmc-phosphor-initfs/files/obmc-update.sh      | 102 +++
 .../obmc-phosphor-initfs/files/whitelist           |   8 +
 .../obmc-phosphor-initfs/obmc-phosphor-init.bb     |  28 +
 .../common/recipes-phosphor/skeleton/skeleton.bb   |   2 +-
 meta-phosphor/conf/distro/openbmc-phosphor.conf    |   1 +
 .../conf/machine/include/obmc-bsp-common.inc       |  10 +-
 22 files changed, 1295 insertions(+), 32 deletions(-)
 create mode 100644 meta-openbmc-bsp/meta-aspeed/meta-ast2400/recipes-bsp/u-boot/u-boot-fw-utils_2013.07%.bbappend
 create mode 100644 meta-openbmc-bsp/meta-aspeed/meta-ast2400/recipes-kernel/linux/linux-obmc/0001-mtd-spi-nor-Add-SPI-memory-controllers-for-ASPEED-AS.patch
 create mode 100644 meta-openbmc-bsp/meta-aspeed/meta-ast2400/recipes-kernel/linux/linux-obmc/0001-rtc-aspeed-month-is-off-by-one.patch
 create mode 100644 meta-openbmc-bsp/meta-aspeed/meta-ast2400/recipes-kernel/linux/linux-obmc/spinor-dts.patch
 create mode 100644 meta-phosphor/classes/image-overlay.bbclass
 create mode 100644 meta-phosphor/classes/obmc-phosphor-initfs.bbclass
 create mode 100644 meta-phosphor/common/recipes-bsp/u-boot/u-boot-fw-utils_2013.07.bb
 create mode 100644 meta-phosphor/common/recipes-core/images/core-image-minimal-initramfs.bbappend
 create mode 100644 meta-phosphor/common/recipes-phosphor/obmc-phosphor-initfs/files/obmc-init.sh
 create mode 100644 meta-phosphor/common/recipes-phosphor/obmc-phosphor-initfs/files/obmc-shutdown.sh
 create mode 100755 meta-phosphor/common/recipes-phosphor/obmc-phosphor-initfs/files/obmc-update.sh
 create mode 100644 meta-phosphor/common/recipes-phosphor/obmc-phosphor-initfs/files/whitelist
 create mode 100644 meta-phosphor/common/recipes-phosphor/obmc-phosphor-initfs/obmc-phosphor-init.bb

-- 
2.6.4

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [PATCH openbmc 1/6] create obmc-phosphor-initfs
  2016-01-20 23:10 [PATCH openbmc 0/6] Persistent 1 OpenBMC Patches
@ 2016-01-20 23:10 ` OpenBMC Patches
  2016-01-21  6:10   ` Jeremy Kerr
  2016-01-20 23:10 ` [PATCH openbmc 2/6] phosphor: modify use obmc-phosphor-initfs OpenBMC Patches
                   ` (5 subsequent siblings)
  6 siblings, 1 reply; 16+ messages in thread
From: OpenBMC Patches @ 2016-01-20 23:10 UTC (permalink / raw)
  To: openbmc; +Cc: Milton D. Miller II

From: "Milton D. Miller II" <miltonm@us.ibm.com>

This recipe holds the key scripts for an initramfs image.  Written in
sh to run with busybox, these three scripts handle mounting, unmounting,
and updating a set of mtd partitions to form a read/write overlay on a
read/only compressed base.

The init script will mount the base sysfs, proc, and devtmpfs as well
as run.  It copies itself to run/initramfs to create the shutdown and
update environment.   The shutdown script will unmount the remaining
nodev and root filesystems from oldroot where systemd-shutdown pivots
the old file system, then looks for image- files an if found invokes
upate otherwise it performs the final reboot, powerdown, or kexec, or
halt.  The update script will attempt to mount the read/write overlay
and preserve selected files and directories based on a whitelist.
It then unmounts and writes all image files to their named mtd partition
using flashcp, mounts and restores the saved files, and finally
unmounts the fs and performs the final reboot or halt etc.
---
 meta-phosphor/classes/obmc-phosphor-initfs.bbclass |   4 +
 .../obmc-phosphor-initfs/files/obmc-init.sh        |  78 ++++++++++++++++
 .../obmc-phosphor-initfs/files/obmc-shutdown.sh    |  55 +++++++++++
 .../obmc-phosphor-initfs/files/obmc-update.sh      | 102 +++++++++++++++++++++
 .../obmc-phosphor-initfs/files/whitelist           |   8 ++
 .../obmc-phosphor-initfs/obmc-phosphor-init.bb     |  28 ++++++
 .../common/recipes-phosphor/skeleton/skeleton.bb   |   2 +-
 7 files changed, 276 insertions(+), 1 deletion(-)
 create mode 100644 meta-phosphor/classes/obmc-phosphor-initfs.bbclass
 create mode 100644 meta-phosphor/common/recipes-phosphor/obmc-phosphor-initfs/files/obmc-init.sh
 create mode 100644 meta-phosphor/common/recipes-phosphor/obmc-phosphor-initfs/files/obmc-shutdown.sh
 create mode 100755 meta-phosphor/common/recipes-phosphor/obmc-phosphor-initfs/files/obmc-update.sh
 create mode 100644 meta-phosphor/common/recipes-phosphor/obmc-phosphor-initfs/files/whitelist
 create mode 100644 meta-phosphor/common/recipes-phosphor/obmc-phosphor-initfs/obmc-phosphor-init.bb

diff --git a/meta-phosphor/classes/obmc-phosphor-initfs.bbclass b/meta-phosphor/classes/obmc-phosphor-initfs.bbclass
new file mode 100644
index 0000000..de7923e
--- /dev/null
+++ b/meta-phosphor/classes/obmc-phosphor-initfs.bbclass
@@ -0,0 +1,4 @@
+# Common code for recipes that implement Phosphor OpenBMC filesystem
+
+RPROVIDES_${PN} += "obmc-phosphor-initfs"
+PROVIDES += "obmc-phosphor-initfs"
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
new file mode 100644
index 0000000..08b62e8
--- /dev/null
+++ b/meta-phosphor/common/recipes-phosphor/obmc-phosphor-initfs/files/obmc-init.sh
@@ -0,0 +1,78 @@
+#!/bin/sh
+
+rodir=run/initramfs/ro 
+rwdir=run/initramfs/rw
+upper=$rwdir/cow
+work=$rwdir/work
+
+cd /
+mkdir -p sys proc dev run
+mount dev dev -tdevtmpfs
+mount sys sys -tsysfs
+mount proc proc -tproc
+if ! grep run proc/mounts
+then
+	mount tmpfs run -t tmpfs -o mode=755,nodev
+fi
+
+mkdir -p $rodir $rwdir
+
+cp -rp init shutdown update whitelist bin sbin usr lib etc var run/initramfs
+
+# To start a interactive shell with job control at this point, run
+# getty 38400 ttyS4
+
+findmtd() {
+	m=$(grep -xl "$1" /sys/class/mtd/*/name)
+	m=${m%/name}
+	m=${m##*/}
+	echo $m
+}
+
+rofs=$(findmtd rofs)
+rwfs=$(findmtd rwfs)
+
+rofst=squashfs
+rwfst=ext4
+
+echo rofs = $rofs $rofst   rwfs = $rwfs $rwfst
+
+if grep -w debug-init-sh /proc/cmdline ||
+	! mount -o rw /dev/mtdblock${rwfs#mtd} $rwdir -t $rwfst
+then
+	echo Please mount the rw file system on $rwdir from this shell
+	while ! sulogin && ! test -f /takeover
+	do
+		echo getty failed, retrying
+	done
+fi
+
+# Touch /takeover in the above getty to become pid 1
+if test -e /takeover
+then
+	export PS1=init#\ 
+	exec /bin/sh
+fi
+
+mount -o ro /dev/mtdblock${rofs#mtd} $rodir -t $rofst
+
+rm -rf $work
+mkdir -p $upper
+mkdir -p $work
+
+mount -t overlay -o lowerdir=$rodir,upperdir=$upper,workdir=$work cow /root
+
+if ! chroot /root /bin/sh -c exit
+then
+	echo 'chroot test failed; invoking emergency shell.'
+	PS1=rescue#\  sulogin
+fi
+
+for f in sys dev proc run
+do
+	mount --move $f root/$f
+done
+
+# switch_root /root /sbin/init
+exec chroot /root /sbin/init
+
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
new file mode 100644
index 0000000..85fd1e9
--- /dev/null
+++ b/meta-phosphor/common/recipes-phosphor/obmc-phosphor-initfs/files/obmc-shutdown.sh
@@ -0,0 +1,55 @@
+#!/bin/sh
+
+echo shutdown: "$@"
+
+export PS1=shutdown-sh#\ 
+# exec bin/sh
+
+if [ ! -e /proc/mounts ]
+then
+	mkdir -p /proc
+	mount  proc proc -tproc
+	umount_proc=1
+else
+	umount_proc=
+fi
+
+# remove an empty oldroot, that means we are not invoked from systemd-shutdown
+rmdir /oldroot 2>/dev/null
+
+set -x
+for f in $( awk '/oldroot/ { print $2 }' < /proc/mounts | sort -r )
+do
+	umount $f
+done
+set +x
+
+
+if test -x /update && ls image-* > /dev/null 2>&1
+then
+	exec /update ${1+"$@"}
+fi
+
+echo Remaining mounts:
+cat /proc/mounts
+
+test "umount_proc" && umount /proc && rmdir /proc
+
+
+
+# Execute the command systemd told us to ...
+if test -d /oldroot  && test "$1"
+then
+	if test "$1" -eq kexec
+	then
+		$1 -f -e
+	else
+		$1 -f
+	fi
+fi
+
+
+echo "Execute ${1-reboot} -f if all unounted ok, or exec /init"
+
+export PS1=shutdown-sh#\ 
+exec /bin/sh
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
new file mode 100755
index 0000000..9606459
--- /dev/null
+++ b/meta-phosphor/common/recipes-phosphor/obmc-phosphor-initfs/files/obmc-update.sh
@@ -0,0 +1,102 @@
+#!/bin/sh
+
+echo update: "$@"
+
+export PS1=update-sh#\ 
+# exec /bin/sh
+
+cd /
+if ! test -r /proc/mounts || ! test -f /proc/mounts
+then
+	mkdir -p /proc
+	mount -t proc proc proc
+fi
+if ! test -d /sys/class
+then
+	mkdir -p /sys
+	mount -t sysfs sys sys
+fi
+if ! test -c /dev/null
+then
+	mkdir -p /dev
+	mount -t devtmpfs dev dev
+fi
+while grep mtd /proc/mounts
+do
+	echo 1>&2 "Error: A mtd device is mounted."
+	sulogin
+	# exec /bin/sh
+done
+
+findmtd() {
+	m=$(grep -xl "$1" /sys/class/mtd/*/name)
+	m=${m%/name}
+	m=${m##*/}
+	echo $m
+}
+
+rofs=$(findmtd rofs)
+rwfs=$(findmtd rwfs)
+
+rofst=squahsfs
+rwfst=ext4
+
+if test -n "$rwfs" && test -s whitelist
+then
+
+	mkdir -p rw
+	mount /dev/mtdblock${rwfs#mtd} rw -oro -t $rwfst
+
+	while read f
+	do
+		if ! test -e rw/cow/$f
+		then
+			continue
+		fi
+		d="save/cow/$f"
+		mkdir -p "${d%/*}"
+		cp -rp rw/cow/$f "${d%/*}/"
+	done < whitelist
+
+	umount rw
+fi
+
+
+for f in image-*
+do
+	m=$(findmtd ${f#image-})
+	if test -z "$m" 
+	then
+		echo 1>&2  "Unable to find mtd partiton for $f"
+		exec /bin/sh
+	fi
+
+	echo "Updating ${f#image-}"
+	# flasheraseall /dev/$m && dd if=$f of=/dev/$m
+	flashcp -v $f /dev/$m
+done
+
+
+if test -d save/cow
+then
+	mount /dev/mtdblock${rwfs#mtd} rw -o rw -t $rwfst
+	cp -rp save/cow/. rw/cow/
+	umount rw
+fi
+
+# Execute the command systemd told us to ...
+if test -d /oldroot && test -x "/sbin/$1" && test -f "/sbin/$1"
+then
+	if test "$1" -eq kexec
+	then
+		/sbin/$1 -f -e
+	else
+		/sbin/$1 -f
+	fi
+fi
+
+
+echo "Execute ${1-reboot} -f if all is ok"
+
+export PS1=update-sh#\ 
+exec /bin/sh
diff --git a/meta-phosphor/common/recipes-phosphor/obmc-phosphor-initfs/files/whitelist b/meta-phosphor/common/recipes-phosphor/obmc-phosphor-initfs/files/whitelist
new file mode 100644
index 0000000..80f9c81
--- /dev/null
+++ b/meta-phosphor/common/recipes-phosphor/obmc-phosphor-initfs/files/whitelist
@@ -0,0 +1,8 @@
+/etc/dropbear/dropbear_rsa_host_key
+/etc/systemd/network
+/etc/resolv.conf
+/etc/machine-id
+/etc/passwd
+/etc/group
+/etc/shadow
+/etc/gshadow
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
new file mode 100644
index 0000000..81ab8f0
--- /dev/null
+++ b/meta-phosphor/common/recipes-phosphor/obmc-phosphor-initfs/obmc-phosphor-init.bb
@@ -0,0 +1,28 @@
+SUMMARY = "Phosphor OpenBMC pre-init scripts"
+DESCRIPTION = "Phosphor OpenBMC filesytem mount reference implementation."
+PR = "r1"
+
+inherit obmc-phosphor-license
+inherit obmc-phosphor-initfs
+
+S = "${WORKDIR}"
+SRC_URI += "file://obmc-init.sh"
+SRC_URI += "file://obmc-shutdown.sh"
+SRC_URI += "file://obmc-update.sh"
+SRC_URI += "file://whitelist"
+
+do_install() {
+	if ${OVERLAY_BASETYPE} != ext4 -o ${IMAGE_BASETYPE} != squashfs-xz
+	then
+		bbfatal only ext4 overlayed  squashfs-xz is currently supported
+	fi
+
+        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
+        install -m 0644 ${WORKDIR}/whitelist ${D}/whitelist
+        install -d ${D}/dev
+        mknod -m 622 ${D}/dev/console c 5 1
+}
+
+FILES_${PN} += " /init /shutdown /update /whitelist /dev "
diff --git a/meta-phosphor/common/recipes-phosphor/skeleton/skeleton.bb b/meta-phosphor/common/recipes-phosphor/skeleton/skeleton.bb
index 0e596d7..ab753b1 100644
--- a/meta-phosphor/common/recipes-phosphor/skeleton/skeleton.bb
+++ b/meta-phosphor/common/recipes-phosphor/skeleton/skeleton.bb
@@ -16,7 +16,7 @@ DEPENDS += "glib-2.0"
 RDEPENDS_${PN} += "python-subprocess python-tftpy"
 SRC_URI += "git://github.com/openbmc/skeleton"
 
-SRCREV = "5968064479270edf233739d97dc6e37f04069d38"
+SRCREV = "51fb4a1840058a70387b39210cb4663577941c17"
 
 S = "${WORKDIR}"
 
-- 
2.6.4

^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH openbmc 2/6] phosphor: modify use obmc-phosphor-initfs
  2016-01-20 23:10 [PATCH openbmc 0/6] Persistent 1 OpenBMC Patches
  2016-01-20 23:10 ` [PATCH openbmc 1/6] create obmc-phosphor-initfs OpenBMC Patches
@ 2016-01-20 23:10 ` OpenBMC Patches
  2016-01-20 23:10 ` [PATCH openbmc 3/6] linux-obmc: apply the aspeed-spi-nor controller patchset OpenBMC Patches
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 16+ messages in thread
From: OpenBMC Patches @ 2016-01-20 23:10 UTC (permalink / raw)
  To: openbmc; +Cc: Milton D. Miller II

From: "Milton D. Miller II" <miltonm@us.ibm.com>

This bbappend changes core-image-minimal-initramfs to use the
obmc-phosphor-initfs scripts instead of the x86 syslinux centric live
scripts.

Perhaps they and this could be a virtural/initscript provider or similar?

Signed-off-by: Milton Miller <miltonm@us.ibm.com>
---
 .../common/recipes-core/images/core-image-minimal-initramfs.bbappend   | 3 +++
 1 file changed, 3 insertions(+)
 create mode 100644 meta-phosphor/common/recipes-core/images/core-image-minimal-initramfs.bbappend

diff --git a/meta-phosphor/common/recipes-core/images/core-image-minimal-initramfs.bbappend b/meta-phosphor/common/recipes-core/images/core-image-minimal-initramfs.bbappend
new file mode 100644
index 0000000..90a1c3f
--- /dev/null
+++ b/meta-phosphor/common/recipes-core/images/core-image-minimal-initramfs.bbappend
@@ -0,0 +1,3 @@
+PACKAGE_INSTALL_remove = "initramfs-live-boot initramfs-live-install initramfs-live-install-efi"
+PACKAGE_INSTALL += "obmc-phosphor-initfs"
+INITRAMFS_FSTYPES = "cpio.${INITRAMFS_CTYPE}"
-- 
2.6.4

^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH openbmc 3/6] linux-obmc: apply the aspeed-spi-nor controller patchset
  2016-01-20 23:10 [PATCH openbmc 0/6] Persistent 1 OpenBMC Patches
  2016-01-20 23:10 ` [PATCH openbmc 1/6] create obmc-phosphor-initfs OpenBMC Patches
  2016-01-20 23:10 ` [PATCH openbmc 2/6] phosphor: modify use obmc-phosphor-initfs OpenBMC Patches
@ 2016-01-20 23:10 ` OpenBMC Patches
  2016-01-21  5:40   ` Jeremy Kerr
  2016-01-21 16:06   ` Milton Miller II
  2016-01-20 23:10 ` [PATCH openbmc 4/6] u-boot : switch to repro, add fw_env.config OpenBMC Patches
                   ` (3 subsequent siblings)
  6 siblings, 2 replies; 16+ messages in thread
From: OpenBMC Patches @ 2016-01-20 23:10 UTC (permalink / raw)
  To: openbmc; +Cc: Milton D. Miller II

From: "Milton D. Miller II" <miltonm@us.ibm.com>

Thie applies the apseed-spi-nor driver and patches the dts for
palmetto and barreleye when building the linux image.  It also
enables the config options for the driver and some file systems to
support the overlay filesystem stack used by obmc-phosphor-initfs.

It also applies the rtc month fix patch.
---
 ...-Add-SPI-memory-controllers-for-ASPEED-AS.patch | 686 +++++++++++++++++++++
 .../0001-rtc-aspeed-month-is-off-by-one.patch      |  35 ++
 .../recipes-kernel/linux/linux-obmc/defconfig      |   5 +
 .../linux/linux-obmc/spinor-dts.patch              | 147 +++++
 .../recipes-kernel/linux/linux-obmc_%.bbappend     |   5 +-
 5 files changed, 877 insertions(+), 1 deletion(-)
 create mode 100644 meta-openbmc-bsp/meta-aspeed/meta-ast2400/recipes-kernel/linux/linux-obmc/0001-mtd-spi-nor-Add-SPI-memory-controllers-for-ASPEED-AS.patch
 create mode 100644 meta-openbmc-bsp/meta-aspeed/meta-ast2400/recipes-kernel/linux/linux-obmc/0001-rtc-aspeed-month-is-off-by-one.patch
 create mode 100644 meta-openbmc-bsp/meta-aspeed/meta-ast2400/recipes-kernel/linux/linux-obmc/spinor-dts.patch

diff --git a/meta-openbmc-bsp/meta-aspeed/meta-ast2400/recipes-kernel/linux/linux-obmc/0001-mtd-spi-nor-Add-SPI-memory-controllers-for-ASPEED-AS.patch b/meta-openbmc-bsp/meta-aspeed/meta-ast2400/recipes-kernel/linux/linux-obmc/0001-mtd-spi-nor-Add-SPI-memory-controllers-for-ASPEED-AS.patch
new file mode 100644
index 0000000..b9a0d0a
--- /dev/null
+++ b/meta-openbmc-bsp/meta-aspeed/meta-ast2400/recipes-kernel/linux/linux-obmc/0001-mtd-spi-nor-Add-SPI-memory-controllers-for-ASPEED-AS.patch
@@ -0,0 +1,686 @@
+From d10437c5fd4ce86722863e8408491355529a0b69 Mon Sep 17 00:00:00 2001
+From: "Milton D. Miller II" <miltonm@us.ibm.com>
+Date: Wed, 9 Dec 2015 16:47:10 -0600
+Subject: [PATCH 1/1] mtd/spi-nor: Add SPI memory controllers for ASPEED
+ AST2400
+
+This driver adds mtd support for spi-nor attached to either or both of
+the Static Memory Controller (new registers) or the SPI Memory Controller.
+
+The static memory controller is the boot soruce for the SOC.  The
+controller supports upto 5 chip selects in any combination of NAND,
+NOR, and SPI.  The memory controller registers were updated in the
+AST2300 and this fmc binding is for the registers in the new mode.
+This driver currently supports only SPI-NOR attached memory, but has
+some consierations to support the others later (including choice of the
+Kconfig symbol).
+
+There is also a similar register set to suport the Static Memory
+Controller in a legacy address mode.   That mode is not currently
+supported because it is expected that the system will run with the
+fmc binding supporting multiple chip selects.
+
+The normal aplication of the SPI memory controller is designated for
+use by the host system either for video bios or system bios and can be
+accessed over either an LPC bus and/or a PCIe bus.  The SOC can also
+access this chip for firmware updates.
+
+This driver has only been tested with the ast2400 SOC.
+
+Signed-off-by: Milton Miller <miltonm@us.ibm.com>
+---
+ .../devicetree/bindings/mtd/aspeed-smc.txt         |  68 +++
+ drivers/mtd/spi-nor/Kconfig                        |   7 +
+ drivers/mtd/spi-nor/Makefile                       |   1 +
+ drivers/mtd/spi-nor/aspeed-smc.c                   | 539 +++++++++++++++++++++
+ 4 files changed, 615 insertions(+)
+ create mode 100644 Documentation/devicetree/bindings/mtd/aspeed-smc.txt
+ create mode 100644 drivers/mtd/spi-nor/aspeed-smc.c
+
+diff --git a/Documentation/devicetree/bindings/mtd/aspeed-smc.txt b/Documentation/devicetree/bindings/mtd/aspeed-smc.txt
+new file mode 100644
+index 0000000..087f9bf
+--- /dev/null
++++ b/Documentation/devicetree/bindings/mtd/aspeed-smc.txt
+@@ -0,0 +1,68 @@
++* Aspeed Static Memory controller in SPI mode
++* Aspeed SPI Flash Controller
++
++Required properties:
++  - compatible : Should be "aspeed,fmc" for Static Memory Controller (AST2400, AST2300?), or
++		 "aspeed,smc" for the SPI flash controller
++  - reg : the first contains the register location and length,
++          the second through nth contains the memory mapping address and length
++	  for the access window for each chips select
++  - interrupts : Should contain the interrupt for the dma device if fmc
++  - clocks : The APB clock input to the controller
++  - #address-cells : must be 1 corresponding to chip select child binding
++  - #size-cells : must be 0 corresponding to chip select child binding
++
++
++Child node required properties:
++  - reg : must contain chip select number in first cell of address, must
++	  be 1 tuple long
++  - compatible : may contain "vendor,part", must include "jedec,spi-nor"
++		(see spi-nor.txt binding).
++
++Child node optional properties:
++  - spi-max-frequency - (optional) max frequency of spi bus (XXX max if missing)
++  - spi-cpol        - (optional) Empty property indicating device requires
++    	 		inverse clock polarity (CPOL) mode (boolean)
++  - spi-cpha        - (optional) Empty property indicating device requires
++    			shifted clock phase (CPHA) mode (boolean)
++  - spi-tx-bus-width - (optional) The bus width(number of data wires) that
++                        used for MOSI. Defaults to 1 if not present.
++  - spi-rx-bus-width - (optional) The bus width(number of data wires) that
++                        used for MOSI. Defaults to 1 if not present.
++
++Child node optional properties:
++ - see mtd/partiton.txt for partitioning bindings and mtd naming
++
++
++Example:
++
++fmc: fmc@1e620000 {
++	compatible = "aspeed,fmc";
++	reg = < 0x1e620000 0x94
++		0x20000000 0x02000000
++		0x22000000 0x02000000 >;
++	#address-cells = <1>;
++	#size-cells = <0>;
++	bmc@0 {
++		reg = < 0 >;
++		compatible = "jedec,spi-nor" ;
++		label = "bmc0";
++		/* spi-max-frequency = <>; */
++		/* m25p,fast-read; */
++		#address-cells = <1>;
++		#size-cells = <1>;
++			bootloader {
++				label = "boot";
++				reg = < 0 0x8000 >
++			}
++	};
++	alt@1 {
++		reg = < 1 >;
++		compatible = "jedec,spi-nor" ;
++		label = "bmc1";
++		/* spi-max-frequency = <>; */
++		status = "fail";
++		/* m25p,fast-read; */
++	};
++};
++
+diff --git a/drivers/mtd/spi-nor/Kconfig b/drivers/mtd/spi-nor/Kconfig
+index 89bf4c1..5f623f9 100644
+--- a/drivers/mtd/spi-nor/Kconfig
++++ b/drivers/mtd/spi-nor/Kconfig
+@@ -40,4 +40,11 @@ config SPI_NXP_SPIFI
+ 	  Flash. Enable this option if you have a device with a SPIFI
+ 	  controller and want to access the Flash as a mtd device.
+ 
++config ASPEED_FLASH_SPI
++	tristate "Aspeed flash controllers in SPI mode"
++	help
++	  This enables support for the New Static Memory Controller (FMC)
++	  in the AST2400 when attached to SPI nor chips, and support for
++	  the SPI Memory controller (SPI) for the BIOS.
++
+ endif # MTD_SPI_NOR
+diff --git a/drivers/mtd/spi-nor/Makefile b/drivers/mtd/spi-nor/Makefile
+index e53333e..ec28610 100644
+--- a/drivers/mtd/spi-nor/Makefile
++++ b/drivers/mtd/spi-nor/Makefile
+@@ -1,3 +1,4 @@
+ obj-$(CONFIG_MTD_SPI_NOR)	+= spi-nor.o
+ obj-$(CONFIG_SPI_FSL_QUADSPI)	+= fsl-quadspi.o
++obj-$(CONFIG_ASPEED_FLASH_SPI)	+= aspeed-smc.o
+ obj-$(CONFIG_SPI_NXP_SPIFI)	+= nxp-spifi.o
+diff --git a/drivers/mtd/spi-nor/aspeed-smc.c b/drivers/mtd/spi-nor/aspeed-smc.c
+new file mode 100644
+index 0000000..2497648
+--- /dev/null
++++ b/drivers/mtd/spi-nor/aspeed-smc.c
+@@ -0,0 +1,539 @@
++/* ASPEED Static Memory Controller driver
++ * Copyright 2015
++ * Milton Miller
++ *
++ */
++#define DEBUG
++
++#include <linux/device.h>
++#include <linux/io.h>
++#include <linux/module.h>
++#include <linux/mutex.h>
++#include <linux/mtd/mtd.h>
++#include <linux/mtd/partitions.h>
++#include <linux/mtd/spi-nor.h>
++#include <linux/of.h>
++#include <linux/of_platform.h>
++#include <linux/sysfs.h>
++
++enum smc_controller_type {
++	smc_type_leg,		/* legacy register mode and map */
++	smc_type_fmc,		/* new FMC 5 CEs multiple flash types */
++	smc_type_smc,		/* SPI memory controller for BIOS / host */
++};
++
++enum smc_flash_type {
++	smc_type_nor = 0,	/* controller connected to nor flash */
++	smc_type_nand = 1,	/* controller connected to nand flash */
++	smc_type_spi = 2,	/* controller connected to spi flash */
++};
++
++struct aspeed_smc_info {
++	unsigned long nce : 3;		/* number of chip enables */
++	unsigned long hasdma : 1;	/* has dma engine */
++	unsigned long maxwidth : 3;	/* max width of spi bus */
++	unsigned long we0 : 5;		/* we shift for ce 0 in cfg reg */
++	unsigned long hastype : 1;	/* type shift for ce 0 in cfg reg */
++	u8 ctl0;			/* offset in regs of ctl for ce 0 */
++	u8 cfg;				/* offset in regs of cfg */
++	u8 time;			/* offset in regs of timing */
++};
++
++#define E(_ce, _dma, _w, _ctl, _cfg, _we0, _hastype, _time, _misc) \
++	.nce = _ce, .ctl0 = _ctl, .cfg = 0, .we0 = _we0, .hastype = _hastype, \
++	.hasdma = _dma, .maxwidth = _w, .time = _time
++
++struct aspeed_smc_info aspeed_table[] = {
++	[smc_type_fmc] = { E(5, 1, 4, 0x10, 0x00, 16, 1, 0x54, 0x50) },
++	[smc_type_smc] = { E(1, 0, 2, 0x04, 0x00, 0,  0, 0x14, 0x10) },
++};
++
++#undef E
++
++enum smc_ctl_reg {
++	smc_base,		/* base value without mode for other commands */
++	smc_read,		/* command reg for (maybe fast) reads */
++	smc_write,		/* command reg for writes with timings */
++	smc_num_ctl_reg		/* last value to get count of commands */
++};
++
++struct aspeed_smc_controller;
++
++struct aspeed_smc_chip {
++	struct aspeed_smc_controller *controller;
++	__le32 __iomem *ctl;			/* control register */
++	void __iomem *base;			/* base of chip window */
++	__le32 ctl_val[smc_num_ctl_reg];	/* controls with timing */
++	struct mtd_info mtd;
++	struct spi_nor nor;
++};
++
++struct aspeed_smc_controller {
++	struct mutex mutex;			/* controller access mutex */
++	const struct aspeed_smc_info *info;	/* type info of controller */
++	void __iomem *regs;			/* controller registers */
++	struct aspeed_smc_chip *chips[0];	/* attached chips */
++};
++
++#define CONTROL_SPI_AAF_MODE BIT(31)
++#define CONTROL_SPI_IO_MODE_MASK GENMAASK(30, 28)
++#define CONTROL_SPI_IO_DUAL_DATA BIT(29)
++#define CONTROL_SPI_IO_DUAL_ADDR_DATA (BIT(29) | BIT(28))
++#define CONTROL_SPI_IO_QUAD_DATA BIT(30)
++#define CONTROL_SPI_IO_QUAD_ADDR_DATA (BIT(30) | BIT(28))
++#define CONTROL_SPI_CE_INACTIVE_SHIFT 24
++#define CONTROL_SPI_CE_INACTIVE_MASK GENMASK(27, CONTROL_SPI_CE_INACTIVE_SHIFT)
++/* 0 = 16T ... 15 = 1T   T=HCLK */
++#define CONTROL_SPI_COMMAND_SHIFT 16
++#define CONTROL_SPI_DUMMY_CYCLE_COMMAND_OUTPUT BIT(15)
++#define CONTROL_SPI_IO_DUMMY_CYCLES_HI BIT(14)
++#define CONTROL_SPI_IO_DUMMY_CYCLES_HI_SHIFT (14 - 2)
++#define CONTROL_SPI_IO_ADDRESS_4B BIT(13) /* FMC, LEGACY */
++#define CONTROL_SPI_CLK_DIV4 BIT(13) /* BIOS */
++#define CONTROL_SPI_RW_MERGE BIT(12)
++#define CONTROL_SPI_IO_DUMMY_CYCLES_LO_SHIFT 6
++#define CONTROL_SPI_IO_DUMMY_CYCLES_LO GENMASK(7, CONTROL_SPI_IO_DUMMY_CYCLES_LO_SHIFT)
++#define CONTROL_SPI_IO_DUMMY_CYCLES_MASK (CONTROL_SPI_IO_DUMMY_CYCLES_HI | \
++					  CONTROL_SPI_IO_DUMMY_CYCLES_LO)
++#define CONTROL_SPI_CLOCK_FREQ_SEL_SHIFT 8
++#define CONTROL_SPI_CLOCK_FREQ_SEL_MASK GENMASK(11, CONTROL_SPI_CLOCK_FREQ_SEL_SHIFT)
++#define CONTROL_SPI_LSB_FIRST BIT(5)
++#define CONTROL_SPI_CLOCK_MODE_3 BIT(4)
++#define CONTROL_SPI_IN_DUAL_DATA BIT(3)
++#define CONTROL_SPI_CE_STOP_ACTIVE_CONTROL BIT(2)
++#define CONTROL_SPI_COMMAND_MODE_MASK GENMASK(1, 0)
++#define CONTROL_SPI_COMMAND_MODE_NORMAL (0)
++#define CONTROL_SPI_COMMAND_MODE_FREAD (1)
++#define CONTROL_SPI_COMMAND_MODE_WRITE (2)
++#define CONTROL_SPI_COMMAND_MODE_USER (3)
++
++#define CONTROL_SPI_KEEP_MASK (CONTROL_SPI_AAF_MODE | \
++	CONTROL_SPI_CE_INACTIVE_MASK | CONTROL_SPI_IO_ADDRESS_4B | \
++	CONTROL_SPI_IO_DUMMY_CYCLES_MASK | CONTROL_SPI_CLOCK_FREQ_SEL_MASK | \
++	CONTROL_SPI_LSB_FIRST | CONTROL_SPI_CLOCK_MODE_3)
++
++#define CONTROL_SPI_CLK_DIV4 BIT(13) /* BIOS */
++
++static u32 spi_control_fill_opcode(u8 opcode)
++{
++	return ((u32)(opcode)) << CONTROL_SPI_COMMAND_SHIFT;
++}
++
++#if 0 /* ATTR */
++static u32 spi_control_to_freq_div(u32 control)
++{
++	u32 sel;
++
++	sel = control & CONTROL_SPI_CLOCK_FREQ_SEL_MASK;
++	sel >>= CONTROL_SPI_CLOCK_FREQ_SEL_SHIFT;
++
++	/* 16, 14, 12, 10, 8, 6, 4, 2, 15, 13, 11, 9, 7, 5, 3, 1 */
++	return 16 - (((sel & 7) << 1) + ((sel & 8) >> 1));
++}
++
++static u32 spi_control_to_dummy_bytes(u32 control)
++{
++
++	return ((control & CONTROL_SPI_IO_DUMMY_CYCLES_LO) >>
++			CONTROL_SPI_IO_DUMMY_CYCLES_LO_SHIFT) |
++		((control & CONTROL_SPI_IO_DUMMY_CYCLES_HI_SHIFT) >>
++			CONTROL_SPI_IO_DUMMY_CYCLES_HI_SHIFT);
++}
++
++static size_t show_ctl_div(u32 control, char *buf)
++{
++	return sprintf(buf, "%u\n", spi_control_to_freq_div(control));
++}
++
++static size_t show_ctl_dummy_bytes(u32 control, char *buf)
++{
++	return sprintf(buf, "%u\n", spi_control_to_dummy_bytes(control));
++}
++#endif /* ATTR */
++
++static void aspeed_smc_start_user(struct spi_nor *nor)
++{
++	struct aspeed_smc_chip *chip = nor->priv;
++	u32 ctl = chip->ctl_val[smc_base];
++
++	if (chip->controller)
++		mutex_lock(&chip->controller->mutex);
++
++	ctl |= CONTROL_SPI_COMMAND_MODE_USER |
++		CONTROL_SPI_CE_STOP_ACTIVE_CONTROL;
++	writel(ctl, chip->ctl);
++
++	ctl &= ~CONTROL_SPI_CE_STOP_ACTIVE_CONTROL;
++	writel(ctl, chip->ctl);
++}
++
++static void aspeed_smc_stop_user(struct spi_nor *nor)
++{
++	struct aspeed_smc_chip *chip = nor->priv;
++
++	u32 ctl = chip->ctl_val[smc_read];
++	u32 ctl2 = ctl | CONTROL_SPI_COMMAND_MODE_USER |
++		CONTROL_SPI_CE_STOP_ACTIVE_CONTROL;
++
++	writel(ctl2, chip->ctl);	/* stop user CE control */
++	writel(ctl, chip->ctl);		/* default to fread or read */
++
++	if (chip->controller)
++		mutex_unlock(&chip->controller->mutex);
++}
++
++#if 0 /* memcpy */
++static void aspeed_smc_start_write(struct spi_nor *nor)
++{
++	struct aspeed_smc_chip *chip = nor->priv;
++	u32 ctl = chip->ctl_val[smc_write];
++
++	if (chip->controller)
++		mutex_lock(&chip->controller->mutex);
++
++	writel(ctl | CONTROL_SPI_CE_STOP_ACTIVE_CONTROL,  chip->ctl);
++
++	writel(ctl, chip->ctl);
++}
++
++static void aspeed_smc_stop_write(struct spi_nor *nor)
++{
++	aspeed_smc_stop_user(nor);
++}
++#endif
++
++static int aspeed_smc_read_reg(struct spi_nor *nor, u8 opcode, u8 *buf, int len)
++{
++	struct aspeed_smc_chip *chip = nor->priv;
++
++	aspeed_smc_start_user(nor);
++	writeb(opcode, chip->base);
++	_memcpy_fromio(buf, chip->base, len);
++	aspeed_smc_stop_user(nor);
++
++	return 0;
++}
++
++static int aspeed_smc_write_reg(struct spi_nor *nor, u8 opcode, u8 *buf,
++				int len, int write_enable)
++{
++	struct aspeed_smc_chip *chip = nor->priv;
++
++	aspeed_smc_start_user(nor);
++	writeb(opcode, chip->base);
++	_memcpy_toio(chip->base, buf, len);
++	aspeed_smc_stop_user(nor);
++
++	return 0;
++}
++
++static void aspeed_smc_send_cmd_addr(struct spi_nor *nor, u8 cmd, u32 addr)
++{
++	struct aspeed_smc_chip *chip = nor->priv;
++	__be32 temp;
++	u32 cmdaddr;
++
++	switch (nor->addr_width) {
++	default:
++		WARN_ONCE(1, "Unexpected address width %u, defaulting to 3\n",
++			  nor->addr_width);
++		/* FALLTHROUGH */
++	case 3:
++		cmdaddr = addr & 0xFFFFFF;
++
++		cmdaddr |= (u32)cmd << 24;
++
++		temp = cpu_to_be32(cmdaddr);
++		memcpy_toio(chip->base, &temp, 4);
++		break;
++	case 4:
++		temp = cpu_to_be32(addr);
++		writeb(cmd, chip->base);
++		memcpy_toio(chip->base, &temp, 4);
++		break;
++	}
++}
++
++#if 0 /* memcpy */
++static int aspeed_smc_read_memcpy(struct spi_nor *nor, loff_t from, size_t len,
++				  size_t *retlen, u_char *read_buf)
++{
++	struct aspeed_smc_chip *chip = nor->priv;
++
++	if (chip->controller)
++		mutex_lock(&chip->controller->mutex);
++
++	memcpy_fromio(read_buf, chip->base, len);
++	*retlen += len;
++
++	if (chip->controller)
++		mutex_unlock(&chip->controller->mutex);
++
++	return 0;
++}
++
++static void aspeed_smc_write_memcpy(struct spi_nor *nor, loff_t to, size_t len,
++				    size_t *retlen, const u_char *write_buf)
++{
++	struct aspeed_smc_chip *chip = nor->priv;
++
++	aspeed_smc_start_write(nor);
++	memcpy_toio(chip->base, write_buf, len);
++	*retlen += len;
++	aspeed_smc_stop_write(nor);
++}
++#endif
++
++static int aspeed_smc_read_user(struct spi_nor *nor, loff_t from, size_t len,
++				size_t *retlen, u_char *read_buf)
++{
++	struct aspeed_smc_chip *chip = nor->priv;
++
++	aspeed_smc_start_user(nor);
++	aspeed_smc_send_cmd_addr(nor, nor->read_opcode, from);
++	memcpy_fromio(read_buf, chip->base, len);
++	*retlen += len;
++	aspeed_smc_stop_user(nor);
++
++	return 0;
++}
++
++static void aspeed_smc_write_user(struct spi_nor *nor, loff_t to, size_t len,
++				  size_t *retlen, const u_char *write_buf)
++{
++	struct aspeed_smc_chip *chip = nor->priv;
++
++	aspeed_smc_start_user(nor);
++	aspeed_smc_send_cmd_addr(nor, nor->program_opcode, to);
++	memcpy_toio(chip->base, write_buf, len);
++	*retlen += len;
++	aspeed_smc_stop_user(nor);
++}
++
++static int aspeed_smc_erase(struct spi_nor *nor, loff_t offs)
++{
++	aspeed_smc_start_user(nor);
++	aspeed_smc_send_cmd_addr(nor, nor->erase_opcode, offs);
++	aspeed_smc_stop_user(nor);
++
++	return 0;
++}
++
++static int aspeed_smc_remove(struct platform_device *dev)
++{
++	struct aspeed_smc_chip *chip;
++	struct aspeed_smc_controller *controller = platform_get_drvdata(dev);
++	int n;
++
++	for (n = 0; n < controller->info->nce; n++) {
++		chip = controller->chips[n];
++		if (chip)
++			mtd_device_unregister(&chip->mtd);
++	}
++
++	return 0;
++}
++
++const struct of_device_id aspeed_smc_matches[] = {
++	{ .compatible = "aspeed,fmc", .data = &aspeed_table[smc_type_fmc] },
++	{ .compatible = "aspeed,smc", .data = &aspeed_table[smc_type_smc] },
++	{ }
++};
++MODULE_DEVICE_TABLE(of, aspeed_smc_matches);
++
++
++static struct platform_device *
++of_platform_device_create_or_find(struct device_node *child,
++				  struct device *parent)
++{
++	struct platform_device *cdev;
++
++	cdev = of_platform_device_create(child, NULL, parent);
++	if (!cdev)
++		cdev = of_find_device_by_node(child);
++	return cdev;
++}
++
++static int aspeed_smc_probe(struct platform_device *dev)
++{
++	struct aspeed_smc_controller *controller;
++	const struct of_device_id *match;
++	const struct aspeed_smc_info *info;
++	struct resource *r;
++	void __iomem *regs;
++	struct device_node *child;
++	int err = 0;
++	unsigned int n;
++
++	match = of_match_device(aspeed_smc_matches, &dev->dev);
++	if (!match)
++		return -ENODEV;
++	info = match->data;
++	r = platform_get_resource(dev, IORESOURCE_MEM, 0);
++	regs = devm_ioremap_resource(&dev->dev, r);
++	if (IS_ERR(regs))
++		return PTR_ERR(regs);
++
++	controller = devm_kzalloc(&dev->dev, sizeof(*controller) +
++		info->nce * sizeof(controller->chips[0]), GFP_KERNEL);
++	if (!controller)
++		return -ENOMEM;
++	platform_set_drvdata(dev, controller);
++	controller->regs = regs;
++	controller->info = info;
++	mutex_init(&controller->mutex);
++
++	/* XXX turn off legacy mode if fmc ? */
++	/* XXX handshake to enable access to SMC (bios) controller w/ host? */
++
++	for_each_available_child_of_node(dev->dev.of_node, child) {
++		struct mtd_part_parser_data ppdata;
++		struct platform_device *cdev;
++		struct aspeed_smc_chip *chip;
++		u32 reg;
++
++		if (!of_device_is_compatible(child, "jedec,spi-nor"))
++			continue;	/* XXX consider nand, nor children */
++
++
++		/*
++		 * create a platform device from the of node.
++		 * if the device already was created (eg from
++		 * a prior bind/unbind cycle) use it
++		 *
++		 * XXX The child name will become the default mtd
++		 * name in ioctl and /proc/mtd.  Should we default
++		 * to node->name (without unit)?  The name must be
++		 * unique among all platform devices.  (Name would
++		 * replace NULL in create call below).
++		 * ... Or we can just encourage the label attribute.
++		 *
++		 * The only reason to do the child here is to use it in
++		 * dev_err below for duplicate chip id.  We could use
++		 * the controller dev.
++		 */
++		cdev = of_platform_device_create_or_find(child, &dev->dev);
++		if (!cdev)
++			continue;
++
++		err = of_property_read_u32(child, "reg", &n);
++		if (err == -EINVAL && info->nce == 1)
++			n = 0;
++		else if (err || n >= info->nce)
++			continue;
++		if (controller->chips[n]) {
++			dev_err(&cdev->dev,
++				"chip-id %u already in use in use by %s\n",
++				n, dev_name(controller->chips[n]->nor.dev));
++			continue;
++		}
++		chip = devm_kzalloc(&dev->dev, sizeof(*chip), GFP_KERNEL);
++		if (!chip)
++			continue;
++
++		r = platform_get_resource(dev, IORESOURCE_MEM, n + 1);
++		chip->base = devm_ioremap_resource(&dev->dev, r);
++
++		if (!chip->base)
++			continue;
++		chip->controller = controller;
++		chip->ctl = controller->regs + info->ctl0 + n * 4;
++
++		/*
++		 * Always turn on write enable bit in config register to
++		 * allow opcodes to be sent in user mode.
++		 */
++		mutex_lock(&controller->mutex);
++		reg = readl(controller->regs + info->cfg);
++		dev_dbg(&dev->dev, "flash config was %08x\n", reg);
++		reg |= 1 << (info->we0 + n); /* WEn */
++		writel(reg, controller->regs + info->cfg);
++		mutex_unlock(&controller->mutex);
++
++		/* XXX check resource within fmc CEx Segment Address Register */
++		/* XXX -- see dt vs jedec id vs bootloader */
++		/* check type is ast_smc_spi or set it? */
++		/* XXX check / program clock phase/polarity,  only 0 or 3 */
++
++		/*
++		 * Read the existing control register to get basic values.
++		 *
++		 * XXX probably need more sanitation.
++		 * XXX do we trust the bootloader or the device tree?
++		 * spi-nor.c trusts jtag id over passed ids.
++		 */
++		reg = readl(chip->ctl);
++		chip->ctl_val[smc_base] = reg & CONTROL_SPI_KEEP_MASK;
++
++		if ((reg & CONTROL_SPI_COMMAND_MODE_MASK) ==
++		    CONTROL_SPI_COMMAND_MODE_NORMAL)
++			chip->ctl_val[smc_read] = reg;
++#if 0 /* should we inherit fast read (fread) from boot ?  or id tables?*/
++		else if ((reg & CONTROL_SPI_COMMAND_MODE_MASK) ==
++			 CONTROL_SPI_COMMAND_MODE_FREAD)
++			chip->ctl_val[smc_read] = reg;
++#endif
++		else
++			chip->ctl_val[smc_read] = chip->ctl_val[smc_base] |
++				CONTROL_SPI_COMMAND_MODE_NORMAL;
++
++		chip->nor.dev = &cdev->dev;
++		chip->nor.priv = chip;
++		chip->nor.mtd = &chip->mtd;
++		chip->mtd.priv = &chip->nor; /* should be in spi_nor_scan()!! */
++		chip->nor.erase = aspeed_smc_erase;
++		chip->nor.read = aspeed_smc_read_user;
++		chip->nor.write = aspeed_smc_write_user;
++		chip->nor.read_reg = aspeed_smc_read_reg;
++		chip->nor.write_reg = aspeed_smc_write_reg;
++
++		/*
++		 * XXX use of property and controller info width to choose
++		 * SPI_NOR_QUAD , SPI_NOR_DUAL
++		 */
++		err = spi_nor_scan(&chip->nor, NULL, SPI_NOR_NORMAL);
++		if (err)
++			continue;
++
++		chip->ctl_val[smc_write] = chip->ctl_val[smc_base] |
++			spi_control_fill_opcode(chip->nor.program_opcode) |
++			CONTROL_SPI_COMMAND_MODE_WRITE;
++
++		/* XXX intrepret nor flags into controller settings */
++		/* XXX enable fast read here */
++		/* XXX check if resource size big enough for chip */
++
++		memset(&ppdata, 0, sizeof(ppdata));
++		ppdata.of_node = cdev->dev.of_node;
++		err = mtd_device_parse_register(&chip->mtd, NULL, &ppdata, NULL, 0);
++		if (err)
++			continue;
++		controller->chips[n] = chip;
++	}
++
++	/* did we register any children? */
++	for (n = 0; n < info->nce; n++)
++		if (controller->chips[n])
++			break;
++
++	if (n == info->nce)
++		return -ENODEV;
++
++	return 0;
++}
++
++static struct platform_driver aspeed_smc_driver = {
++	.probe = aspeed_smc_probe,
++	.remove = aspeed_smc_remove,
++	.driver = {
++		.name = KBUILD_MODNAME,
++		.of_match_table = aspeed_smc_matches,
++	}
++};
++
++/* XXX should this be a builtin driver ? */
++module_platform_driver(aspeed_smc_driver);
++
++MODULE_DESCRIPTION("ASPEED Static Memory Controller Driver");
++MODULE_AUTHOR("Milton Miller");
++MODULE_LICENSE("GPL v2");
+-- 
+1.8.2.2
+
diff --git a/meta-openbmc-bsp/meta-aspeed/meta-ast2400/recipes-kernel/linux/linux-obmc/0001-rtc-aspeed-month-is-off-by-one.patch b/meta-openbmc-bsp/meta-aspeed/meta-ast2400/recipes-kernel/linux/linux-obmc/0001-rtc-aspeed-month-is-off-by-one.patch
new file mode 100644
index 0000000..c3bd491
--- /dev/null
+++ b/meta-openbmc-bsp/meta-aspeed/meta-ast2400/recipes-kernel/linux/linux-obmc/0001-rtc-aspeed-month-is-off-by-one.patch
@@ -0,0 +1,35 @@
+From 6f72f95d593a68f055e8edb46047cb5c0e9906b4 Mon Sep 17 00:00:00 2001
+From: "Milton D. Miller II" <miltonm@us.ibm.com>
+Date: Wed, 13 Jan 2016 08:37:42 -0600
+Subject: [PATCH] rtc: aspeed month is off-by-one
+
+Norm reported hwclock set the date one hour different from what it
+read back.
+
+The mktime64 call takes the month as the 1-based counted month not
+the 0-based months since January like struct rtc_tm and struct tm.
+No adjustment from the harware is needed.  Also mask off a few 0 bits.
+
+Reported-by: Norman James <nkskjames@gmail.com>
+Signed-off-by: Milton Miller <miltonm@us.ibm.com>
+---
+ drivers/rtc/rtc-aspeed.c | 3 +--
+ 1 file changed, 1 insertion(+), 2 deletions(-)
+
+diff --git a/drivers/rtc/rtc-aspeed.c b/drivers/rtc/rtc-aspeed.c
+index cfb5ee0..1a5bbd1 100644
+--- a/drivers/rtc/rtc-aspeed.c
++++ b/drivers/rtc/rtc-aspeed.c
+@@ -48,8 +48,7 @@ static int aspeed_rtc_read_time(struct device *dev, struct rtc_time *tm)
+ 	sec  = (reg1 >>  0) & 0x3f;
+ 	cent = (reg2 >> 16) & 0x1f;
+ 	year = (reg2 >>  8) & 0x7f;
+-	/* struct rtc_time counts from 0 to 11, but hardware is 1 to 12 */
+-	mon  = ((reg2 >>  0) & 0x3f) - 1;
++	mon  = (reg2 >>  0) & 0xf;	/* mktime64 and hardware use 1 = Jan */
+ 
+ 	rtc_time64_to_tm(mktime64(cent*100 + year, mon, day, hour, min, sec),
+ 			 tm);
+-- 
+1.8.2.2
+
diff --git a/meta-openbmc-bsp/meta-aspeed/meta-ast2400/recipes-kernel/linux/linux-obmc/defconfig b/meta-openbmc-bsp/meta-aspeed/meta-ast2400/recipes-kernel/linux/linux-obmc/defconfig
index 64f097d..d42bd34 100644
--- a/meta-openbmc-bsp/meta-aspeed/meta-ast2400/recipes-kernel/linux/linux-obmc/defconfig
+++ b/meta-openbmc-bsp/meta-aspeed/meta-ast2400/recipes-kernel/linux/linux-obmc/defconfig
@@ -60,6 +60,8 @@ CONFIG_MTD_DATAFLASH=y
 CONFIG_MTD_NAND=y
 CONFIG_MTD_UBI=y
 CONFIG_MTD_UBI_GLUEBI=y
+CONFIG_MTD_SPI_NOR=y
+CONFIG_ASPEED_FLASH_SPI=y
 CONFIG_BLK_DEV_LOOP=y
 CONFIG_BLK_DEV_RAM=y
 CONFIG_BLK_DEV_RAM_COUNT=4
@@ -169,12 +171,15 @@ CONFIG_FIRMWARE_MEMMAP=y
 CONFIG_EXT4_FS=y
 CONFIG_FANOTIFY=y
 CONFIG_AUTOFS4_FS=y
+CONFIG_OVERLAY_FS=y
 CONFIG_VFAT_FS=y
 CONFIG_TMPFS=y
 CONFIG_TMPFS_POSIX_ACL=y
 CONFIG_JFFS2_FS=y
 CONFIG_JFFS2_SUMMARY=y
+CONFIG_JFFS2_FS_XATTR=y
 CONFIG_SQUASHFS=y
+CONFIG_SQUASHFS_XZ=y
 CONFIG_NFS_FS=y
 CONFIG_ROOT_NFS=y
 CONFIG_NLS_CODEPAGE_437=y
diff --git a/meta-openbmc-bsp/meta-aspeed/meta-ast2400/recipes-kernel/linux/linux-obmc/spinor-dts.patch b/meta-openbmc-bsp/meta-aspeed/meta-ast2400/recipes-kernel/linux/linux-obmc/spinor-dts.patch
new file mode 100644
index 0000000..7107383
--- /dev/null
+++ b/meta-openbmc-bsp/meta-aspeed/meta-ast2400/recipes-kernel/linux/linux-obmc/spinor-dts.patch
@@ -0,0 +1,147 @@
+Add spi flash to aspeed dts
+From: Milton Miller II <miltonm@us.ibm.com>
+
+diff --git a/arch/arm/boot/dts/aspeed-bmc-opp-barreleye.dts b/arch/arm/boot/dts/aspeed-bmc-opp-barreleye.dts
+index 4d1a215..34daec6 100644
+--- a/arch/arm/boot/dts/aspeed-bmc-opp-barreleye.dts
++++ b/arch/arm/boot/dts/aspeed-bmc-opp-barreleye.dts
+@@ -6,6 +6,67 @@
+ 	model = "Barrelye BMC";
+ 	compatible = "rackspace,barreleye-bmc", "aspeed,ast2400";
+ 	ahb {
++		fmc@1e620000 {
++			reg = < 0x1e620000 0x94
++				0x20000000 0x02000000 >;
++			#address-cells = <1>;
++			#size-cells = <0>;
++			compatible = "aspeed,fmc";
++			bmc {
++				reg = < 0 >;
++				compatible = "jedec,spi-nor" ;
++				label = "bmc";
++				/*
++				 * Possibly required props:
++				 * spi-max-frequency = <>
++				 * spi-tx-bus-width = <>
++				 * spi-rx-bus-width  = <>
++				 * m25p,fast-read
++				 * spi-cpol if inverse clock polarity (CPOL)
++				 * spi-cpha if shifted clock phase (CPHA)
++				 */
++				#address-cells = < 1 >;
++				#size-cells = < 1 >;
++				u-boot {
++					reg = < 0 0x60000 >;
++					label = "u-boot";
++				};
++				u-boot-env {
++					reg = < 0x60000 0x20000 >;
++					label = "u-boot-env";
++				};
++				kernel  {
++					reg = < 0x80000 0x280000 >;
++					label = "kernel";
++				};
++				initramfs {
++					reg = < 0x300000 0x1c0000 >;
++					label = "initramfs";
++				};
++				rofs  {
++					reg = < 0x4c0000 0x1740000 >;
++					label = "rofs";
++				};
++				rwfs  {
++					reg = < 0x1c00000 0x400000 >;
++					label = "rwfs";
++				};
++			};
++		};
++		spi@1e630000 {
++			reg = < 0x1e630000 0x18
++				0x30000000 0x02000000 >;
++			#address-cells = <1>;
++			#size-cells = <0>;
++			compatible = "aspeed,smc";
++			pnor {
++				reg = < 0 >;
++				compatible = "jedec,spi-nor" ;
++				label = "pnor";
++				/* spi-max-frequency = <>; */
++				/* m25p,fast-read; */
++			};
++		};
+ 		apb {
+ 			i2c: i2c@1e78a040 {
+ 				i2c0: i2c-bus@40 {
+diff --git a/arch/arm/boot/dts/aspeed-bmc-opp-palmetto.dts b/arch/arm/boot/dts/aspeed-bmc-opp-palmetto.dts
+index 2c3e824..d864119 100644
+--- a/arch/arm/boot/dts/aspeed-bmc-opp-palmetto.dts
++++ b/arch/arm/boot/dts/aspeed-bmc-opp-palmetto.dts
+@@ -7,6 +7,67 @@
+ 	compatible = "tyan,palmetto-bmc", "aspeed,ast2400";
+ 
+ 	ahb {
++		fmc@1e620000 {
++			reg = < 0x1e620000 0x94
++				0x20000000 0x02000000 >;
++			#address-cells = <1>;
++			#size-cells = <0>;
++			compatible = "aspeed,fmc";
++			bmc {
++				reg = < 0 >;
++				compatible = "jedec,spi-nor" ;
++				label = "bmc";
++				/*
++				 * Possibly required props:
++				 * spi-max-frequency = <>
++				 * spi-tx-bus-width = <>
++				 * spi-rx-bus-width  = <>
++				 * m25p,fast-read
++				 * spi-cpol if inverse clock polarity (CPOL)
++				 * spi-cpha if shifted clock phase (CPHA)
++				 */
++				#address-cells = < 1 >;
++				#size-cells = < 1 >;
++				u-boot {
++					reg = < 0 0x60000 >;
++					label = "u-boot";
++				};
++				u-boot-env {
++					reg = < 0x60000 0x20000 >;
++					label = "u-boot-env";
++				};
++				kernel  {
++					reg = < 0x80000 0x280000 >;
++					label = "kernel";
++				};
++				initramfs {
++					reg = < 0x300000 0x1c0000 >;
++					label = "initramfs";
++				};
++				rofs  {
++					reg = < 0x4c0000 0x1740000 >;
++					label = "rofs";
++				};
++				rwfs  {
++					reg = < 0x1c00000 0x400000 >;
++					label = "rwfs";
++				};
++			};
++		};
++		spi@1e630000 {
++			reg = < 0x1e630000 0x18
++				0x30000000 0x02000000 >;
++			#address-cells = <1>;
++			#size-cells = <0>;
++			compatible = "aspeed,smc";
++			pnor {
++				reg = < 0 >;
++				compatible = "jedec,spi-nor" ;
++				label = "pnor";
++				/* spi-max-frequency = <>; */
++				/* m25p,fast-read; */
++			};
++		};
+ 		apb {
+ 			i2c: i2c@1e78a040 {
+ 				i2c0: i2c-bus@40 {
diff --git a/meta-openbmc-bsp/meta-aspeed/meta-ast2400/recipes-kernel/linux/linux-obmc_%.bbappend b/meta-openbmc-bsp/meta-aspeed/meta-ast2400/recipes-kernel/linux/linux-obmc_%.bbappend
index bb6f06c..8439b8b 100644
--- a/meta-openbmc-bsp/meta-aspeed/meta-ast2400/recipes-kernel/linux/linux-obmc_%.bbappend
+++ b/meta-openbmc-bsp/meta-aspeed/meta-ast2400/recipes-kernel/linux/linux-obmc_%.bbappend
@@ -1,2 +1,5 @@
 FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"
-SRC_URI += "file://defconfig file://hwmon.cfg"
+SRC_URI += "file://defconfig file://hwmon.cfg file://spinor-dts.patch"
+SRC_URI += "file://0001-mtd-spi-nor-Add-SPI-memory-controllers-for-ASPEED-AS.patch"
+SRC_URI += "file://0001-rtc-aspeed-month-is-off-by-one.patch"
+
-- 
2.6.4

^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH openbmc 4/6] u-boot : switch to repro, add fw_env.config
  2016-01-20 23:10 [PATCH openbmc 0/6] Persistent 1 OpenBMC Patches
                   ` (2 preceding siblings ...)
  2016-01-20 23:10 ` [PATCH openbmc 3/6] linux-obmc: apply the aspeed-spi-nor controller patchset OpenBMC Patches
@ 2016-01-20 23:10 ` OpenBMC Patches
  2016-01-21  6:14   ` Jeremy Kerr
  2016-01-21 23:17   ` Milton Miller II
  2016-01-20 23:10 ` [PATCH openbmc 5/6] create u-boot-fw-utils for our u-boot version OpenBMC Patches
                   ` (2 subsequent siblings)
  6 siblings, 2 replies; 16+ messages in thread
From: OpenBMC Patches @ 2016-01-20 23:10 UTC (permalink / raw)
  To: openbmc; +Cc: Milton D. Miller II

From: "Milton D. Miller II" <miltonm@us.ibm.com>

Switch to the obmc repro so that u-boot can effectively download the
kernel and initrd for recovery from corrupted flash partitions.

Add the fw_env.config pointing to /dev/mtd2 as 128k, which the
current flash layout.
---
 .../meta-ast2400/recipes-bsp/u-boot/files/fw_env.config          | 4 ++--
 .../meta-ast2400/recipes-bsp/u-boot/u-boot_2013.07%.bbappend     | 7 ++-----
 meta-phosphor/common/recipes-bsp/u-boot/u-boot_2013.07.bb        | 9 +++++----
 3 files changed, 9 insertions(+), 11 deletions(-)

diff --git a/meta-openbmc-bsp/meta-aspeed/meta-ast2400/recipes-bsp/u-boot/files/fw_env.config b/meta-openbmc-bsp/meta-aspeed/meta-ast2400/recipes-bsp/u-boot/files/fw_env.config
index 9cb3ad2..07be77a 100644
--- a/meta-openbmc-bsp/meta-aspeed/meta-ast2400/recipes-bsp/u-boot/files/fw_env.config
+++ b/meta-openbmc-bsp/meta-aspeed/meta-ast2400/recipes-bsp/u-boot/files/fw_env.config
@@ -7,8 +7,8 @@
 
 # NOR example
 # MTD device name	Device offset	Env. size	Flash sector size	Number of sectors
-/dev/mtd1		0x0000		0x20000		0x20000
-#/dev/mtd2		0x0000		0x4000		0x4000
+#/dev/mtd1		0x0000		0x20000		0x20000
+/dev/mtd2		0x0000		0x20000		0x10000
 
 # MTD SPI-dataflash example
 # MTD device name	Device offset	Env. size	Flash sector size	Number of sectors
diff --git a/meta-openbmc-bsp/meta-aspeed/meta-ast2400/recipes-bsp/u-boot/u-boot_2013.07%.bbappend b/meta-openbmc-bsp/meta-aspeed/meta-ast2400/recipes-bsp/u-boot/u-boot_2013.07%.bbappend
index 6d4a18f..50adb9f 100644
--- a/meta-openbmc-bsp/meta-aspeed/meta-ast2400/recipes-bsp/u-boot/u-boot_2013.07%.bbappend
+++ b/meta-openbmc-bsp/meta-aspeed/meta-ast2400/recipes-bsp/u-boot/u-boot_2013.07%.bbappend
@@ -1,10 +1,7 @@
 FILESEXTRAPATHS_prepend := "${THISDIR}/files:"
 
-#SRC_URI += "file://fw_env.config
-SRC_URI += "file://patch-2013.07/0000-u-boot-aspeed-064.patch \
-           file://patch-2013.07/0001-u-boot-openbmc.patch \
-           file://config.patch \
-           "
+SRC_URI += "file://fw_env.config"
+SRC_URI += "file://config.patch"
 
 # Do not install u-boot in rootfs
 #do_install[postfuncs] += "remove_uboot_from_rootfs"
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 f3e2f56..6349d97 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,13 +12,14 @@ LIC_FILES_CHKSUM = "file://COPYING;md5=1707d6db1d42237583f50183a5651ecb \
 
 # 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 = "62c175fbb8a0f9a926c88294ea9f7e88eb898f6c"
+# SRCREV = "62c175fbb8a0f9a926c88294ea9f7e88eb898f6c"
+SRCREV="${AUTOREV}"
+
 
 PV = "v2013.07+git${SRCPV}"
 
-SRC_URI = "git://git.denx.de/u-boot.git;branch=master \
-          file://0001-am335x_evm.h-Add-use-DEFAULT_LINUX_BOOT_ENV-environm.patch \
-          "
+UBRANCH = "v2013.07-aspeed-openbmc"
+SRC_URI = "git://git@github.com/openbmc/u-boot.git;branch=${UBRANCH};protocol=https"
 
 S = "${WORKDIR}/git"
 
-- 
2.6.4

^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH openbmc 5/6] create u-boot-fw-utils for our u-boot version
  2016-01-20 23:10 [PATCH openbmc 0/6] Persistent 1 OpenBMC Patches
                   ` (3 preceding siblings ...)
  2016-01-20 23:10 ` [PATCH openbmc 4/6] u-boot : switch to repro, add fw_env.config OpenBMC Patches
@ 2016-01-20 23:10 ` OpenBMC Patches
  2016-01-25  0:42   ` Andrew Jeffery
  2016-01-20 23:10 ` [PATCH openbmc 6/6] phosphor: Create image class image-overlay and move phosphor to use it OpenBMC Patches
  2016-01-22  2:16 ` [PATCH openbmc 0/6] Persistent 1 Stewart Smith
  6 siblings, 1 reply; 16+ messages in thread
From: OpenBMC Patches @ 2016-01-20 23:10 UTC (permalink / raw)
  To: openbmc; +Cc: Milton D. Miller II

From: "Milton D. Miller II" <miltonm@us.ibm.com>

This commit creates a class and recipie based on the upstream 2015
branch of u-boot and patches it with our fw_env.config.

Having these tools for the initfs will allow us to modify the u-boot
enviornment to do things like boot from network for update and set the
bmc mac addresses in the environment for u-boot and use by the kernel.

Unfornately its broken in that it produces a host binary instead of
a target binary when building the base package.  I have not been able
to resolve this despite several attempts.
---
 .../u-boot/u-boot-fw-utils_2013.07%.bbappend       | 13 ++++++
 .../recipes-bsp/u-boot/u-boot-fw-utils_2013.07.bb  | 52 ++++++++++++++++++++++
 2 files changed, 65 insertions(+)
 create mode 100644 meta-openbmc-bsp/meta-aspeed/meta-ast2400/recipes-bsp/u-boot/u-boot-fw-utils_2013.07%.bbappend
 create mode 100644 meta-phosphor/common/recipes-bsp/u-boot/u-boot-fw-utils_2013.07.bb

diff --git a/meta-openbmc-bsp/meta-aspeed/meta-ast2400/recipes-bsp/u-boot/u-boot-fw-utils_2013.07%.bbappend b/meta-openbmc-bsp/meta-aspeed/meta-ast2400/recipes-bsp/u-boot/u-boot-fw-utils_2013.07%.bbappend
new file mode 100644
index 0000000..4020696
--- /dev/null
+++ b/meta-openbmc-bsp/meta-aspeed/meta-ast2400/recipes-bsp/u-boot/u-boot-fw-utils_2013.07%.bbappend
@@ -0,0 +1,13 @@
+FILESEXTRAPATHS_prepend := "${THISDIR}/files:"
+
+SRC_URI += "file://fw_env.config"
+SRC_URI += "file://config.patch"
+
+do_install_append() {
+    if [ -e ${WORKDIR}/fw_env.config ] ; then
+        install -d ${D}${sysconfdir}
+        install -m 644 ${WORKDIR}/fw_env.config ${D}${sysconfdir}/fw_env.config
+    fi
+}
+
+BBCLASSEXTEND += "native"
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
new file mode 100644
index 0000000..6f72945
--- /dev/null
+++ b/meta-phosphor/common/recipes-bsp/u-boot/u-boot-fw-utils_2013.07.bb
@@ -0,0 +1,52 @@
+SUMMARY = "U-Boot bootloader fw_printenv/setenv utilities"
+SECTION = "bootloader"
+DEPENDS = "mtd-utils"
+
+LICENSE = "GPLv2+"
+LIC_FILES_CHKSUM = "file://COPYING;md5=1707d6db1d42237583f50183a5651ecb \
+                    file://README;beginline=1;endline=22;md5=78b195c11cb6ef63e6985140db7d7bab"
+
+# 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 = "62c175fbb8a0f9a926c88294ea9f7e88eb898f6c"
+SRCREV="${AUTOREV}"
+
+PV = "v2013.07+git${SRCPV}"
+
+UBRANCH = "v2013.07-aspeed-openbmc"
+SRC_URI = "git://git@github.com/openbmc/u-boot.git;branch=${UBRANCH};protocol=https"
+S = "${WORKDIR}/git"
+
+INSANE_SKIP_${PN} = "already-stripped"
+EXTRA_OEMAKE_class-target = 'CROSS_COMPILE=${TARGET_PREFIX} CC="${CC} ${CFLAGS} ${LDFLAGS}" V=1'
+EXTRA_OEMAKE_class-cross = 'ARCH=${TARGET_ARCH} CC="${CC} ${CFLAGS} ${LDFLAGS}" V=1'
+
+inherit uboot-config
+
+do_compile () {
+	oe_runmake ${UBOOT_MACHINE}
+	oe_runmake env
+}
+
+do_install () {
+	install -d ${D}${base_sbindir}
+	install -d ${D}${sysconfdir}
+	install -m 755 ${S}/tools/env/fw_printenv ${D}${base_sbindir}/fw_printenv
+	install -m 755 ${S}/tools/env/fw_printenv ${D}${base_sbindir}/fw_setenv
+	install -m 0644 ${S}/tools/env/fw_env.config ${D}${sysconfdir}/fw_env.config
+}
+
+do_install_class-cross () {
+	install -d ${D}${bindir_cross}
+	install -m 755 ${S}/tools/env/fw_printenv ${D}${bindir_cross}/fw_printenv
+	install -m 755 ${S}/tools/env/fw_printenv ${D}${bindir_cross}/fw_setenv
+}
+
+SYSROOT_PREPROCESS_FUNCS_class-cross = "uboot_fw_utils_cross"
+uboot_fw_utils_cross() {
+	sysroot_stage_dir ${D}${bindir_cross} ${SYSROOT_DESTDIR}${bindir_cross}
+}
+
+PACKAGE_ARCH = "${MACHINE_ARCH}"
+BBCLASSEXTEND = "cross native"
-- 
2.6.4

^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH openbmc 6/6] phosphor: Create image class image-overlay and move phosphor to use it
  2016-01-20 23:10 [PATCH openbmc 0/6] Persistent 1 OpenBMC Patches
                   ` (4 preceding siblings ...)
  2016-01-20 23:10 ` [PATCH openbmc 5/6] create u-boot-fw-utils for our u-boot version OpenBMC Patches
@ 2016-01-20 23:10 ` OpenBMC Patches
  2016-01-25  0:22   ` Andrew Jeffery
  2016-01-22  2:16 ` [PATCH openbmc 0/6] Persistent 1 Stewart Smith
  6 siblings, 1 reply; 16+ messages in thread
From: OpenBMC Patches @ 2016-01-20 23:10 UTC (permalink / raw)
  To: openbmc; +Cc: Milton D. Miller II

From: "Milton D. Miller II" <miltonm@us.ibm.com>

This commit creates a new class image-overlay based on how the
image-live class is structured.  It takes parameters for the base
and overlayed file system types but the initfs only support ext4
over squashfs presently.

It then moves invoking the generation of the flash image from a
post image creation command to a seperate task invoked from the
overlay image so that building the initramfs image by itself does
not try to create
a flash image.
---
 meta-phosphor/classes/image-overlay.bbclass        | 18 +++++++
 .../obmc-phosphor-image_types_uboot.bbclass        | 55 +++++++++++++++-------
 meta-phosphor/conf/distro/openbmc-phosphor.conf    |  1 +
 .../conf/machine/include/obmc-bsp-common.inc       | 10 +++-
 4 files changed, 65 insertions(+), 19 deletions(-)
 create mode 100644 meta-phosphor/classes/image-overlay.bbclass

diff --git a/meta-phosphor/classes/image-overlay.bbclass b/meta-phosphor/classes/image-overlay.bbclass
new file mode 100644
index 0000000..1c6137d
--- /dev/null
+++ b/meta-phosphor/classes/image-overlay.bbclass
@@ -0,0 +1,18 @@
+
+INITRD_IMAGE ?= "core-image-minimal-initramfs"
+INITRD ?= "${DEPLOY_DIR_IMAGE}/${INITRD_IMAGE}-${MACHINE}.cpio.${INITRD_CTYPE}${uboot}"
+
+IMAGE_BASETYPE ?= "squashfs-xz"
+OVERLAY_BASETYPE ?= "ext4"
+
+IMAGE_TYPES_${PN} += "${IMAGE_BASETYPE}"
+
+IMAGE_TYPEDEP_overlay = "${IMAGE_BASETYPE} ${OVERLAY_BASETYPE}"
+IMAGE_TYPES_MASKED += "overlay"
+
+ROOTFS ?= "${DEPLOY_DIR_IMAGE}/${IMAGE_BASENAME}-${MACHINE}.${IMAGE_BASETYPE}"
+
+do_generate_flash[depends] += "${INITRD_IMAGE}:do_rootfs"
+do_generate_flash[depends] += "${PN}:do_rootfs"
+
+addtask generate_flash after do_rootfs before do_build
diff --git a/meta-phosphor/classes/obmc-phosphor-image_types_uboot.bbclass b/meta-phosphor/classes/obmc-phosphor-image_types_uboot.bbclass
index 835e890..14e9289 100644
--- a/meta-phosphor/classes/obmc-phosphor-image_types_uboot.bbclass
+++ b/meta-phosphor/classes/obmc-phosphor-image_types_uboot.bbclass
@@ -4,44 +4,65 @@ inherit image_types_uboot
 # the image load address and entry point. Override it here.
 
 oe_mkimage () {
-    mkimage -A ${UBOOT_ARCH} -O linux -T ramdisk -C $2 -n ${IMAGE_NAME} \
+    mkimage -A ${UBOOT_ARCH} -O linux -T ramdisk -C $2 -n ${IMAGE_BASENAME} \
         -a ${INITRD_IMAGE_LOADADDRESS} -e ${INITRD_IMAGE_ENTRYPOINT} \
         -d ${DEPLOY_DIR_IMAGE}/$1 ${DEPLOY_DIR_IMAGE}/$1.u-boot
 }
 
 INITRD_IMAGE_ENTRYPOINT ?= "0x40800000"
 INITRD_IMAGE_LOADADDRESS ?= "${INITRD_IMAGE_ENTRYPOINT}"
+INITRD_LINK_NAME = "${INITRD_IMAGE}-${MACHINE}${INITRAMFS_FSTYPE}"
 
 FLASH_IMAGE_NAME ?= "flash-${MACHINE}-${DATETIME}"
 FLASH_IMAGE_LINK ?= "flash-${MACHINE}"
 
 FLASH_UBOOT_OFFSET ?= "0"
 FLASH_KERNEL_OFFSET ?= "512"
-FLASH_ROOTFS_OFFSET ?= "3072"
+FLASH_INITRD_OFFSET ?= "3072"
+FLASH_ROFS_OFFSET ?= "4864"
+FLASH_RWFS_OFFSET ?= "28672"
+RWFS_SIZE ?= "4096"
 
-IMAGE_POSTPROCESS_COMMAND += "do_generate_flash"
+# $(( ${FLASH_SIZE} - ${FLASH_RWFS_OFFSET} ))
+
+# IMAGE_POSTPROCESS_COMMAND += "do_generate_flash"
 
 do_generate_flash() {
-       kernel="${DEPLOY_DIR_IMAGE}/${KERNEL_IMAGETYPE}"
-       uboot="${DEPLOY_DIR_IMAGE}/u-boot.${UBOOT_SUFFIX}"
-       rootfs="${DEPLOY_DIR_IMAGE}/${IMAGE_LINK_NAME}.cpio.${IMAGE_CTYPE}.u-boot"
-       if [ ! -f $kernel ]; then
-              bbfatal "Kernel file ${kernel} does not exist"
+       INITRD_CTYPE=${INITRAMFS_CTYPE}
+       ddir="${DEPLOY_DIR_IMAGE}"
+       kernel="${KERNEL_IMAGETYPE}"
+       uboot="u-boot.${UBOOT_SUFFIX}"
+       initrd="${INITRD_LINK_NAME}.cpio.${INITRD_CTYPE}"
+       uinitrd="${initrd}.u-boot"
+       rootfs="${IMAGE_LINK_NAME}.${IMAGE_BASETYPE}"
+       rwfs="rwfs.${OVERLAY_BASETYPE}"
+
+       if [ ! -f $ddir/$kernel ]; then
+              bbfatal "Kernel file ${ddir}/${kernel} does not exist"
        fi
-       if [ ! -f $uboot ]; then
-              bbfatal "U-boot file ${uboot} does not exist"
+       if [ ! -f $ddir/$uboot ]; then
+              bbfatal "U-boot file ${ddir}/${uboot} does not exist"
        fi
-       if [ ! -f $rootfs ]; then
-              bbfatal "Rootfs file ${rootfs} does not exist"
+       if [ ! -f $ddir/$initrd ]; then
+              bbfatal "initrd file ${ddir}/${initrd} does not exist"
        fi
+       if [ ! -f $ddir/$rootfs ]; then
+              bbfatal "Rootfs file ${ddir}/${rootfs} does not exist"
+       fi
+
+       oe_mkimage  "${initrd}" "${INITRD_CTYPE}" || bbfatal "oe_mkimage initrd"
+       dd if=/dev/zero of=${ddir}/${rwfs} bs=1k count=${RWFS_SIZE}
+       mkfs.${OVERLAY_BASETYPE} -b 4096 -F -O^huge_file ${ddir}/${rwfs} || bbfatal "mkfs rwfs"
 
-       dst="${DEPLOY_DIR_IMAGE}/${FLASH_IMAGE_NAME}"
+       dst="${ddir}/${FLASH_IMAGE_NAME}"
        rm -rf $dst
        dd if=/dev/zero of=${dst} bs=1k count=${FLASH_SIZE}
-       dd if=${uboot} of=${dst} bs=1k seek=${FLASH_UBOOT_OFFSET}
-       dd if=${kernel} of=${dst} bs=1k seek=${FLASH_KERNEL_OFFSET}
-       dd if=${rootfs} of=${dst} bs=1k seek=${FLASH_ROOTFS_OFFSET}
-       dstlink="${DEPLOY_DIR_IMAGE}/${FLASH_IMAGE_LINK}"
+       dd if=${ddir}/${uboot} of=${dst} bs=1k seek=${FLASH_UBOOT_OFFSET}
+       dd if=${ddir}/${kernel} of=${dst} bs=1k seek=${FLASH_KERNEL_OFFSET}
+       dd if=${ddir}/${uinitrd} of=${dst} bs=1k seek=${FLASH_INITRD_OFFSET}
+       dd if=${ddir}/${rootfs} of=${dst} bs=1k seek=${FLASH_ROFS_OFFSET}
+       dd if=${ddir}/${rwfs} of=${dst} bs=1k seek=${FLASH_RWFS_OFFSET}
+       dstlink="${ddir}/${FLASH_IMAGE_LINK}"
        rm -rf $dstlink
        ln -sf ${FLASH_IMAGE_NAME} $dstlink
 }
diff --git a/meta-phosphor/conf/distro/openbmc-phosphor.conf b/meta-phosphor/conf/distro/openbmc-phosphor.conf
index b59715d..418a98e 100644
--- a/meta-phosphor/conf/distro/openbmc-phosphor.conf
+++ b/meta-phosphor/conf/distro/openbmc-phosphor.conf
@@ -7,6 +7,7 @@ TARGET_VENDOR="-openbmc"
 
 GCCVERSION ?= "4.9.3"
 IMAGE_FSTYPES += "cpio.gz"
+IMAGE_FSTYPES += "squashfs-xz"
 IMAGE_LINGUAS = "en-us"
 
 VIRTUAL-RUNTIME_keymaps = ""
diff --git a/meta-phosphor/conf/machine/include/obmc-bsp-common.inc b/meta-phosphor/conf/machine/include/obmc-bsp-common.inc
index d7a681c..916fa48 100644
--- a/meta-phosphor/conf/machine/include/obmc-bsp-common.inc
+++ b/meta-phosphor/conf/machine/include/obmc-bsp-common.inc
@@ -13,6 +13,12 @@ UBOOT_SUFFIX ?= "bin"
 
 MACHINEOVERRIDES =. "openbmc:"
 
+IMAGE_FSTYPES += "overlay"
+
 IMAGE_CLASSES += "obmc-phosphor-image_types_uboot"
-IMAGE_CTYPE = "lzma"
-IMAGE_FSTYPES += "cpio.${IMAGE_CTYPE}.u-boot"
+IMAGE_CLASSES += "image-overlay"
+
+INITRAMFS_CTYPE ?= "lzma"
+INITRAMFS_FSTYPES += "cpio.${INITRAMFS_CTYPE}"
+
+
-- 
2.6.4

^ permalink raw reply related	[flat|nested] 16+ messages in thread

* Re: [PATCH openbmc 3/6] linux-obmc: apply the aspeed-spi-nor controller patchset
  2016-01-20 23:10 ` [PATCH openbmc 3/6] linux-obmc: apply the aspeed-spi-nor controller patchset OpenBMC Patches
@ 2016-01-21  5:40   ` Jeremy Kerr
  2016-01-21 16:06   ` Milton Miller II
  1 sibling, 0 replies; 16+ messages in thread
From: Jeremy Kerr @ 2016-01-21  5:40 UTC (permalink / raw)
  To: Benjamin Herrenschmidt, openbmc; +Cc: Milton D. Miller II

Hi Milton,

> Thie applies the apseed-spi-nor driver and patches the dts for
> palmetto and barreleye when building the linux image.  It also
> enables the config options for the driver and some file systems to
> support the overlay filesystem stack used by obmc-phosphor-initfs.
> 
> It also applies the rtc month fix patch.

OK, these should be separate.

However, I'd prefer we apply the patches directly to our kernel repo.
Can you post a patch for that, then this change should just be an
updated kernel reference.

Some minor comments on the kernel patch though:

> +diff --git a/drivers/mtd/spi-nor/aspeed-smc.c b/drivers/mtd/spi-nor/aspeed-smc.c
> +new file mode 100644
> +index 0000000..2497648
> +--- /dev/null
> ++++ b/drivers/mtd/spi-nor/aspeed-smc.c
> +@@ -0,0 +1,539 @@
> ++/* ASPEED Static Memory Controller driver
> ++ * Copyright 2015
> ++ * Milton Miller
> ++ *
> ++ */

Make sure you have the right copyright headers on this one.

> ++#define DEBUG

Remove on the final version; we have dynamic debug enabled in the
OpenBMC kernels.

> ++
> ++#include <linux/device.h>
> ++#include <linux/io.h>
> ++#include <linux/module.h>
> ++#include <linux/mutex.h>
> ++#include <linux/mtd/mtd.h>
> ++#include <linux/mtd/partitions.h>
> ++#include <linux/mtd/spi-nor.h>
> ++#include <linux/of.h>
> ++#include <linux/of_platform.h>
> ++#include <linux/sysfs.h>
> ++
> ++enum smc_controller_type {
> ++	smc_type_leg,		/* legacy register mode and map */
> ++	smc_type_fmc,		/* new FMC 5 CEs multiple flash types */
> ++	smc_type_smc,		/* SPI memory controller for BIOS / host */
> ++};
> ++
> ++enum smc_flash_type {
> ++	smc_type_nor = 0,	/* controller connected to nor flash */
> ++	smc_type_nand = 1,	/* controller connected to nand flash */
> ++	smc_type_spi = 2,	/* controller connected to spi flash */
> ++};
> ++
> ++struct aspeed_smc_info {
> ++	unsigned long nce : 3;		/* number of chip enables */
> ++	unsigned long hasdma : 1;	/* has dma engine */
> ++	unsigned long maxwidth : 3;	/* max width of spi bus */
> ++	unsigned long we0 : 5;		/* we shift for ce 0 in cfg reg */
> ++	unsigned long hastype : 1;	/* type shift for ce 0 in cfg reg */
> ++	u8 ctl0;			/* offset in regs of ctl for ce 0 */
> ++	u8 cfg;				/* offset in regs of cfg */
> ++	u8 time;			/* offset in regs of timing */
> ++};

I wouldn't worry about bitfields here.

> ++
> ++#define E(_ce, _dma, _w, _ctl, _cfg, _we0, _hastype, _time, _misc) \
> ++	.nce = _ce, .ctl0 = _ctl, .cfg = 0, .we0 = _we0, .hastype = _hastype, \
> ++	.hasdma = _dma, .maxwidth = _w, .time = _time
> ++
> ++struct aspeed_smc_info aspeed_table[] = {
> ++	[smc_type_fmc] = { E(5, 1, 4, 0x10, 0x00, 16, 1, 0x54, 0x50) },
> ++	[smc_type_smc] = { E(1, 0, 2, 0x04, 0x00, 0,  0, 0x14, 0x10) },
> ++};

And it'll be a little more readable to expand this:

struct aspeed_smc_info aspeed_table[] = {
	[smc_type_fmc] = {
		.nce = 5,
		.hasdma = 1,
		.maxwidth = 0x10,
		/* ... etc */
	},
};

> ++#if 0 /* ATTR */
> ++static u32 spi_control_to_freq_div(u32 control)
> ++{
> ++	u32 sel;
> ++
> ++	sel = control & CONTROL_SPI_CLOCK_FREQ_SEL_MASK;
> ++	sel >>= CONTROL_SPI_CLOCK_FREQ_SEL_SHIFT;
> ++
> ++	/* 16, 14, 12, 10, 8, 6, 4, 2, 15, 13, 11, 9, 7, 5, 3, 1 */
> ++	return 16 - (((sel & 7) << 1) + ((sel & 8) >> 1));
> ++}
> ++
> ++static u32 spi_control_to_dummy_bytes(u32 control)
> ++{
> ++
> ++	return ((control & CONTROL_SPI_IO_DUMMY_CYCLES_LO) >>
> ++			CONTROL_SPI_IO_DUMMY_CYCLES_LO_SHIFT) |
> ++		((control & CONTROL_SPI_IO_DUMMY_CYCLES_HI_SHIFT) >>
> ++			CONTROL_SPI_IO_DUMMY_CYCLES_HI_SHIFT);
> ++}
> ++
> ++static size_t show_ctl_div(u32 control, char *buf)
> ++{
> ++	return sprintf(buf, "%u\n", spi_control_to_freq_div(control));
> ++}
> ++
> ++static size_t show_ctl_dummy_bytes(u32 control, char *buf)
> ++{
> ++	return sprintf(buf, "%u\n", spi_control_to_dummy_bytes(control));
> ++}
> ++#endif /* ATTR */

There are a couple of `#if 0`-ed blocks in this patch. Was this just for
development, or something we want to keep?

> ++
> ++static int aspeed_smc_read_user(struct spi_nor *nor, loff_t from, size_t len,
> ++				size_t *retlen, u_char *read_buf)
> ++{
> ++	struct aspeed_smc_chip *chip = nor->priv;
> ++
> ++	aspeed_smc_start_user(nor);
> ++	aspeed_smc_send_cmd_addr(nor, nor->read_opcode, from);
> ++	memcpy_fromio(read_buf, chip->base, len);
> ++	*retlen += len;
> ++	aspeed_smc_stop_user(nor);
> ++
> ++	return 0;
> ++}
> ++
> ++static void aspeed_smc_write_user(struct spi_nor *nor, loff_t to, size_t len,
> ++				  size_t *retlen, const u_char *write_buf)
> ++{
> ++	struct aspeed_smc_chip *chip = nor->priv;
> ++
> ++	aspeed_smc_start_user(nor);
> ++	aspeed_smc_send_cmd_addr(nor, nor->program_opcode, to);
> ++	memcpy_toio(chip->base, write_buf, len);
> ++	*retlen += len;
> ++	aspeed_smc_stop_user(nor);
> ++}
> ++
> ++static int aspeed_smc_erase(struct spi_nor *nor, loff_t offs)
> ++{
> ++	aspeed_smc_start_user(nor);
> ++	aspeed_smc_send_cmd_addr(nor, nor->erase_opcode, offs);
> ++	aspeed_smc_stop_user(nor);
> ++
> ++	return 0;
> ++}
> ++
> ++static int aspeed_smc_remove(struct platform_device *dev)
> ++{
> ++	struct aspeed_smc_chip *chip;
> ++	struct aspeed_smc_controller *controller = platform_get_drvdata(dev);
> ++	int n;
> ++
> ++	for (n = 0; n < controller->info->nce; n++) {
> ++		chip = controller->chips[n];
> ++		if (chip)
> ++			mtd_device_unregister(&chip->mtd);
> ++	}
> ++
> ++	return 0;
> ++}
> ++
> ++const struct of_device_id aspeed_smc_matches[] = {
> ++	{ .compatible = "aspeed,fmc", .data = &aspeed_table[smc_type_fmc] },
> ++	{ .compatible = "aspeed,smc", .data = &aspeed_table[smc_type_smc] },
> ++	{ }
> ++};
> ++MODULE_DEVICE_TABLE(of, aspeed_smc_matches);

I'd suggest grouping this with the platform_device definition below.

But in general, all looks good to me. Ben - any thoughts about the
smc controller implementation?

Cheers,


Jeremy

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH openbmc 1/6] create obmc-phosphor-initfs
  2016-01-20 23:10 ` [PATCH openbmc 1/6] create obmc-phosphor-initfs OpenBMC Patches
@ 2016-01-21  6:10   ` Jeremy Kerr
  0 siblings, 0 replies; 16+ messages in thread
From: Jeremy Kerr @ 2016-01-21  6:10 UTC (permalink / raw)
  To: openbmc; +Cc: Milton D. Miller II

Hi Milton,

Looks good to me. One suggestion:


> +	echo Please mount the rw file system on $rwdir from this shell
> +	while ! sulogin && ! test -f /takeover
> +	do
> +		echo getty failed, retrying
> +	done

Can we make this message a little more descriptive? Something like:

cat <<EOF
Failed to mount read/write filesystem (mtdblock${rwfs#mtd})
Please manually mount it on $rwdir from this shell, or
exit the shell to continue without a rw filesystem.

EOF

> 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
> new file mode 100644
> index 0000000..85fd1e9
> --- /dev/null
> +++ b/meta-phosphor/common/recipes-phosphor/obmc-phosphor-initfs/files/obmc-shutdown.sh
> @@ -0,0 +1,55 @@

Just to clarify: this shutdown script is completely separate from the
update mechanism, right? In what situations do you see it being used?

Cheers,


Jeremy

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH openbmc 4/6] u-boot : switch to repro, add fw_env.config
  2016-01-20 23:10 ` [PATCH openbmc 4/6] u-boot : switch to repro, add fw_env.config OpenBMC Patches
@ 2016-01-21  6:14   ` Jeremy Kerr
  2016-01-21 23:17   ` Milton Miller II
  1 sibling, 0 replies; 16+ messages in thread
From: Jeremy Kerr @ 2016-01-21  6:14 UTC (permalink / raw)
  To: OpenBMC Patches, openbmc; +Cc: Milton D. Miller II

Hi Milton,

> +# SRCREV = "62c175fbb8a0f9a926c88294ea9f7e88eb898f6c"
> +SRCREV="${AUTOREV}"
> +

We should use a tag here. Just to confirm, you've tested against
c45e7515, right?

Or should we be using the v2013.07-aspeed-openbmc branch, currently at
e00b3cc6?	

Cheers,


Jeremy

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH openbmc 3/6] linux-obmc: apply the aspeed-spi-nor controller patchset
  2016-01-20 23:10 ` [PATCH openbmc 3/6] linux-obmc: apply the aspeed-spi-nor controller patchset OpenBMC Patches
  2016-01-21  5:40   ` Jeremy Kerr
@ 2016-01-21 16:06   ` Milton Miller II
  2016-01-25  1:08     ` Andrew Donnellan
  1 sibling, 1 reply; 16+ messages in thread
From: Milton Miller II @ 2016-01-21 16:06 UTC (permalink / raw)
  To: Jeremy Kerr; +Cc: Benjamin Herrenschmidt, openbmc


-----Jeremy Kerr <jk@ozlabs.org> wrote: -----
> On  01/20/2016 11:41PM, Milton Miller  wrote:
> 
> Hi Milton,
> 
>> Thie applies the apseed-spi-nor driver and patches the dts for
>> palmetto and barreleye when building the linux image.  It also
>> enables the config options for the driver and some file systems to
>> support the overlay filesystem stack used by obmc-phosphor-initfs.
>> 
>> It also applies the rtc month fix patch.
> 
> OK, these should be separate.
> 
> However, I'd prefer we apply the patches directly to our kernel repo.
> Can you post a patch for that, then this change should just be an
> updated kernel reference.

Actually both patches were submitted as separate pull requests to the
openbmc/linux repository.  I submitted them as patching via openbmc 
bitbake recipe to make it easier for others to test; it avoids 
having bitbake transfer a tarball for each new repository and me keeping
a merged branch with all the fixes.  Someday we can teach the git fetcher 
about reference repositories.

> 
> Some minor comments on the kernel patch though:
> 
>> +diff --git a/drivers/mtd/spi-nor/aspeed-smc.c b/drivers/mtd/spi-nor/aspeed-smc.c
>> +new file mode 100644
>> +index 0000000..2497648
>> +--- /dev/null
>> ++++ b/drivers/mtd/spi-nor/aspeed-smc.c
>> +@@ -0,0 +1,539 @@
>> ++/* ASPEED Static Memory Controller driver
>> >++ * Copyright 2015
>> ++ * Milton Miller
>> ++ *
>> ++ */
>
> Make sure you have the right copyright headers on this one.
 
This is a literal post of what I had submitted in 2015.  However I 
admit I am a noob at copyright headers and detailed advice will 
be gladly accepted.

>
>> ++#define DEBUG
> 
> Remove on the final version; we have dynamic debug enabled in the
> OpenBMC kernels.

Sure.

> 
>> ++
>> ++#include <linux/device.h>
>> ++#include <linux/io.h>
>> ++#include <linux/module.h>
>> ++#include <linux/mutex.h>
>> ++#include <linux/mtd/mtd.h>
>> ++#include <linux/mtd/partitions.h>
>> ++#include <linux/mtd/spi-nor.h>
>> ++#include <linux/of.h>
>> ++#include <linux/of_platform.h>
>> ++#include <linux/sysfs.h>
>> ++
>> ++enum smc_controller_type {
>> ++	smc_type_leg,		/* legacy register mode and map */
>> ++	smc_type_fmc,		/* new FMC 5 CEs multiple flash types */
>> ++	smc_type_smc,		/* SPI memory controller for BIOS / host */
>> ++};
>> ++
>> ++enum smc_flash_type {
>> ++	smc_type_nor = 0,	/* controller connected to nor flash */
>> ++	smc_type_nand = 1,	/* controller connected to nand flash */
>> ++	smc_type_spi = 2,	/* controller connected to spi flash */
>> ++};
>> ++
>> ++struct aspeed_smc_info {
>> ++	unsigned long nce : 3;		/* number of chip enables */
>> ++	unsigned long hasdma : 1;	/* has dma engine */
>> ++	unsigned long maxwidth : 3;	/* max width of spi bus */
>> ++	unsigned long we0 : 5;		/* we shift for ce 0 in cfg reg */
>> ++	unsigned long hastype : 1;	/* type shift for ce 0 in cfg reg */
>> ++	u8 ctl0;			/* offset in regs of ctl for ce 0 */
>> ++	u8 cfg;				/* offset in regs of cfg */
>> ++	u8 time;			/* offset in regs of timing */
>> ++};
>
> I wouldn't worry about bitfields here.

I can adapt.

> 
>> ++
>> ++#define E(_ce, _dma, _w, _ctl, _cfg, _we0, _hastype, _time, _misc) \
>> ++	.nce = _ce, .ctl0 = _ctl, .cfg = 0, .we0 = _we0, .hastype = _hastype, \
>> ++	.hasdma = _dma, .maxwidth = _w, .time = _time
>> ++
>> ++struct aspeed_smc_info aspeed_table[] = {
>> ++	[smc_type_fmc] = { E(5, 1, 4, 0x10, 0x00, 16, 1, 0x54, 0x50) },
>> ++	[smc_type_smc] = { E(1, 0, 2, 0x04, 0x00, 0,  0, 0x14, 0x10) },
>> ++};
> 
> And it'll be a little more readable to expand this:
> 
> struct aspeed_smc_info aspeed_table[] = {
> 	[smc_type_fmc] = {
> 		.nce = 5,
> 		.hasdma = 1,
> 		.maxwidth = 0x10,
> 		/* ... etc */
> 	},
> };

I think I'll go a step further, and make them separate structs, there
is not much in keeping them in an array.

> 
>> ++#if 0 /* ATTR */
>> ++static u32 spi_control_to_freq_div(u32 control)
>> ++{
>> ++	u32 sel;
>> ++
>> ++	sel = control & CONTROL_SPI_CLOCK_FREQ_SEL_MASK;
>> ++	sel >>= CONTROL_SPI_CLOCK_FREQ_SEL_SHIFT;
>> ++
>> ++	/* 16, 14, 12, 10, 8, 6, 4, 2, 15, 13, 11, 9, 7, 5, 3, 1 */
>> ++	return 16 - (((sel & 7) << 1) + ((sel & 8) >> 1));
>> ++}
>> ++
>> ++static u32 spi_control_to_dummy_bytes(u32 control)
>> ++{
>> ++
>> ++	return ((control & CONTROL_SPI_IO_DUMMY_CYCLES_LO) >>
>> ++			CONTROL_SPI_IO_DUMMY_CYCLES_LO_SHIFT) |
>> ++		((control & CONTROL_SPI_IO_DUMMY_CYCLES_HI_SHIFT) >>
>> ++			CONTROL_SPI_IO_DUMMY_CYCLES_HI_SHIFT);
>> ++}
>> ++
>> ++static size_t show_ctl_div(u32 control, char *buf)
>> ++{
>> ++	return sprintf(buf, "%u\n", spi_control_to_freq_div(control));
>> ++}
>> ++
>> ++static size_t show_ctl_dummy_bytes(u32 control, char *buf)
>> ++{
>> ++	return sprintf(buf, "%u\n", spi_control_to_dummy_bytes(control));
>> ++}
>> ++#endif /* ATTR */
> 
> There are a couple of `#if 0`-ed blocks in this patch. Was this just for
> development, or something we want to keep?

Actually I wrote them and made them compile except for the unused static 
function warning.  I intended to hook them up at least to debugfs but 
have not yet written that code.  I think they will be useful when developing 
the code to tune the transfer speeds.

So with that background, should I remove it or wait until we have done the 
next phase of tuning?


There are also a couple of functions that use more of the hardware to handle
sending the address, which should reduce the overhead.  I chose to wait to
test those until the base access was known to work.

[snip]

>> ++
>> ++const struct of_device_id aspeed_smc_matches[] = {
>> ++	{ .compatible = "aspeed,fmc", .data = &aspeed_table[smc_type_fmc] },
>> ++	{ .compatible = "aspeed,smc", .data = &aspeed_table[smc_type_smc] },
>> ++	{ }
>> ++};
>> ++MODULE_DEVICE_TABLE(of, aspeed_smc_matches);
> 
> I'd suggest grouping this with the platform_device definition below.

I put it before probe() to allow the  table to be matched to retrieve
the data pointer.  Moving it next to the the platform_driver struct 
would require a forward declaration of either the match table or the 
probe function.

> 
> But in general, all looks good to me. Ben - any thoughts about the
> smc controller implementation?
> 
> Cheers,
> Jeremy

milton

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH openbmc 4/6] u-boot : switch to repro, add fw_env.config
  2016-01-20 23:10 ` [PATCH openbmc 4/6] u-boot : switch to repro, add fw_env.config OpenBMC Patches
  2016-01-21  6:14   ` Jeremy Kerr
@ 2016-01-21 23:17   ` Milton Miller II
  1 sibling, 0 replies; 16+ messages in thread
From: Milton Miller II @ 2016-01-21 23:17 UTC (permalink / raw)
  To: Jeremy Kerr; +Cc: OpenBMC Patches, openbmc



-----Jeremy Kerr <jk@ozlabs.org> wrote: -----
>> +# SRCREV = "62c175fbb8a0f9a926c88294ea9f7e88eb898f6c"
>> +SRCREV="${AUTOREV}"
>> +
>
> We should use a tag here. Just to confirm, you've tested against
> c45e7515, right?

no

> Or should we be using the v2013.07-aspeed-openbmc branch, currently at
> e00b3cc6?	


It was e00b3cc6 see:

+UBRANCH = "v2013.07-aspeed-openbmc"
+SRC_URI = "git://git@github.com/openbmc/u-boot.git;branch=${UBRANCH};protocol=https"

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH openbmc 0/6] Persistent 1
  2016-01-20 23:10 [PATCH openbmc 0/6] Persistent 1 OpenBMC Patches
                   ` (5 preceding siblings ...)
  2016-01-20 23:10 ` [PATCH openbmc 6/6] phosphor: Create image class image-overlay and move phosphor to use it OpenBMC Patches
@ 2016-01-22  2:16 ` Stewart Smith
  6 siblings, 0 replies; 16+ messages in thread
From: Stewart Smith @ 2016-01-22  2:16 UTC (permalink / raw)
  To: OpenBMC Patches, openbmc

OpenBMC Patches <openbmc-patches@stwcx.xyz> writes:
> The openbmc-phosphor include has been updated to build two
> file systems: an initramfs packaged into an initrd for
> setting up the root file system, and a read-only squashfs
> with xz compression to hold the main data.  The final 4MB
> of the 32MB flash is used to hold a read/write overlay over
> the squashfs maintaining updates for any files changed
> that are not mounted in a tmpfs directory.

<snip>

> The first-boot is triggering systemd-update-hwdb.service which is trying
> to recreate a 60MB file in our 4MB file system.  It obviously fails, but
> it also sometimes times out and causes the ttyS4.device and ttyS0.device
> files that are trying to run concurrently to also fail.   This causes the
> console getty to not be started.  If this occurs you can login over the
> network if you had previously setup systemd (or set ip= in bootargs from
> u-boot), otherwise you will need to reboot then address the unclean ext4
> fsck issue above.

While this probably isn't a too bad stop-gap measure, fundamentally,
it's probably better to have all persistent data in a specfiic
mountpoint so that the BMC stack itself can be near impossible to modify
(err... backdoor) at runtime.

With a persistent overlay, it makes it much easier to persistently
backdoor the BMC (which isn't ideal).

Do we have a plan to head towards something like:
- root on dm_verify
- root mounted ro
- strong, enforcing SELinux
- all persistent data on /data or somewhere, no exec, and all that jazz

?

-- 
Stewart Smith
OPAL Architect, IBM.

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH openbmc 6/6] phosphor: Create image class image-overlay and move phosphor to use it
  2016-01-20 23:10 ` [PATCH openbmc 6/6] phosphor: Create image class image-overlay and move phosphor to use it OpenBMC Patches
@ 2016-01-25  0:22   ` Andrew Jeffery
  0 siblings, 0 replies; 16+ messages in thread
From: Andrew Jeffery @ 2016-01-25  0:22 UTC (permalink / raw)
  To: OpenBMC Patches, openbmc

Hi Milton,

On Wed, 2016-01-20 at 17:10 -0600, OpenBMC Patches wrote:
> From: "Milton D. Miller II" <miltonm@us.ibm.com>
> 
> This commit creates a new class image-overlay based on how the
> image-live class is structured.  It takes parameters for the base
> and overlayed file system types but the initfs only support ext4
> over squashfs presently.
> 
> It then moves invoking the generation of the flash image from a
> post image creation command to a seperate

typo: separate

>  task invoked from the
> overlay image so that building the initramfs image by itself does
> not try to create
> a flash image.
> ---
>  meta-phosphor/classes/image-overlay.bbclass        | 18 +++++++
>  .../obmc-phosphor-image_types_uboot.bbclass        | 55 +++++++++++++++-------
>  meta-phosphor/conf/distro/openbmc-phosphor.conf    |  1 +
>  .../conf/machine/include/obmc-bsp-common.inc       | 10 +++-
>  4 files changed, 65 insertions(+), 19 deletions(-)
>  create mode 100644 meta-phosphor/classes/image-overlay.bbclass

*snip*

> diff --git a/meta-phosphor/classes/obmc-phosphor-image_types_uboot.bbclass b/meta-phosphor/classes/obmc-phosphor-image_types_uboot.bbclass
> index 835e890..14e9289 100644
> --- a/meta-phosphor/classes/obmc-phosphor-image_types_uboot.bbclass
> +++ b/meta-phosphor/classes/obmc-phosphor-image_types_uboot.bbclass
> @@ -4,44 +4,65 @@ inherit image_types_uboot
>  # the image load address and entry point. Override it here.
>  
>  oe_mkimage () {
> -    mkimage -A ${UBOOT_ARCH} -O linux -T ramdisk -C $2 -n ${IMAGE_NAME} \
> +    mkimage -A ${UBOOT_ARCH} -O linux -T ramdisk -C $2 -n ${IMAGE_BASENAME} \
>          -a ${INITRD_IMAGE_LOADADDRESS} -e ${INITRD_IMAGE_ENTRYPOINT} \
>          -d ${DEPLOY_DIR_IMAGE}/$1 ${DEPLOY_DIR_IMAGE}/$1.u-boot
>  }
>  
>  INITRD_IMAGE_ENTRYPOINT ?= "0x40800000"
>  INITRD_IMAGE_LOADADDRESS ?= "${INITRD_IMAGE_ENTRYPOINT}"
> +INITRD_LINK_NAME = "${INITRD_IMAGE}-${MACHINE}${INITRAMFS_FSTYPE}"
>  
>  FLASH_IMAGE_NAME ?= "flash-${MACHINE}-${DATETIME}"
>  FLASH_IMAGE_LINK ?= "flash-${MACHINE}"
>  
>  FLASH_UBOOT_OFFSET ?= "0"
>  FLASH_KERNEL_OFFSET ?= "512"
> -FLASH_ROOTFS_OFFSET ?= "3072"
> +FLASH_INITRD_OFFSET ?= "3072"
> +FLASH_ROFS_OFFSET ?= "4864"
> +FLASH_RWFS_OFFSET ?= "28672"
> +RWFS_SIZE ?= "4096"
>  
> -IMAGE_POSTPROCESS_COMMAND += "do_generate_flash"
> +# $(( ${FLASH_SIZE} - ${FLASH_RWFS_OFFSET} ))
> +
> +# IMAGE_POSTPROCESS_COMMAND += "do_generate_flash"
>  
>  do_generate_flash() {
> -       kernel="${DEPLOY_DIR_IMAGE}/${KERNEL_IMAGETYPE}"
> -       uboot="${DEPLOY_DIR_IMAGE}/u-boot.${UBOOT_SUFFIX}"
> -       rootfs="${DEPLOY_DIR_IMAGE}/${IMAGE_LINK_NAME}.cpio.${IMAGE_CTYPE}.u-boot"
> -       if [ ! -f $kernel ]; then
> -              bbfatal "Kernel file ${kernel} does not exist"
> +       INITRD_CTYPE=${INITRAMFS_CTYPE}
> +       ddir="${DEPLOY_DIR_IMAGE}"
> +       kernel="${KERNEL_IMAGETYPE}"
> +       uboot="u-boot.${UBOOT_SUFFIX}"
> +       initrd="${INITRD_LINK_NAME}.cpio.${INITRD_CTYPE}"
> +       uinitrd="${initrd}.u-boot"
> +       rootfs="${IMAGE_LINK_NAME}.${IMAGE_BASETYPE}"
> +       rwfs="rwfs.${OVERLAY_BASETYPE}"
> +
> +       if [ ! -f $ddir/$kernel ]; then
> +              bbfatal "Kernel file ${ddir}/${kernel} does not exist"
>         fi
> -       if [ ! -f $uboot ]; then
> -              bbfatal "U-boot file ${uboot} does not exist"
> +       if [ ! -f $ddir/$uboot ]; then
> +              bbfatal "U-boot file ${ddir}/${uboot} does not exist"
>         fi
> -       if [ ! -f $rootfs ]; then
> -              bbfatal "Rootfs file ${rootfs} does not exist"
> +       if [ ! -f $ddir/$initrd ]; then
> +              bbfatal "initrd file ${ddir}/${initrd} does not exist"
>         fi
> +       if [ ! -f $ddir/$rootfs ]; then
> +              bbfatal "Rootfs file ${ddir}/${rootfs} does not exist"
> +       fi
> +
> +       oe_mkimage  "${initrd}" "${INITRD_CTYPE}" || bbfatal "oe_mkimage initrd"
> +       dd if=/dev/zero of=${ddir}/${rwfs} bs=1k count=${RWFS_SIZE}
> +       mkfs.${OVERLAY_BASETYPE} -b 4096 -F -O^huge_file ${ddir}/${rwfs} || bbfatal "mkfs rwfs"
>  
> -       dst="${DEPLOY_DIR_IMAGE}/${FLASH_IMAGE_NAME}"
> +       dst="${ddir}/${FLASH_IMAGE_NAME}"
>         rm -rf $dst
>         dd if=/dev/zero of=${dst} bs=1k count=${FLASH_SIZE}
> -       dd if=${uboot} of=${dst} bs=1k seek=${FLASH_UBOOT_OFFSET}
> -       dd if=${kernel} of=${dst} bs=1k seek=${FLASH_KERNEL_OFFSET}
> -       dd if=${rootfs} of=${dst} bs=1k seek=${FLASH_ROOTFS_OFFSET}
> -       dstlink="${DEPLOY_DIR_IMAGE}/${FLASH_IMAGE_LINK}"
> +       dd if=${ddir}/${uboot} of=${dst} bs=1k seek=${FLASH_UBOOT_OFFSET}
> +       dd if=${ddir}/${kernel} of=${dst} bs=1k seek=${FLASH_KERNEL_OFFSET}
> +       dd if=${ddir}/${uinitrd} of=${dst} bs=1k seek=${FLASH_INITRD_OFFSET}
> +       dd if=${ddir}/${rootfs} of=${dst} bs=1k seek=${FLASH_ROFS_OFFSET}
> +       dd if=${ddir}/${rwfs} of=${dst} bs=1k seek=${FLASH_RWFS_OFFSET}

Might be worth checking that the sizes of the files we're copying into
the image don't exceed the difference between the next and current
offsets? Not that these tests were present previously, but AIUI some of
my test builds of your WIP branches truncated the initrd, and the image
wouldn't boot.

Andrew

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH openbmc 5/6] create u-boot-fw-utils for our u-boot version
  2016-01-20 23:10 ` [PATCH openbmc 5/6] create u-boot-fw-utils for our u-boot version OpenBMC Patches
@ 2016-01-25  0:42   ` Andrew Jeffery
  0 siblings, 0 replies; 16+ messages in thread
From: Andrew Jeffery @ 2016-01-25  0:42 UTC (permalink / raw)
  To: OpenBMC Patches, openbmc

Hi Milton

On Wed, 2016-01-20 at 17:10 -0600, OpenBMC Patches wrote:
> From: "Milton D. Miller II" <miltonm@us.ibm.com>
> 
> This commit creates a class and recipie based on the upstream 2015
> branch of u-boot and patches it with our fw_env.config.
> 
> Having these tools for the initfs will allow us to modify the u-boot
> enviornment to do things like boot from network for update and set the
> bmc mac addresses in the environment for u-boot and use by the kernel.
> 
> Unfornately its broken in that it produces a host binary instead of
> a target binary when building the base package.  I have not been able
> to resolve this despite several attempts.

Not sure what you tried, but maybe a hacky approach is to work around
the u-boot build system and set HOSTCC=$CC in the .bb? Would this have
any negative interactions with BBCLASSEXTEND="cross native"? 

> ---
>  .../u-boot/u-boot-fw-utils_2013.07%.bbappend       | 13 ++++++
>  .../recipes-bsp/u-boot/u-boot-fw-utils_2013.07.bb  | 52 ++++++++++++++++++++++
>  2 files changed, 65 insertions(+)
>  create mode 100644 meta-openbmc-bsp/meta-aspeed/meta-ast2400/recipes-bsp/u-boot/u-boot-fw-utils_2013.07%.bbappend
>  create mode 100644 meta-phosphor/common/recipes-bsp/u-boot/u-boot-fw-utils_2013.07.bb
> 
> diff --git a/meta-openbmc-bsp/meta-aspeed/meta-ast2400/recipes-bsp/u-boot/u-boot-fw-utils_2013.07%.bbappend b/meta-openbmc-bsp/meta-aspeed/meta-ast2400/recipes-bsp/u-boot/u-boot-fw-utils_2013.07%.bbappend
> new file mode 100644
> index 0000000..4020696
> --- /dev/null
> +++ b/meta-openbmc-bsp/meta-aspeed/meta-ast2400/recipes-bsp/u-boot/u-boot-fw-utils_2013.07%.bbappend
> @@ -0,0 +1,13 @@
> +FILESEXTRAPATHS_prepend := "${THISDIR}/files:"
> +
> +SRC_URI += "file://fw_env.config"
> +SRC_URI += "file://config.patch"
> +
> +do_install_append() {
> +    if [ -e ${WORKDIR}/fw_env.config ] ; then
> +        install -d ${D}${sysconfdir}
> +        install -m 644 ${WORKDIR}/fw_env.config ${D}${sysconfdir}/fw_env.config
> +    fi
> +}
> +
> +BBCLASSEXTEND += "native"
> 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
> new file mode 100644
> index 0000000..6f72945
> --- /dev/null
> +++ b/meta-phosphor/common/recipes-bsp/u-boot/u-boot-fw-utils_2013.07.bb
> @@ -0,0 +1,52 @@
> +SUMMARY = "U-Boot bootloader fw_printenv/setenv utilities"
> +SECTION = "bootloader"
> +DEPENDS = "mtd-utils"
> +
> +LICENSE = "GPLv2+"
> +LIC_FILES_CHKSUM = "file://COPYING;md5=1707d6db1d42237583f50183a5651ecb \
> +                    file://README;beginline=1;endline=22;md5=78b195c11cb6ef63e6985140db7d7bab"
> +
> +# 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 = "62c175fbb8a0f9a926c88294ea9f7e88eb898f6c"
> +SRCREV="${AUTOREV}"
> +
> +PV = "v2013.07+git${SRCPV}"
> +
> +UBRANCH = "v2013.07-aspeed-openbmc"
> +SRC_URI = "git://git@github.com/openbmc/u-boot.git;branch=${UBRANCH};protocol=https"
> +S = "${WORKDIR}/git"
> +
> +INSANE_SKIP_${PN} = "already-stripped"
> +EXTRA_OEMAKE_class-target = 'CROSS_COMPILE=${TARGET_PREFIX} CC="${CC} ${CFLAGS} ${LDFLAGS}" V=1'
> +EXTRA_OEMAKE_class-cross = 'ARCH=${TARGET_ARCH} CC="${CC} ${CFLAGS} ${LDFLAGS}" V=1'
> +
> +inherit uboot-config
> +
> +do_compile () {
> +> 	> oe_runmake ${UBOOT_MACHINE}
> +> 	> oe_runmake env
> +}
> +
> +do_install () {
> +> 	> install -d ${D}${base_sbindir}
> +> 	> install -d ${D}${sysconfdir}
> +> 	> install -m 755 ${S}/tools/env/fw_printenv ${D}${base_sbindir}/fw_printenv
> +> 	> install -m 755 ${S}/tools/env/fw_printenv ${D}${base_sbindir}/fw_setenv
> +> 	> install -m 0644 ${S}/tools/env/fw_env.config ${D}${sysconfdir}/fw_env.config
> +}
> +
> +do_install_class-cross () {
> +> 	> install -d ${D}${bindir_cross}
> +> 	> install -m 755 ${S}/tools/env/fw_printenv ${D}${bindir_cross}/fw_printenv
> +> 	> install -m 755 ${S}/tools/env/fw_printenv ${D}${bindir_cross}/fw_setenv
> +}
> +
> +SYSROOT_PREPROCESS_FUNCS_class-cross = "uboot_fw_utils_cross"
> +uboot_fw_utils_cross() {
> +> 	> sysroot_stage_dir ${D}${bindir_cross} ${SYSROOT_DESTDIR}${bindir_cross}
> +}
> +
> +PACKAGE_ARCH = "${MACHINE_ARCH}"
> +BBCLASSEXTEND = "cross native"

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH openbmc 3/6] linux-obmc: apply the aspeed-spi-nor controller patchset
  2016-01-21 16:06   ` Milton Miller II
@ 2016-01-25  1:08     ` Andrew Donnellan
  0 siblings, 0 replies; 16+ messages in thread
From: Andrew Donnellan @ 2016-01-25  1:08 UTC (permalink / raw)
  To: Milton Miller II, Jeremy Kerr; +Cc: openbmc

On 22/01/16 03:06, Milton Miller II wrote:
>>> +diff --git a/drivers/mtd/spi-nor/aspeed-smc.c b/drivers/mtd/spi-nor/aspeed-smc.c
>>> +new file mode 100644
>>> +index 0000000..2497648
>>> +--- /dev/null
>>> ++++ b/drivers/mtd/spi-nor/aspeed-smc.c
>>> +@@ -0,0 +1,539 @@
>>> ++/* ASPEED Static Memory Controller driver
>>>> ++ * Copyright 2015
>>> ++ * Milton Miller
>>> ++ *
>>> ++ */
>>
>> Make sure you have the right copyright headers on this one.
>
> This is a literal post of what I had submitted in 2015.  However I
> admit I am a noob at copyright headers and detailed advice will
> be gladly accepted.

My preferred copyright header for IBM kernel work is as follows:

/*
  * [Description of file]
  *
  * Copyright (C) [Years] IBM Corporation.
  * Author: [Name] <[User]@[Country].ibm.com>
  *
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License
  * as published by the Free Software Foundation; either version
  * 2 of the License, or (at your option) any later version.
  */


-- 
Andrew Donnellan              Software Engineer, OzLabs
andrew.donnellan@au1.ibm.com  Australia Development Lab, Canberra
+61 2 6201 8874 (work)        IBM Australia Limited

^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2016-01-25  1:10 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-01-20 23:10 [PATCH openbmc 0/6] Persistent 1 OpenBMC Patches
2016-01-20 23:10 ` [PATCH openbmc 1/6] create obmc-phosphor-initfs OpenBMC Patches
2016-01-21  6:10   ` Jeremy Kerr
2016-01-20 23:10 ` [PATCH openbmc 2/6] phosphor: modify use obmc-phosphor-initfs OpenBMC Patches
2016-01-20 23:10 ` [PATCH openbmc 3/6] linux-obmc: apply the aspeed-spi-nor controller patchset OpenBMC Patches
2016-01-21  5:40   ` Jeremy Kerr
2016-01-21 16:06   ` Milton Miller II
2016-01-25  1:08     ` Andrew Donnellan
2016-01-20 23:10 ` [PATCH openbmc 4/6] u-boot : switch to repro, add fw_env.config OpenBMC Patches
2016-01-21  6:14   ` Jeremy Kerr
2016-01-21 23:17   ` Milton Miller II
2016-01-20 23:10 ` [PATCH openbmc 5/6] create u-boot-fw-utils for our u-boot version OpenBMC Patches
2016-01-25  0:42   ` Andrew Jeffery
2016-01-20 23:10 ` [PATCH openbmc 6/6] phosphor: Create image class image-overlay and move phosphor to use it OpenBMC Patches
2016-01-25  0:22   ` Andrew Jeffery
2016-01-22  2:16 ` [PATCH openbmc 0/6] Persistent 1 Stewart Smith

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.