Skip to content

Commit

Permalink
debootstrap-debian-qemu.sh: make perfect
Browse files Browse the repository at this point in the history
  • Loading branch information
cirosantilli committed Oct 6, 2018
1 parent 0321da6 commit 4a15040
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 14 deletions.
28 changes: 14 additions & 14 deletions debootstrap-debian-qemu.sh
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,10 @@ if [ ! -d "$debootstrap_dir" ]; then
"$debootstrap_dir" \
http://deb.debian.org/debian/ \
;
sudo rm -f "$root_filesystem"
fi

linux_image="$(printf "${debootstrap_dir}/boot/vmlinuz-"*)"

if [ ! -f "$root_filesystem" ]; then

# Set root password.
echo 'root:root' | sudo chroot "$debootstrap_dir" chpasswd

Expand Down Expand Up @@ -65,24 +63,26 @@ EOF
sudo chmod 666 "$root_filesystem"
fi

linux_img="${debootstrap_dir}/boot/vmlinuz-"*
# linux_image="$(printf "${debootstrap_dir}/boot/vmlinuz-"*)"

# Build the Linux kernel.
git clone --depth 1 --branch v4.18 git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
cd linux
wget https://gist.githubusercontent.com/cirosantilli/6e2f4975c1929162a86be09f839874ca/raw/6d151d231a233408a6e1b541bf4a92fd55bf5338/.config
make olddefconfig
make -j`nproc`
cd -
linux_img="linux/arch/x86_64/boot/bzImage"
linux_img=linux/arch/x86_64/boot/bzImage
if [ ! -f "$linux_img" ]; then
# Build the Linux kernel.
git clone --depth 1 --branch v4.18 git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
cd linux
wget https://gist.githubusercontent.com/cirosantilli/6e2f4975c1929162a86be09f839874ca/raw/6d151d231a233408a6e1b541bf4a92fd55bf5338/.config
make olddefconfig
make -j`nproc`
cd -
fi

qemu-system-x86_64 \
-append 'console=ttyS0 root=/dev/sda' \
-drive "file=img.ext2.qcow2,format=qcow2" \
-drive "file=${root_filesystem},format=qcow2" \
-enable-kvm \
-serial mon:stdio \
-m 2G \
-kernel="$linux_img"
-kernel "$linux_img" \
-device rtl8139,netdev=net0 \
-netdev user,id=net0 \
;
2 changes: 2 additions & 0 deletions debootstrap-ubuntu-qemu.sh
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,12 @@ Description=DHCP Client
Documentation=man:dhclient(8)
Wants=network.target
Before=network.target
[Service]
Type=forking
PIDFile=/var/run/dhclient.pid
ExecStart=/sbin/dhclient -4 -q
[Install]
WantedBy=multi-user.target
EOF
Expand Down

0 comments on commit 4a15040

Please sign in to comment.