View Single Post
  #6   (View Single Post)  
Old 5th June 2018
Sehnsucht94's Avatar
Sehnsucht94 Sehnsucht94 is offline
Real Name: Paolo Vincenzo Olivo
Package Pilot
 
Join Date: Oct 2017
Location: Rome
Posts: 169
Cool UEFI/GPT NetBSD Installation

Quote:
Originally Posted by BSD-user View Post
The UEFI that you get in the instal medium is just for the install medium. If you're going to setup a system then AFAIS you have to go via the MBR route. Otherwise it appears as if some random collection of errors repeatedly get thrown at you by sysinst.
I don't believe UEFI/GPT partioning is already implemented in the installer, you rather have to perform a manual installation. Here's more or less how I did around a year ago on -current.

#Partitioning
Code:
gpt destroy wd0
gpt create -f wd0
gpt add -a 2m -s 65536 -t efi -l "ESP" wd0
gpt add -a 2m -s 5g -t ffs -l "netbsd-root" wd0
gpt add -a 2m -s 8g -t swap -l "netbsd-swap" wd0
gpt add -a 2m -s 5g -t ffs -l "netbsd-var" wd0
gpt add -a 2m -s 20g -t ffs -l "netbsd-usr" wd0
gpt add -a 2m -t ffs -l "netbsd-home”
#Formatting
Code:
newfs_msdos -F 16 /dev/rwd0a
newfs -O 2 -/dev/rwd0b
newfs -O 2 /dev/rwd0d
newfs -O 2 /dev/rwd0e
newfs -O 2 /dev/rwd0f
swapctl -a -p 1 /dev/wd0c
#mount filesystems
Code:
 mount  /dev/wd0b /mnt
 cd /mnt 
 mkdir {var,usr,home}
 swapon /dev/wd0c
 mount /dev/wd0d /mnt/var
 mount /dev/wd0e /mnt/usr
 mount /dev/wd0f /mnt/home
#extract binary sets
Code:
cd  /mnt

for set in KERN-GENERIC base comp etc  games man misc modules tests text xbase xcomp xetc xfont xserver; do
    > tar -xzpf /amd64/binary/sets/$set.tgz
    >  done

mv  netbsd netbsd.gen && ln -fh netbsd.gen netbsd
#set up bootloader
Code:
 mount -t msdos /dev/wd0a /media
 mkdir -p  /media/EFI/boot
 cp /usr/mdec/*.efi /media/EFI/boot

 cat > /media/EFI/boot/boot.cfg << EOF
 > menu=Boot normally:rndseed /etc/entropy-file;boot hd0b:netbsd
 > menu=Boot single user:rndseed /etc/entropy-file;boot hd0b:netbsd -s
 > menu=Disable ACPI:rndseed /etc/entropy-file;boot hd0b:netbsd -2
 > menu=Disable ACPI and SMP:rndseed /etc/entropy-file;boot hd0b:netbsd -12
 > menu=Drop to boot prompt:prompt
 > default=1
 > timeout=5
 > clear=1
 > EOF	

 installboot -v /dev/rwd0b /mnt/usr/mdec/bootxx_ffsv2
#create devnodes
Code:
 cd /mnt/dev
 sh MAKEDEV all
#set up a chroot env
Code:
mkdir {kern,proc}
mount_kernfs  kernfs   /mnt/kern
mount_procfs  procfs   /mnt/proc
mount_tmpfs  tmpfs   /mnt/var/shm
mount_ptyfs  ptyfs   /mnt/dev/pts
chroot  /mnt su -
# vi /etc/fstab
Code:
/dev/wd0b               /       ffs     rw               1 1
/dev/wd0c               none    swap    sw,dp            0 0
/dev/wd0d               /usr    ffs     rw               1 2
/dev/wd0e             /var    ffs     rw               1 2
/dev/wd0f               /home   ffs     rw               1 2
kernfs          /kern   kernfs  rw
ptyfs           /dev/pts        ptyfs   rw
procfs          /proc   procfs  rw
/dev/cd0a               /cdrom  cd9660  ro,noauto
tmpfs           /var/shm        tmpfs   rw,-m1777,-sram%25                                      #type
#set root password
Code:
passwd root
# set keyboard layout
Code:
echo "encoding $layout" >> /etc/wscons.conf
#disable internal speaker beep
Code:
echo "setvar  wskbd   bell.volume     0"  >> /etc/wscons.conf
echo "setvar  wskbd   bell.pitch         0"  >> /etc/wscons.conf
#set timezone
Code:
ln -sf  /usr/share/zoneinfo/${region}/${state} /etc/localtime
#vi /etc/rc.conf
Code:
if [ -r /etc/defaults/rc.conf ]; then
        . /etc/defaults/rc.conf
fi
rc_configured=YES
hostname=$HOSTNAME
rtclocaltime=YES
wscons=YES
ifconfig_${wlan_interface}="dhcp"
wpa_supplicant=YES
wpa_supplicant_flags="-B -D bsd -i $wlan_interface -c /etc/wpa_supplicant.conf"
dhcpcd=YES
dhcpcd_flags="${dhcpd_flags} -b"
sshd=YES
ntpd=YES
xdm=NO
#system-wide locale settings
Code:
echo "export LANG=\"en_US.UTF-8\"" >> /etc/profile
echo "export LC_CTYPE=\"en_US.UTF-8\"" >> /etc/profile
echo "export LC_ALL=\"\"" >> /etc/profile
#vi /etc/resolv.conf
Code:
domain         $hostname.$domain.$extension
nameserver     8.8.8.8
# add your host's IP
Code:
echo "$my_ip         $hostname  $hostname.$domain.$extension" >> /etc/hosts
# vi /etc/wpa_supplicant.conf
Code:
ctrl_interface=/var/run/wpa_supplicant
ctrl_interface_group=wheel
update_config=1
eapol_version=1
ap_scan=1
fast_reauth=1


network={
        ssid="my_ssid"
        scan_ssid=1
        psk="my_psk"
        key_mgmt=WPA-PSK
}
#make wpa_supplicant invoke dhcpcd instead of dhclient
Code:
sed -i 's/dhclient/dhcpcd/g' /etc/rc.d/wpa_supplicant
# enable networking
Code:
wpa_supplicant -B -D bsd -i $wlan_interface -c /etc/wpa_supplicant.conf"
dhcpcd
# fetch a pkgsrc tarball
Code:
ftp ftp://ftp.NetBSD.org/pub/pkgsrc/pkgsrc-${release}/pkgsrc.tar.gz
tar -xzf pkgsrc.tar.gz -C /usr
rm pkgsrc.tar.gz
# vi /etc/mk.conf (some useful suggestions, see man mk.conf)
Code:
#ALLOW_VULNERABLE_PACKAGES=1
NO_PACKAGE+= RESTRICTED
PREFER_PKGSRC=yes
ACCEPTABLE_LICENSES+=vim-license rar-license unrar-license lame-license gnu-agpl-v3 esdl-license erlang-public-license openmotif-license 
PKG_OPTIONS.vim=perl
PYTHON_VERSION_DEFAULT=36
#USE_CPUFLAGS=1
#CFLAGS+= (see devel/cpuflags)


#install pkgin and update the binary package repo
Code:
cd /usr/pkgsrc/pkgtools/pkgin
make install clean clean-depends
echo "ftp://ftp.netbsd.org/pub/pkgsrc/packages/NetBSD/${arch}/${version}/All" >> /usr/pkg/etc/pkgin/repositories.conf
pkgin update
#add a standard user
Code:
useradd -g wheel -G users -s /bin/${shell} -c "foo's real name" -m foo 
passwd foo
# exit chroot
Code:
exit
umount /media
umount -fR /mnt
Reboot & Enjoy

Note: this was quickly written relying on memory, any correction sincerely welcomed

Last edited by Sehnsucht94; 24th June 2018 at 01:48 PM.
Reply With Quote