mirror of
https://github.com/clearlinux/vm-timing-report.git
synced 2026-11-17 08:33:02 +00:00
scripts: Add *initial* gen-ubuntu-rawfs.sh script
This script is designed to create a minimal Ubuntu system using debootstrap into an already compatible layout for vm-timing-report. Note the other new components that will be required are not yet included. Signed-off-by: Ikey Doherty <michael.i.doherty@intel.com>
This commit is contained in:
Executable
+57
@@ -0,0 +1,57 @@
|
||||
#!/bin/bash
|
||||
|
||||
# This file is part of vm-timing-report.
|
||||
#
|
||||
# Copyright (C) 2014 Intel Corporation
|
||||
# Author: Ikey Doherty <michael.i.doherty@intel.com>
|
||||
#
|
||||
# vm-timing-eport 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.
|
||||
|
||||
MOUNTPOINT="./MOUNT"
|
||||
ROOTIMAGE="rootfs.img"
|
||||
BFILES="./BFILES"
|
||||
|
||||
# fallocate doesn't work on all distros
|
||||
dd if=/dev/zero of=$ROOTIMAGE bs=1 seek=2048M count=0
|
||||
|
||||
if [[ ! -d $MOUNTPOINT ]]; then
|
||||
mkdir $MOUNTPOINT
|
||||
fi
|
||||
|
||||
mkfs -t ext4 -F $ROOTIMAGE
|
||||
mount -o loop $ROOTIMAGE $MOUNTPOINT
|
||||
|
||||
debootstrap --arch amd64 trusty $MOUNTPOINT
|
||||
cp -v /etc/resolv.conf $MOUNTPOINT/etc/resolv.conf
|
||||
# Kernels wont install under Ubuntu without proc (scans for PAE support..)
|
||||
mount -o bind /proc $MOUNTPOINT/proc
|
||||
|
||||
chroot $MOUNTPOINT apt-get install linux-image-generic --yes --force-yes
|
||||
|
||||
umount $MOUNTPOINT/proc
|
||||
|
||||
if [[ ! -d "$BFILES" ]]; then
|
||||
mkdir "$BFILES"
|
||||
fi
|
||||
|
||||
cp -v $MOUNTPOINT/boot/vmlinu* $BFILES/vmlinuz
|
||||
cp -v $MOUNTPOINT/boot/initr* $BFILES/initrd
|
||||
|
||||
|
||||
# Generate an fstab always using /dev/vda
|
||||
echo "devpts /dev/pts devpts mode=0620,gid=5 0 0" > $MOUNTPOINT/etc/fstab
|
||||
echo "proc /proc proc defaults 0 0" >> $MOUNTPOINT/etc/fstab
|
||||
echo "/dev/vda / ext4 defaults,rw 0 0" >> $MOUNTPOINT/etc/fstab
|
||||
|
||||
# Init files
|
||||
install -m 0700 /usr/share/vm-timing-report/vm-report.init $MOUNTPOINT/etc/init.d/vm-report
|
||||
install -m 0755 /usr/share/vm-timing-report/vm-report.sh $MOUNTPOINT/usr/bin/vm-report
|
||||
|
||||
chroot $MOUNTPOINT update-rc.d vm-report defaults
|
||||
|
||||
sleep 1
|
||||
sync
|
||||
umount $MOUNTPOINT
|
||||
Reference in New Issue
Block a user