summaryrefslogtreecommitdiffstats
path: root/scripts/runqemu-extract-sdk
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/runqemu-extract-sdk')
-rwxr-xr-xscripts/runqemu-extract-sdk104
1 files changed, 0 insertions, 104 deletions
diff --git a/scripts/runqemu-extract-sdk b/scripts/runqemu-extract-sdk
deleted file mode 100755
index 32ddd48..0000000
--- a/scripts/runqemu-extract-sdk
+++ /dev/null
@@ -1,104 +0,0 @@
1#!/bin/bash
2#
3# This utility extracts an SDK image tarball using pseudo, and stores
4# the pseudo database in var/pseudo within the rootfs. If you want to
5# boot QEMU using an nfsroot, you *must* use this script to create the
6# rootfs to ensure it is done correctly with pseudo.
7#
8# Copyright (c) 2010 Intel Corp.
9#
10# This program is free software; you can redistribute it and/or modify
11# it under the terms of the GNU General Public License version 2 as
12# published by the Free Software Foundation.
13#
14# This program is distributed in the hope that it will be useful,
15# but WITHOUT ANY WARRANTY; without even the implied warranty of
16# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
17# See the GNU General Public License for more details.
18#
19# You should have received a copy of the GNU General Public License
20# along with this program; if not, write to the Free Software
21# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22
23function usage() {
24 echo "Usage: $0 <image-tarball> <extract-dir>"
25}
26
27if [ $# -ne 2 ]; then
28 usage
29 exit 1
30fi
31
32SYSROOT_SETUP_SCRIPT=`which oe-find-native-sysroot 2> /dev/null`
33if [ -z "$SYSROOT_SETUP_SCRIPT" ]; then
34 echo "Error: Unable to find the oe-find-native-sysroot script"
35 echo "Did you forget to source your build system environment setup script?"
36 exit 1
37fi
38. $SYSROOT_SETUP_SCRIPT
39PSEUDO_OPTS="-P $OECORE_NATIVE_SYSROOT/usr"
40
41ROOTFS_TARBALL=$1
42SDK_ROOTFS_DIR=$2
43
44if [ ! -e "$ROOTFS_TARBALL" ]; then
45 echo "Error: sdk tarball '$ROOTFS_TARBALL' does not exist"
46 usage
47 exit 1
48fi
49
50# Convert SDK_ROOTFS_DIR to a full pathname
51if [[ ${SDK_ROOTFS_DIR:0:1} != "/" ]]; then
52 SDK_ROOTFS_DIR=$(readlink -f $(pwd)/$SDK_ROOTFS_DIR)
53fi
54
55TAR_OPTS=""
56if [[ "$ROOTFS_TARBALL" =~ tar\.bz2$ ]]; then
57 TAR_OPTS="--numeric-owner -xjf"
58fi
59if [[ "$ROOTFS_TARBALL" =~ tar\.gz$ ]]; then
60 TAR_OPTS="--numeric-owner -xzf"
61fi
62if [[ "$ROOTFS_TARBALL" =~ \.tar$ ]]; then
63 TAR_OPTS="--numeric-owner -xf"
64fi
65if [ -z "$TAR_OPTS" ]; then
66 echo "Error: Unable to determine sdk tarball format"
67 echo "Accepted types: .tar / .tar.gz / .tar.bz2"
68 exit 1
69fi
70
71if [ ! -d "$SDK_ROOTFS_DIR" ]; then
72 echo "Creating directory $SDK_ROOTFS_DIR"
73 mkdir -p "$SDK_ROOTFS_DIR"
74fi
75
76pseudo_state_dir="$SDK_ROOTFS_DIR/../$(basename "$SDK_ROOTFS_DIR").pseudo_state"
77pseudo_state_dir="$(readlink -f $pseudo_state_dir)"
78
79if [ -e "$pseudo_state_dir" ]; then
80 echo "Error: $pseudo_state_dir already exists!"
81 echo "Please delete the rootfs tree and pseudo directory manually"
82 echo "if this is really what you want."
83 exit 1
84fi
85
86mkdir -p "$pseudo_state_dir"
87touch "$pseudo_state_dir/pseudo.pid"
88PSEUDO_LOCALSTATEDIR="$pseudo_state_dir"
89export PSEUDO_LOCALSTATEDIR
90
91echo "Extracting rootfs tarball using pseudo..."
92echo "$PSEUDO $PSEUDO_OPTS tar -C \"$SDK_ROOTFS_DIR\" $TAR_OPTS \"$ROOTFS_TARBALL\""
93$PSEUDO $PSEUDO_OPTS tar -C "$SDK_ROOTFS_DIR" $TAR_OPTS "$ROOTFS_TARBALL"
94
95DIRCHECK=`ls -l "$SDK_ROOTFS_DIR" | wc -l`
96if [ "$DIRCHECK" -lt 5 ]; then
97 echo "Warning: I don't see many files in $SDK_ROOTFS_DIR"
98 echo "Please double-check the extraction worked as intended"
99 exit 0
100fi
101
102echo "SDK image successfully extracted to $SDK_ROOTFS_DIR"
103
104exit 0