mirror of
https://github.com/fosslinux/live-bootstrap.git
synced 2026-03-23 11:36:32 +01:00
add chroot-mode, so it works without qemu/kernel
This commit is contained in:
parent
98058e6b70
commit
5b17683a26
1 changed files with 13 additions and 7 deletions
14
rootfs.sh
14
rootfs.sh
|
|
@ -1,14 +1,15 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
set -ex
|
set -ex
|
||||||
|
|
||||||
QEMU_CMD=$1
|
QEMU_CMD="${1:-qemu-system-x86_64}" # or 'chroot'
|
||||||
RAM=$2
|
QEMU_RAM="${2:-8G}"
|
||||||
|
|
||||||
pushd sysa
|
pushd sysa
|
||||||
|
|
||||||
# SYSTEM A
|
# SYSTEM A
|
||||||
|
|
||||||
# Setup tmp
|
# Setup tmp
|
||||||
|
echo "trying to mount ramdisk/tmpfs: size 8G"
|
||||||
mkdir -p tmp/
|
mkdir -p tmp/
|
||||||
sudo mount -t tmpfs -o size=8G tmpfs tmp
|
sudo mount -t tmpfs -o size=8G tmpfs tmp
|
||||||
|
|
||||||
|
|
@ -119,13 +120,18 @@ cd tmp
|
||||||
find . | cpio -H newc -o | gzip > initramfs.igz
|
find . | cpio -H newc -o | gzip > initramfs.igz
|
||||||
|
|
||||||
# Run
|
# Run
|
||||||
${QEMU_CMD:-qemu-system-x86_64} -enable-kvm \
|
if [ "${QEMU_CMD}" = 'chroot' ]; then
|
||||||
-m "${RAM:-8G}" \
|
sudo PATH="/after/bin:${PATH}" chroot . /init
|
||||||
|
else
|
||||||
|
${QEMU_CMD} -enable-kvm \
|
||||||
|
-m "${QEMU_RAM:-8G}" \
|
||||||
-nographic \
|
-nographic \
|
||||||
-no-reboot \
|
-no-reboot \
|
||||||
-kernel ../../kernel -initrd initramfs.igz -append console=ttyS0
|
-kernel ../../kernel -initrd initramfs.igz -append console=ttyS0
|
||||||
|
fi
|
||||||
|
|
||||||
cd ../..
|
cd ../..
|
||||||
|
|
||||||
# Cleanup
|
# Cleanup
|
||||||
|
echo "trying to unmount ramdisk/tmpfs, abort with CTRL+C"
|
||||||
sudo umount sysa/tmp
|
sudo umount sysa/tmp
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue