aboutsummaryrefslogtreecommitdiff
path: root/platforms/n1sdp/ubuntu/init
blob: 022d92e611cb4a3a8191c8a62c11bc32365ed946 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#!/bin/sh
mount -t proc proc /proc
mount -t sysfs sysfs /sys
mount -o remount,rw /
chown -Rf root:root /
chmod 777 /tmp
PATH=/usr/local/sbin:/usr/sbin:/sbin:/usr/local/bin:/usr/bin:/bin
export PATH
apt-get update
apt-get install -y isc-dhcp-client systemd udev apt-utils parted sudo resolvconf grub-efi-arm64 kmod ifupdown net-tools vim initramfs-tools openssh-server
# Increase ext4 partition to full disk size
parted /dev/sda resizepart 2 100%
resize2fs /dev/sda2
sync
ln -s /dev/null /etc/systemd/network/99-default.link
echo "nameserver 8.8.4.4" >> /etc/resolvconf/resolv.conf.d/head
echo "nameserver 8.8.8.8" >> /etc/resolvconf/resolv.conf.d/head
service resolvconf restart
echo "LABEL=Ubuntu-18.04 /  ext4 defaults 0 0" >> etc/fstab
echo "LABEL=ESP /boot/efi vfat defaults 0 0" >> etc/fstab
mkdir /boot/efi
mount /boot/efi
grub-install
[ -e /linux-image-n1sdp.deb ] && dpkg -i /linux-image-n1sdp.deb
sed -ie 's/^GRUB_TIMEOUT_STYLE=.*$/GRUB_TIMEOUT_STYLE=menu/; s/^GRUB_TIMEOUT=.*$/GRUB_TIMEOUT=2/; s/GRUB_CMDLINE_LINUX_DEFAULT=.*$/GRUB_CMDLINE_LINUX_DEFAULT="earlycon vfio-pci.ids=10ee:9038"/' /etc/default/grub
update-grub
sync
# change root password
echo "root:root" | chpasswd
# Create user ubuntu:ubuntu
adduser ubuntu --gecos "ubuntu" --disabled-password
echo "ubuntu:ubuntu" | chpasswd
usermod -aG sudo ubuntu
cat <<EOF >/etc/modprobe.d/vfio.conf
# cat /etc/modprobe.d/vfio.conf
options vfio-pci ids=10ee:9038
softdep radeon pre: vfio-pci
softdep amdgpu pre: vfio-pci
softdep nouveau pre: vfio-pci
softdep drm pre: vfio-pci
options kvm_amd avic=1
EOF
update-initramfs -u
cat <<EOF >/etc/modules-load.d/vfio-pci.conf
# cat /etc/modules-load.d/vfio-pci.conf
vfio-pci
EOF
sync
bash