summaryrefslogtreecommitdiffstats
path: root/post/lib_powerpc/srawi.c
diff options
context:
space:
mode:
authorDennis Gilmore <dennis@ausil.us>2014-10-27 21:38:32 -0500
committerDennis Gilmore <dennis@ausil.us>2014-10-27 21:41:06 -0500
commit19ce73f64ee92451cf28e8ebfa76eacb2f3fd50d (patch)
tree53ca68f669fa4495aae50f5e3eb3f16a9ecfeb98 /post/lib_powerpc/srawi.c
parent7624d0d511378fc8149703050aec2d78ce4217e1 (diff)
downloadu-boot-fedora.tar.gz
u-boot-fedora.tar.xz
u-boot-fedora.zip
add back adding console= to the bootargs if not present.fedora
better soloution is needed not upstreamable
Diffstat (limited to 'post/lib_powerpc/srawi.c')
0 files changed, 0 insertions, 0 deletions
88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163
/* guestfish - the filesystem interactive shell
 * Copyright (C) 2010 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., 675 Mass Ave, Cambridge, MA 02139, USA.
 */

#include <config.h>

#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
#include <string.h>
#include <unistd.h>

#include "fish.h"
#include "prepopts.h"

void
prep_prelaunch_bootroot (const char *filename, prep_data *data)
{
  if (alloc_disk (filename, data->params[2], 0, 1) == -1)
    prep_error (data, filename, _("failed to allocate disk"));
}

void
prep_postlaunch_bootroot (const char *filename, prep_data *data, const char *device)
{
  off_t bootsize;
  if (parse_size (data->params[3], &bootsize) == -1)
    prep_error (data, filename, _("could not parse boot size"));

  int sector = guestfs_blockdev_getss (g, device);
  if (sector == -1)
    prep_error (data, filename, _("failed to get sector size of disk: %s"),
                guestfs_last_error (g));

  if (guestfs_part_init (g, device, data->params[4]) == -1)
    prep_error (data, filename, _("failed to partition disk: %s"),
                guestfs_last_error (g));

  off_t lastbootsect = 64 + bootsize/sector - 1;
  if (guestfs_part_add (g, device, "primary", 64, lastbootsect) == -1)
    prep_error (data, filename, _("failed to add boot partition: %s"),
                guestfs_last_error (g));

  if (guestfs_part_add (g, device, "primary", lastbootsect+1, -64) == -1)
    prep_error (data, filename, _("failed to add root partition: %s"),
                guestfs_last_error (g));

  char *part;
  if (asprintf (&part, "%s1", device) == -1) {
    perror ("asprintf");
    exit (EXIT_FAILURE);
  }
  if (guestfs_mkfs (g, data->params[0], part) == -1)
    prep_error (data, filename, _("failed to create boot filesystem: %s"),
                guestfs_last_error (g));
  free (part);

  if (asprintf (&part, "%s2", device) == -1) {
    perror ("asprintf");
    exit (EXIT_FAILURE);
  }
  if (guestfs_mkfs (g, data->params[1], part) == -1)
    prep_error (data, filename, _("failed to create root filesystem: %s"),
                guestfs_last_error (g));
  free (part);
}

void
prep_prelaunch_bootrootlv (const char *filename, prep_data *data)
{
  if (vg_lv_parse (data->params[0], NULL, NULL) == -1)
    prep_error (data, filename, _("incorrect format for LV name, use '/dev/VG/LV'"));

  if (alloc_disk (filename, data->params[3], 0, 1) == -1)
    prep_error (data, filename, _("failed to allocate disk"));
}

void