qemu/tests/migration/rebuild-x86-bootblock.sh
<<
>>
Prefs
   1#!/bin/sh
   2# Copyright (c) 2016-2018 Red Hat, Inc. and/or its affiliates
   3# This work is licensed under the terms of the GNU GPL, version 2 or later.
   4# See the COPYING file in the top-level directory.
   5#
   6# Author: dgilbert@redhat.com
   7
   8ASMFILE=$PWD/tests/migration/x86-a-b-bootblock.s
   9HEADER=$PWD/tests/migration/x86-a-b-bootblock.h
  10
  11if [ ! -e "$ASMFILE" ]
  12then
  13  echo "Couldn't find $ASMFILE" >&2
  14  exit 1
  15fi
  16
  17ASM_WORK_DIR=$(mktemp -d --tmpdir X86BB.XXXXXX)
  18cd "$ASM_WORK_DIR" &&
  19as --32 -march=i486 "$ASMFILE" -o x86.o &&
  20objcopy -O binary x86.o x86.boot &&
  21dd if=x86.boot of=x86.bootsect bs=256 count=2 skip=124 &&
  22xxd -i x86.bootsect |
  23sed -e 's/.*int.*//' > x86.hex &&
  24cat - x86.hex <<HERE > "$HEADER"
  25/* This file is automatically generated from
  26 * tests/migration/x86-a-b-bootblock.s, edit that and then run
  27 * tests/migration/rebuild-x86-bootblock.sh to update,
  28 * and then remember to send both in your patch submission.
  29 */
  30HERE
  31
  32rm x86.hex x86.bootsect x86.boot x86.o
  33cd .. && rmdir "$ASM_WORK_DIR"
  34