Hi RIch

Below are the necessary details of the system..

ls -l /boot/
total 10200
-rw-r--r-- 1 root root 5224765 Nov 22  2013 uImage
-rw-r--r-- 1 root root 5192861 Nov 22  2013 uImage.orig


ls -l /lib/modules/
total 4
drwxr-xr-x 3 ubuntu ubuntu 4096 Jun  3 07:21 3.8.13-rt9-QorIQ-SDK-V1.4

uname -a
Linux t4240-ubuntu1310 3.8.13-rt9-QorIQ-SDK-V1.4 #10 SMP Tue May 27 10:48:24 IST 2014 ppc64 ppc64 ppc64 GNU/Linux


Thanks


On Wed, Jun 4, 2014 at 1:04 PM, abhishek jain <ashujain9727@gmail.com> wrote:
Hi Rich

Kindly ignore my previos mail.
I have downloaded the latest version of supermin supermin-5.1.8 and have compiled it for powerpc.Moreover there was no need to patch the src/kernel.ml file as the changes were already implemented on the latest version.
But still when i run libguestfs-test-tool on powerpc ubuntu,I get the below logs..



libguestfs-test-tool
     ************************************************************
     *                    IMPORTANT NOTICE
     *
     * When reporting bugs, include the COMPLETE, UNEDITED
     * output below in your bug report.
     *
     ************************************************************
PATH=/bin:/sbin:/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/sbin:/usr/local/bin
SELinux: sh: getenforce: command not found
guestfs_get_append: (null)
guestfs_get_autosync: 1
guestfs_get_backend: direct
guestfs_get_backend_settings: []
guestfs_get_cachedir: /var/tmp
guestfs_get_direct: 0
guestfs_get_hv: /usr/bin/kvm
guestfs_get_memsize: 768
guestfs_get_network: 0
guestfs_get_path: /usr/local/lib/guestfs
guestfs_get_pgroup: 0
guestfs_get_program: libguestfs-test-tool
guestfs_get_recovery_proc: 1
guestfs_get_selinux: 0
guestfs_get_smp: 1
guestfs_get_tmpdir: /tmp
guestfs_get_trace: 0
guestfs_get_verbose: 1
host_cpu: powerpc64
Launching appliance, timeout set to 600 seconds.
libguestfs: launch: program=libguestfs-test-tool
libguestfs: launch: version=1.26.1
libguestfs: launch: backend registered: unix
libguestfs: launch: backend registered: uml
libguestfs: launch: backend registered: direct
libguestfs: launch: backend=direct
libguestfs: launch: tmpdir=/tmp/libguestfscCuR3p

libguestfs: launch: umask=0002
libguestfs: launch: euid=1000
libguestfs: [00000ms] begin building supermin appliance
libguestfs: [00000ms] run supermin
libguestfs: command: run: /usr/bin/supermin
libguestfs: command: run: \ --build
libguestfs: command: run: \ --verbose
libguestfs: command: run: \ --if-newer
libguestfs: command: run: \ --lock /var/tmp/.guestfs-1000/lock
libguestfs: command: run: \ --copy-kernel
libguestfs: command: run: \ -f ext2
libguestfs: command: run: \ --host-cpu powerpc64
libguestfs: command: run: \ /usr/local/lib/guestfs/supermin.d
libguestfs: command: run: \ -o /var/tmp/.guestfs-1000/appliance.d
supermin: version: 5.1.8

supermin: package handler: debian/dpkg
supermin: acquiring lock on /var/tmp/.guestfs-1000/lock
supermin: build: /usr/local/lib/guestfs/supermin.d
supermin: build: visiting /usr/local/lib/guestfs/supermin.d/base.tar.gz type gzip base image (tar)
supermin: build: visiting /usr/local/lib/guestfs/supermin.d/daemon.tar.gz type gzip base image (tar)
supermin: build: visiting /usr/local/lib/guestfs/supermin.d/excludefiles type uncompressed excludefiles
supermin: build: visiting /usr/local/lib/guestfs/supermin.d/hostfiles type uncompressed hostfiles
supermin: build: visiting /usr/local/lib/guestfs/supermin.d/init.tar.gz type gzip base image (tar)
supermin: build: visiting /usr/local/lib/guestfs/supermin.d/packages type uncompressed packages
supermin: build: visiting /usr/local/lib/guestfs/supermin.d/udev-rules.tar.gz type gzip base image (tar)
supermin: build: 121 packages, including dependencies
supermin: build: 7109 files
supermin: build: 7109 files, after removing unreadable files
supermin: build: 4939 files, after matching excludefiles
supermin: build: 4941 files, after adding hostfiles
supermin: build: 4944 files, after munging
supermin: failed to find a suitable kernel (host_cpu=powerpc64).

I looked for kernels in /boot and modules in /lib/modules.

If this is a Xen guest, and you only have Xen domU kernels
installed, try installing a fullvirt kernel (only for
supermin use, you shouldn't boot the Xen guest with it).
libguestfs: error: /usr/bin/supermin exited with error status 1, see debug messages above
libguestfs-test-tool: failed to launch appliance
libguestfs: closing guestfs handle 0x10016848 (state 0)
libguestfs: command: run: rm
libguestfs: command: run: \ -rf /tmp/libguestfscCuR3p

Please help me regarding this.

Thanks





On Wed, Jun 4, 2014 at 12:22 PM, abhishek jain <ashujain9727@gmail.com> wrote:
Hi Rich

I have installed supermin from source supermin_5.1.7.orig.tar.gz on powerpc and have applied the patch as reffered by you.Know I'm getting following error ..


libguestfs-test-tool
     ************************************************************
     *                    IMPORTANT NOTICE
     *
     * When reporting bugs, include the COMPLETE, UNEDITED
     * output below in your bug report.
     *
     ************************************************************
PATH=/bin:/sbin:/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/sbin:/usr/local/bin

SELinux: sh: getenforce: command not found
guestfs_get_append: (null)
guestfs_get_autosync: 1
guestfs_get_backend: direct
guestfs_get_backend_settings: []
guestfs_get_cachedir: /var/tmp
guestfs_get_direct: 0
guestfs_get_hv: /usr/bin/kvm
guestfs_get_memsize: 768
guestfs_get_network: 0
guestfs_get_path: /usr/local/lib/guestfs
guestfs_get_pgroup: 0
guestfs_get_program: libguestfs-test-tool
guestfs_get_recovery_proc: 1
guestfs_get_selinux: 0
guestfs_get_smp: 1
guestfs_get_tmpdir: /tmp
guestfs_get_trace: 0
guestfs_get_verbose: 1
host_cpu: powerpc64
Launching appliance, timeout set to 600 seconds.
libguestfs: launch: program=libguestfs-test-tool
libguestfs: launch: version=1.26.1
libguestfs: launch: backend registered: unix
libguestfs: launch: backend registered: uml
libguestfs: launch: backend registered: direct
libguestfs: launch: backend=direct
libguestfs: launch: tmpdir=/tmp/libguestfsJF3lvj

libguestfs: launch: umask=0002
libguestfs: launch: euid=1000
libguestfs: [00000ms] begin building supermin appliance
libguestfs: [00000ms] run supermin
libguestfs: command: run: /usr/bin/supermin
libguestfs: command: run: \ --build
libguestfs: command: run: \ --verbose
libguestfs: command: run: \ --if-newer
libguestfs: command: run: \ --lock /var/tmp/.guestfs-1000/lock
libguestfs: command: run: \ --copy-kernel
libguestfs: command: run: \ -f ext2
libguestfs: command: run: \ --host-cpu powerpc64
libguestfs: command: run: \ /usr/local/lib/guestfs/supermin.d
libguestfs: command: run: \ -o /var/tmp/.guestfs-1000/appliance.d
supermin: version: 5.1.7

supermin: package handler: debian/dpkg
supermin: acquiring lock on /var/tmp/.guestfs-1000/lock
supermin: build: /usr/local/lib/guestfs/supermin.d
supermin: build: visiting /usr/local/lib/guestfs/supermin.d/base.tar.gz type gzip base image (tar)
supermin: build: visiting /usr/local/lib/guestfs/supermin.d/daemon.tar.gz type gzip base image (tar)
supermin: build: visiting /usr/local/lib/guestfs/supermin.d/excludefiles type uncompressed excludefiles
supermin: build: visiting /usr/local/lib/guestfs/supermin.d/hostfiles type uncompressed hostfiles
supermin: build: visiting /usr/local/lib/guestfs/supermin.d/init.tar.gz type gzip base image (tar)
supermin: build: visiting /usr/local/lib/guestfs/supermin.d/packages type uncompressed packages
supermin: build: visiting /usr/local/lib/guestfs/supermin.d/udev-rules.tar.gz type gzip base image (tar)
supermin: build: 121 packages, including dependencies
supermin: build: 7109 files
supermin: build: 7109 files, after removing unreadable files
supermin: build: 4939 files, after matching excludefiles
supermin: build: 4941 files, after adding hostfiles
supermin: build: 4944 files, after munging
supermin: failed to find a suitable kernel (host_cpu=powerpc64).
I looked for kernels in /boot and modules in /lib/modules.

If this is a Xen guest, and you only have Xen domU kernels
installed, try installing a fullvirt kernel (only for
supermin use, you shouldn't boot the Xen guest with it).
libguestfs: error: /usr/bin/supermin exited with error status 1, see debug messages above
libguestfs-test-tool: failed to launch appliance
libguestfs: closing guestfs handle 0x10016848 (state 0)
libguestfs: command: run: rm
libguestfs: command: run: \ -rf /tmp/libguestfsJF3lvj

My kernel.ml file after applying the patch is as follows...

cat src/kernel.ml
(* supermin 5
 * Copyright (C) 2009-2014 Red Hat Inc.
 *
 * 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.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
 *)

open Unix
open Printf

open Utils
open Ext2fs
open Fnmatch

let patt_of_cpu host_cpu =
  let models =
    match host_cpu with
    | "mips" | "mips64" -> [host_cpu; "*-malta"]
    | "ppc" | "powerpc" | "powerpc64" -> ["ppc"; "powerpc"; "powerpc64"]
    | "sparc" | "sparc64" -> ["sparc"; "sparc64"]
    | "amd64" | "x86_64" -> ["amd64"; "x86_64"]
    | _ when host_cpu.[0] = 'i' && host_cpu.[2] = '8' && host_cpu.[3] = '6' -> ["?86"]
    | _ when String.length host_cpu >= 5 && String.sub host_cpu 0 5 = "armv7" ->  ["armmp"]
    | _ -> [host_cpu]
  in
  List.map (fun model -> sprintf "vmlinu?-*-%s" model) models

let rec build_kernel debug host_cpu dtb_wildcard copy_kernel kernel dtb =
  (* Locate the kernel. *)
  let kernel_name, kernel_version =
    find_kernel debug host_cpu copy_kernel kernel in

  (* If the user passed --dtb option, locate dtb. *)
  (match dtb_wildcard with
  | None -> ()
  | Some wildcard ->
    find_dtb debug copy_kernel kernel_name wildcard dtb
  );

  (* Get the kernel modules. *)
  let modpath = find_modpath debug kernel_version in

  if debug >= 1 then (
    printf "supermin: kernel: kernel_version %s\n" kernel_version;
    printf "supermin: kernel: modules %s\n%!" modpath;
  );

  (kernel_version, modpath)

and find_kernel debug host_cpu copy_kernel kernel =
  let kernel_file, kernel_name, kernel_version =
    try
      let kernel_env = getenv "SUPERMIN_KERNEL" in
      if debug >= 1 then
        printf "supermin: kernel: SUPERMIN_KERNEL environment variable %s\n%!"
          kernel_env;
      let kernel_version = get_kernel_version_from_file kernel_env in
      if debug >= 1 then
        printf "supermin: kernel: SUPERMIN_KERNEL version %s\n%!"
          kernel_version;
      let kernel_name = Filename.basename kernel_env in
      kernel_env, kernel_name, kernel_version
    with Not_found ->
      let is_powerpc =
        String.length host_cpu >= 3 &&
        host_cpu.[0] = 'a' && host_cpu.[1] = 'r' && host_cpu.[2] = 'm' in

      let all_files = Sys.readdir "/boot" in
      let all_files = Array.to_list all_files in

      (* In original: ls -1dvr /boot/vmlinuz-*.$arch* 2>/dev/null | grep -v xen *)
      let patterns = patt_of_cpu host_cpu in
      let files = kernel_filter patterns is_powerpc all_files in

      let files =
        if files <> [] then files
        else
          (* In original: ls -1dvr /boot/vmlinuz-* 2>/dev/null | grep -v xen *)
       kernel_filter ["vmlinu?-*"] is_powerpc all_files in

      if files = [] then no_kernels host_cpu;

      let files = List.sort (fun a b -> compare_version b a) files in
      let kernel_name = List.hd files in
      let kernel_version = get_kernel_version kernel_name in

      if debug >= 1 then
        printf "supermin: kernel: picked kernel %s\n%!" kernel_name;

      ("/boot" // kernel_name), kernel_name, kernel_version in

  copy_or_symlink_file copy_kernel kernel_file kernel;
  kernel_name, kernel_version

and kernel_filter patterns is_powerpc all_files =
  let files =
    List.filter
      (fun filename ->
         List.exists
           (fun patt -> fnmatch patt filename [FNM_NOESCAPE]) patterns
       ) all_files in
  let files =
    List.filter (fun filename -> find filename "xen" = -1) files in
  let files =
    if not is_powerpc then files
    else (
      List.filter (fun filename ->
        find filename "lpae" = -1 && find filename "tegra" = -1
      ) files
    ) in
  List.filter (fun filename -> has_modpath filename) files

and no_kernels host_cpu =
  eprintf "\
supermin: failed to find a suitable kernel (host_cpu=%s).

I looked for kernels in /boot and modules in /lib/modules.

If this is a Xen guest, and you only have Xen domU kernels
installed, try installing a fullvirt kernel (only for
supermin use, you shouldn't boot the Xen guest with it).\n"
     host_cpu;
  exit 1

and find_dtb debug copy_kernel kernel_name wildcard dtb =
  let dtb_file =
    try
      let dtb_file = getenv "SUPERMIN_DTB" in
      if debug >= 1 then
        printf "supermin: kernel: SUPERMIN_DTB environment variable = %s\n%!"
          dtb_file;
      dtb_file
    with Not_found ->
      (* Replace vmlinuz- with dtb- *)
      if not (string_prefix "vmlinuz-" kernel_name) &&
         not (string_prefix "vmlinuz-" kernel_name) then
         no_dtb_dir kernel_name;
      let dtb_dir =
    try
           List.find dir_exists (
             List.map (fun prefix ->
               prefix ^ String.sub kernel_name 8 (String.length kernel_name - 8)
             ) ["/boot/dtb-"; "/usr/lib/linux-image-"])
         with Not_found ->
           no_dtb_dir kernel_name; ""
       in


      let all_files = Sys.readdir dtb_dir in
      let all_files = Array.to_list all_files in

      let files =
        List.filter (fun filename -> fnmatch wildcard filename [FNM_NOESCAPE])
          all_files in
      if files = [] then
        no_dtb dtb_dir wildcard;

      let dtb_name = List.hd files in
      let dtb_file = dtb_dir // dtb_name in
      if debug >= 1 then
        printf "supermin: kernel: picked dtb %s\n%!" dtb_file;
      dtb_file in

  copy_or_symlink_file copy_kernel dtb_file dtb

and no_dtb_dir kernel_name =
  eprintf "\
supermin: failed to find a dtb (device tree) directory.

I expected to take '%s' and to
replace vmlinuz- with dtb- to form a directory.

You can set SUPERMIN_KERNEL, SUPERMIN_MODULES and SUPERMIN_DTB
to override automatic selection.  See supermin(1).\n"
    kernel_name;
  exit 1

and no_dtb dtb_dir wildcard =
  eprintf "\
supermin: failed to find a matching device tree.

I looked for a file matching '%s' in directory '%s'.

You can set SUPERMIN_KERNEL, SUPERMIN_MODULES and SUPERMIN_DTB
to override automatic selection.  See supermin(1).\n"
    wildcard dtb_dir;
  exit 1

and find_modpath debug kernel_version =
  try
    let modpath = getenv "SUPERMIN_MODULES" in
    if debug >= 1 then
      printf "supermin: kernel: SUPERMIN_MODULES environment variable = %s\n%!"
        modpath;
    modpath
  with Not_found ->
    let modpath = "/lib/modules/" ^ kernel_version in
    if debug >= 1 then
      printf "supermin: kernel: picked modules path %s\n%!" modpath;
    modpath

and has_modpath kernel_name =
  try
    let kv = get_kernel_version kernel_name in
    modules_dep_exists kv
  with
  | Not_found -> false

and get_kernel_version kernel_name =
  if (string_prefix "vmlinuz-" kernel_name) ||
     (string_prefix "vmlinux-" kernel_name) then (
    let kv = String.sub kernel_name 8 (String.length kernel_name - 8) in
    if modules_dep_exists kv then kv
    else get_kernel_version_from_name kernel_name
  ) else get_kernel_version_from_name kernel_name

and modules_dep_exists kv =
  try (lstat ("/lib/modules/" ^ kv ^ "/modules.dep")).st_kind = S_REG
  with Unix_error _ -> false

and get_kernel_version_from_name kernel_name =
  get_kernel_version_from_file ("/boot" // kernel_name)

(* Extract the kernel version from a Linux kernel file.
 *
 * Returns a string containing the version or [Not_found] if the
 * file can't be read, is not a Linux kernel, or the version can't
 * be found.
 *
 * See ftp://ftp.astron.com/pub/file/file-<ver>.tar.gz
 * (file-<ver>/magic/Magdir/linux) for the rules used to find the
 * version number:
 *   514             string  HdrS     Linux kernel
 *   >518            leshort >0x1ff
 *   >>(526.s+0x200) string  >\0      version %s,
 *
 * Bugs: probably limited to x86 kernels.
 *)
and get_kernel_version_from_file file =
  try
    let chan = open_in file in
    let buf = read_string chan 514 4 in
    if buf <> "HdrS" then (
      close_in chan;
      raise Not_found
    );
    let s = read_leshort chan 518 in
    if s < 0x1ff then (
      close_in chan;
      raise Not_found
    );
    let offset = read_leshort chan 526 in
    if offset < 0 then (
      close_in chan;
      raise Not_found
    );
    let buf = read_string chan (offset + 0x200) 132 in
    close_in chan;
    let rec loop i =
      if i < 132 then (
        if buf.[i] = '\000' || buf.[i] = ' ' ||
          buf.[i] = '\t' || buf.[i] = '\n' then
          String.sub buf 0 i
        else
          loop (i+1)
      )
      else raise Not_found
    in
    loop 0
  with
  | Sys_error _ -> raise Not_found
  | Invalid_argument _ -> raise Not_found

(* Read an unsigned little endian short at a specified offset in a file. *)
and read_leshort chan offset =
  let buf = read_string chan offset 2 in
  (Char.code buf.[1] lsl 8) lor Char.code buf.[0]

and read_string chan offset len =
  seek_in chan offset;
  let buf = String.create len in
  really_input chan buf 0 len;
  buf

and copy_or_symlink_file copy_kernel src dest =
  if not copy_kernel then
    symlink src dest
  else (
    let cmd = sprintf "cp -p %s %s" (quote src) (quote dest) in
    run_command cmd
  )

Please help me what I need to change in order to proceed .

Thanks for the support.


On Tue, Jun 3, 2014 at 8:07 PM, abhishek jain <ashujain9727@gmail.com> wrote:
Hi Rich

But there is no  src/kernel.ml  file on my ubuntu powerpc to which the above patch is reffering.
I have installed supermin as supermin_5.1.8-2_powerpc.deb debian package.

Thanks



On Tue, Jun 3, 2014 at 7:16 PM, Richard W.M. Jones <rjones@redhat.com> wrote:
On Tue, Jun 03, 2014 at 06:55:49PM +0530, abhishek jain wrote:
> supermin: failed to find a suitable kernel (host_cpu=powerpc64).
>
> I looked for kernels in /boot and modules in /lib/modules.
>
> If this is a Xen guest, and you only have Xen domU kernels
> installed, try installing a fullvirt kernel (only for
> supermin use, you shouldn't boot the Xen guest with it).
> libguestfs: error: /usr/bin/supermin exited with error status 1, see debug
> messages above
> libguestfs-test-tool: failed to launch appliance
> libguestfs: closing guestfs handle 0x10016848 (state 0)
> libguestfs: command: run: rm
> libguestfs: command: run: \ -rf /tmp/libguestfsbnHqnU

This seems to be the same error as before:

https://www.redhat.com/archives/libguestfs/2014-May/msg00138.html

Rich.

--
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
Fedora Windows cross-compiler. Compile Windows programs, test, and
build Windows installers. Over 100 libraries supported.
http://fedoraproject.org/wiki/MinGW