1. 08 Mar, 2016 3 commits
  2. 07 Mar, 2016 19 commits
    • Milton D. Miller II's avatar
      init: Increase fidelity of u-boot environment parsing · a81cb930
      Milton D. Miller II authored
      Deleting a variable with a long value exposed a duplicate
      openbmcinitdownloadurl variable resulting in two lines in the
      url file, and wget was not happy.
      
      The u-boot environment ends with a double NUL character like
      many operating environments.  Using strings to separate on the
      NUL bytes was loosing this information.
      
      The fw_printenv command does not clear the remainder of the
      environment when deleting variables.  Instead it just makes sure
      it is terminated with a double NUL byte.
      
      Switch from strings to tr to separate the strings.  Translate NL
      to CR to avoid false matches, and use sed to detect a blank line.
      Also use tail to skip over the CRC bytes.  We don't have the
      config file to know if a flag exists so assume 1 copy for now.
      Signed-off-by: default avatarMilton Miller <miltonm@us.ibm.com>
      a81cb930
    • nkskjames's avatar
      Merge pull request #204 from anoo1/uboot · f719e1b3
      nkskjames authored
      Use commit number instead of autorev for u-boot
      f719e1b3
    • Milton D. Miller II's avatar
      host-ipmid: OEM command will require clear-once service · b8c5174d
      Milton D. Miller II authored
      Tell systemd the host-ipmid service wants the clear-once service
      to be started, and that it wants to run after the clear-once
      service.
      
      The new OEM command will use the openbmc init run once variables
      set in the u-boot environment.  We want the u-boot variable
      cleared before the host can request it be set again.
      
      Tell bitbake to require the clean-once package.
      Signed-off-by: default avatarMilton Miller <miltonm@us.ibm.com>
      b8c5174d
    • Milton D. Miller II's avatar
      Add clear-once service · 32906e30
      Milton D. Miller II authored
      Create a service unit to clear the openbmconce variable in the
      the u-boot environment with fw_setenv.
      
      Set the timeout to allow the flash to be written, even though we
      currently just update the ram shadow file.
      Signed-off-by: default avatarMilton Miller <miltonm@us.ibm.com>
      32906e30
    • Milton D. Miller II's avatar
      initfs: Install option and download files if they exist · 0111a487
      Milton D. Miller II authored
      Install the init-option and init-download-url if they exist in
      the build directory.
      
      This change to the bitbake recipe allows an override layer to
      simply add these files to the SRC_URI variable and then have them
      appear in the initramfs.
      Signed-off-by: default avatarMilton Miller <miltonm@us.ibm.com>
      0111a487
    • Milton D. Miller II's avatar
      init: Add a hook to download files · 71e7ec14
      Milton D. Miller II authored
      Add a hook to download a read-only file system image file from
      a URL using TFTP, HTTP, or FTP.  The URL is retrieved from a
      u-boot environment variable unless the file is already in the
      initramfs image.  Only execute this command if the previously
      established options file has a keyword trigger.  Do not even
      consider the option if a build option flag is not set to y,
      and allow each protocol to be disabled by simiar build options.
      
      This allows one to specify at u-boot commands that would download
      a read-only file system into memory for execution this boot instead
      of needing to create a custom initramfs to netboot or specifying
      debug-init-sh, entering the password, and doing the download from
      the shell.
      
      Note: Access to set u-boot environment variables implys the
      ability to replace the kernel and initramfs session.  Access to
      the variables and the serial console likely gives full root access
      to the system at this time.  The existing shutdown and update
      scripts have paths that expose a root shell to the serial port
      without a prior password challenge.
      Signed-off-by: default avatarMilton Miller <miltonm@us.ibm.com>
      71e7ec14
    • Milton D. Miller II's avatar
      init: Allow options to be fixed at build time · 6d854315
      Milton D. Miller II authored
      If the file /init-options exists copy it to the runtime location
      /run/initramfs/init-options.
      
      This allows an initramfs image to be built that will not parse
      any u-boot or command line variables by adding a file into the
      the image.  This can be done either through a recipe overlay or
      additonal package today and could also be a cpio merged into the
      initrd in the future.
      Signed-off-by: default avatarMilton Miller <miltonm@us.ibm.com>
      6d854315
    • Milton D. Miller II's avatar
      init: Look for options in u-boot environment · ab618364
      Milton D. Miller II authored
      Look in the saved u-boot environment for init options in addition
      to the kernel command line.  This allows setting options to run
      in the u-boot environment instead of setting bootargs.
      
      Look at specific variables but not the whole environment so that
      users can setup variable to run.  Look at two variables so scripts
      can automatically clear one on successful boot as one-time options
      (defer that to the full filesystem).
      
      Instead of having the full fw_setenv / fw_getenv binaries which
      would overflow the existing space for the initramfs, just use the
      busybox strings command to extract the variables.  The oldest
      variable might get a crc32 character or flag byte if redundant
      environment were configured for nand but that is not expected
      to be these user defined variables.
      
      [1] The environment consists of a crc32, a flag byte if a
      redundant environment is configured, then a series of var=value
      strings separated by NUL bytes.  The flag byte is 1 (active) or 0
      (obsolete) for NOR flash, or a counter 0-255 in nand, the flag
      byte cycles through 0-255.
      Signed-off-by: default avatarMilton Miller <miltonm@us.ibm.com>
      ab618364
    • Milton D. Miller II's avatar
      init: Add option to copy files into memory · 77be704a
      Milton D. Miller II authored
      Add an option to copy files from the rwfs to ram then run in ram.
      
      This allows customizations like user ids and network settings to
      be initialized from the read-write filesystem.
      Signed-off-by: default avatarMilton Miller <miltonm@us.ibm.com>
      77be704a
    • Milton D. Miller II's avatar
      init: Call update from initramfs directory · 383bfc7b
      Milton D. Miller II authored
      Use the copy in /run/initramfs/update to call update to be consistent
      with other uses.
      Signed-off-by: default avatarMilton Miller <miltonm@us.ibm.com>
      383bfc7b
    • Milton D. Miller II's avatar
      init: Be explicit about saving and restoring files. · 2f3b0a4d
      Milton D. Miller II authored
      When calling update for save and restore phases be explicitly tell
      update to clean saved files when we are done and not bother trying
      to save or restore when we know we will do a split save, erase, and
      restore sequence.
      Signed-off-by: default avatarMilton Miller <miltonm@us.ibm.com>
      2f3b0a4d
    • Milton D. Miller II's avatar
      init: Add option to copy base read-only filesystem into RAM · 9ecec171
      Milton D. Miller II authored
      If copy-base-filesystem-to-ram is found copy the read-only
      filesystem source device to /run/image-rofs.  If the copy fails
      then remove the partial copy and invoke debug takeover.
      
      This will allow a new image to be downloaded and flashed while
      running from the existing copy for the duration of this boot.
      
      Alternatively with the overlay also in RAM pflash could be used
      to update the flash from the host as the BMC would no longer need
      the flash or flash controller.
      Signed-off-by: default avatarMilton Miller <miltonm@us.ibm.com>
      9ecec171
    • Milton D. Miller II's avatar
      init: Add option to run with writable overlay in RAM · 5d772b03
      Milton D. Miller II authored
      If overlay-filesystem-in-ram is found set rwfst=none suppressing
      the rwfs mount.
      Signed-off-by: default avatarMilton Miller <miltonm@us.ibm.com>
      5d772b03
    • Adriana Kobylak's avatar
      Use commit number instead of autorev for u-boot · ab4b8c83
      Adriana Kobylak authored
      Change the u-boot recipes from picking up the most recent
      commit to a specific commit (the most current one a of today)
      so that development can be done in u-boot without affecting the
      stability of the image.
      ab4b8c83
    • nkskjames's avatar
      Merge pull request #199 from anoo1/inarp · b182f7b0
      nkskjames authored
      Add inarp to base image
      b182f7b0
    • nkskjames's avatar
      Merge pull request #198 from jk-ozlabs/inarp · d7afe61d
      nkskjames authored
      inarp: Add inverse ARP daemon
      d7afe61d
    • nkskjames's avatar
      Merge pull request #181 from adamliyi/adm1278 · 27fece87
      nkskjames authored
      Add temporary adm1278 hwmon pmbus driver patch
      27fece87
    • nkskjames's avatar
      Merge pull request #201 from nkskjames/tag6 · 9f9413bb
      nkskjames authored
      Move up skeleton and host-ipmid to latest
      9f9413bb
    • Norman James's avatar
      Move up skeleton and host-ipmid to latest · d7a6c4bc
      Norman James authored
      Fixes memory leaks and watchdog timer issues
      Signed-off-by: default avatarNorman James <nkskjames@gmail.com>
      d7a6c4bc
  3. 04 Mar, 2016 18 commits
    • Adriana Kobylak's avatar
      Add inarp to base image · 31257d02
      Adriana Kobylak authored
      Add the inarp package to the base image. If users later want
      to turn it off and not have it be part of the base image,
      it can be changed to a distro spec then.
      31257d02
    • Milton D. Miller II's avatar
      init: Always move images from root · 21786ff0
      Milton D. Miller II authored
      If images are to be updated before init continue to move them
      to /run/initramfs.  However, if they are not to be flashed before
      init instead move them to /run.
      
      This will result in the image-rofs being loop mounted for this run,
      and all images will be available at runtime for flash update at
      runtime.
      Signed-off-by: default avatarMilton Miller <miltonm@us.ibm.com>
      21786ff0
    • Milton D. Miller II's avatar
      init: Run from RAM if file system type is specified as none · ed3680d0
      Milton D. Miller II authored
      Allow file system type none for rwfst, which means do not mount a
      separate file system but just use the directory in the tmpfs /run.
      
      This will be used to allow the flash controller to not be used by
      the running image, allowing flash updates while the BMC is running
      the main application.
      
      It could also be used for a file system less prone to corruption
      where the read-write overlay is only updated with whitelisted files
      at specific points in time with updates to the update script.
      Signed-off-by: default avatarMilton Miller <miltonm@us.ibm.com>
      ed3680d0
    • Milton D. Miller II's avatar
      init: Suppress fsck command not present error by file system type · 03fea6ca
      Milton D. Miller II authored
      Decide lack of fsck is not a problem by the type of the rwfs image
      instead of the full name of the fsck command.  This eliminates
      duplicates knowledge of how the fsck path is formed.
      Suggested-by: Andrew Jeffery's avatarAndrew Jeffery <andrew@aj.id.au>
      Signed-off-by: default avatarMilton Miller <miltonm@us.ibm.com>
      03fea6ca
    • Milton D. Miller II's avatar
      init: Use image of read only file system in RAM if present · a8f26b67
      Milton D. Miller II authored
      If a read-only file system image is in /run, specifically
      /run/image-rofs, then mount it instead of the mtd partition.
      
      This will allow running from ram to allow the flash to be updated,
      either from a downloaded image, a packaged image, or an image
      copied at boot.
      Signed-off-by: default avatarMilton Miller <miltonm@us.ibm.com>
      a8f26b67
    • Milton D. Miller II's avatar
      init: Read options from a file · 90b68474
      Milton D. Miller II authored
      Grep options from a file instead of directly from /proc/cmdline
      which will allow additonal sources for options.
      
      Initially the options file is just a copy of the kernel command
      line, but it may be edited at debug-init-sh or via a later
      debug_takeover point or before restarting init.
      Signed-off-by: default avatarMilton Miller <miltonm@us.ibm.com>
      90b68474
    • Milton D. Miller II's avatar
      update: Skip calling flashcp for empty files · 5d187bfa
      Milton D. Miller II authored
      Note explicitly when an empty image is provided that will not
      alter a flash partition.
      
      While using flashcp on an empty file succeeds and does not alter
      the flash, it may be confusing to see 0/0 messages for the erase,
      write, and verify phases.
      
      These empty files are used to trigger the save and restore phases
      and may also be used by developers to cause the update to fail
      and break into a shell at shutdown for maintence.
      Signed-off-by: default avatarMilton Miller <miltonm@us.ibm.com>
      5d187bfa
    • Milton D. Miller II's avatar
      update: Remove images as they are successfully flashed · ec10f89d
      Milton D. Miller II authored
      Remove image files as they are flashed so a repeated call to
      update does not erase and write the image again.
      
      As we add the ability to call update at runtime repeated calls
      are expected.  This both signals successful copy and removes the
      need for callers to cleanup.
      
      Also remove commented alternate flash method using eraseall
      that was not tested.
      Signed-off-by: default avatarMilton Miller <miltonm@us.ibm.com>
      ec10f89d
    • Milton D. Miller II's avatar
      update: Add option to copy files to runtime cow directory · 7141eb03
      Milton D. Miller II authored
      Add an option to copy files to the runtime copy-on-write upper
      directory from the saved directory to allow init to request the
      files for use without knowing the saved files directory.
      
      This will be used to initialize the cow directory from the
      persistent rwfs file system when choosing to run in RAM.
      Signed-off-by: default avatarMilton Miller <miltonm@us.ibm.com>
      7141eb03
    • Milton D. Miller II's avatar
      update: Save whitelist files from RAM or mounted read-write filesystem · a987d621
      Milton D. Miller II authored
      Skip mounting and unmounting the read-write file system when
      saving files if the upper directory exists.  Instead interpret
      this as a sign the system either is or was running from RAM (or
      from some future alternative and maybe temporary mounted file
      system) and save the files from that upper directory.
      
      It is possible some other filesystem is mounted on the read-write
      mountpoint that is not a mtd device, either a tmpfs or some
      other future media, so only try to unmount the file system if
      this update script mounted it.
      
      Each boot an empty /run filesytem is created and populated by init
      with selected directories and mount points for the read-only and
      read-write file systems and mounts them on these points.
      
      The upper directory is under the read-write mount point, so if it
      exists then either a file system is mounted there or the system
      was prepared to run from RAM using the run tmpfs file system and
      updates may have been made there.  In either case the files to
      be saved exist in that directory.
      
      Background on overlayfs:
      
      The upper directory contains files and directory entries that were
      either opened for write or had meta data changed.  Before this
      happens the overlayfs copies each file or directory by name into
      the work directory then atomically moves it into the corresponding
      upper directory.
      
      To form a read-write overlayfs mount, the upper directory must be,
      by definition, in a read-write file system along with the work
      directory, and both are required to be in the same filesystem.
      Signed-off-by: default avatarMilton Miller <miltonm@us.ibm.com>
      a987d621
    • Milton D. Miller II's avatar
      update: Save files using the same mount path as init · c3697de0
      Milton D. Miller II authored
      Use the full /run/initramfs/rw path for the mount point of the
      read-write filesystem.
      
      This prevents creating and directories in / when it is invoked
      before shutdown.
      Signed-off-by: default avatarMilton Miller <miltonm@us.ibm.com>
      c3697de0
    • Milton D. Miller II's avatar
      update: Make cow directory before restoring saved files. · ba2b7c9f
      Milton D. Miller II authored
      This will ensure the cp command always writes to an existing
      directory but will also make any future component directories if
      the upper directory is later moved from the root of the filesystem.
      Signed-off-by: default avatarMilton Miller <miltonm@us.ibm.com>
      ba2b7c9f
    • Milton D. Miller II's avatar
      update: Restore files via an alternate mount directory · facb7186
      Milton D. Miller II authored
      This will allow us to restore or check-point the whitelisted files
      to the read-write filesystem device without causing confusion by
      mounting over the upperdir location while at runtime.
      Signed-off-by: default avatarMilton Miller <miltonm@us.ibm.com>
      facb7186
    • Milton D. Miller II's avatar
      update: Save files in run filesystem · fa8316d9
      Milton D. Miller II authored
      Instead of in saving files in root which is messy and logically
      part of the cow space, save the files in a directory under /run
      which will be mounted during init, runtime, and shutdown.
      Signed-off-by: default avatarMilton Miller <miltonm@us.ibm.com>
      fa8316d9
    • Milton D. Miller II's avatar
      update: Read whitelist from the /run/initramfs directory · ee91f8da
      Milton D. Miller II authored
      Find the whitelist under /run/initramfs directory instead of
      looking in root directory.  This results in the whitelist always
      existing and being the same instance (copy) in all environments.
      
      Currently the update script is invoked from two places: from
      shutdown, where systemd bind-mounted the initramfs directory on
      itself and made it root (with its parent /run mounted underneath
      it in a twist), and from the initramfs init script where it
      copied the files from its root directory into the /run/initramfs
      directory for use at shutdown time when the original rootfs is
      no longer reachable.
      
      By looking under /run/initramfs we will always look at one copy
      of the whitelist.  This will also allow future modes where the
      update script can be invoked while running from a copies of
      the file systems located in RAM.
      Signed-off-by: default avatarMilton Miller <miltonm@us.ibm.com>
      ee91f8da
    • Milton D. Miller II's avatar
      update: Do not check if the whitelist is empty · 517f9d7f
      Milton D. Miller II authored
      Let the copy loop execute zero times instead of checking if
      the whitelist is empty.
      
      Suppressing the mount and copying the files can be achieved via
      command line options.  This removes a condition and prepares for
      splitting the whitelist into component files with support for
      commented out lines.
      Signed-off-by: default avatarMilton Miller <miltonm@us.ibm.com>
      517f9d7f
    • Milton D. Miller II's avatar
      update: Add options to skip the save and restore phases · ecf68d58
      Milton D. Miller II authored
      Allow the save and/or restore of whitelisted files to be
      suppressed.
      
      This reduces the noise and possible problems trying to mount the
      read-write filesystem read-write when its dirty.  The filesystem
      may be cleaned or repaired between the backup and restore.
      Signed-off-by: default avatarMilton Miller <miltonm@us.ibm.com>
      ecf68d58
    • Jeremy Kerr's avatar
      inarp: Add inverse ARP daemon · 97b94154
      Jeremy Kerr authored
      This change adds 'inarp': A small daemon to listen for, and reply to
      inverse ARP requests.
      
      This should be started at system init time, so we add a .service file.
      Signed-off-by: default avatarJeremy Kerr <jk@ozlabs.org>
      97b94154