Skip to content

Instantly share code, notes, and snippets.

@Apsu
Last active July 8, 2021 03:54

Revisions

  1. Apsu revised this gist Jun 13, 2013. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion uefisetup.sh
    Original file line number Diff line number Diff line change
    @@ -18,7 +18,7 @@ parted /dev/sda # or gdisk or cgdisk or etc...
    # Make your other partition(s) as you see fit

    # Create ESP filesystem
    mkfs.vfat -F32 -n efi /dev/sda1
    mkfs.vfat -F32 -n efi /dev/sda1 # -F## is not required on most firmwares; FAT12/16 usually work

    # In this example, I'm using btrfs
    mkfs.btrfs -KL root /dev/sda2
  2. Apsu revised this gist Jun 13, 2013. 1 changed file with 1 addition and 9 deletions.
    10 changes: 1 addition & 9 deletions uefisetup.sh
    Original file line number Diff line number Diff line change
    @@ -12,9 +12,8 @@
    # If you're using an actual CD burned from the official Arch ISO, just make sure you've booted it in UEFI mode

    # Assuming /dev/sda is the target disk
    cgdisk /dev/sda
    parted /dev/sda # or gdisk or cgdisk or etc...
    # Make a partition of type EF00 (EFI System Partition, or ESP)
    # Minimum size I can get without complaints from mkfs.vfat is 64M
    # Might want to name it something useful like "efi"
    # Make your other partition(s) as you see fit

    @@ -35,19 +34,12 @@ mount -o noatime /dev/sda1 /mnt/boot # See above
    # Install as per usual, but snag grub-efi
    pacstrap /mnt base base-devel grub-efi-x86_64

    # Super important, before chroot!
    modprobe efivars

    # Facestab needfuls
    genfstab -pU /mnt >> /mnt/etc/fstab

    # Chroot, and gimme some bash plox
    arch-chroot /mnt /bin/bash

    # Genfstab does the wrong thing when you have a FAT32 partition mounted
    vi /etc/fstab
    # Modify /dev/sda1 options to just "noatime"; remove all the other codepage/etc options

    # Do other installation needfuls
    # ...

  3. Apsu revised this gist Mar 19, 2013. 1 changed file with 4 additions and 4 deletions.
    8 changes: 4 additions & 4 deletions uefisetup.sh
    Original file line number Diff line number Diff line change
    @@ -13,21 +13,21 @@

    # Assuming /dev/sda is the target disk
    cgdisk /dev/sda
    # Make a partition of type EF00 (EFI System Partition)
    # Make a partition of type EF00 (EFI System Partition, or ESP)
    # Minimum size I can get without complaints from mkfs.vfat is 64M
    # Might want to name it something useful like "efi"
    # Make your other partition(s) as you see fit

    # Create EFI System Partition (EF00) filesystem
    # Create ESP filesystem
    mkfs.vfat -F32 -n efi /dev/sda1

    # In this example, I'm using btrfs
    mkfs.btrfs -KL root /dev/sda2

    # Mount the needful -- note the btrfs-specific mount options
    mount -o ssd,discard,noatime,compress=lzo /dev/sda2 /mnt
    mkdir -p /mnt/boot/efi
    mount -o noatime /dev/sda1 /mnt/boot/efi
    mkdir -p /mnt/boot # Or /mnt/boot/efi if you *only* want the grub binary on the ESP
    mount -o noatime /dev/sda1 /mnt/boot # See above

    # Networking stuff
    # ...
  4. Apsu renamed this gist Nov 28, 2012. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  5. Apsu renamed this gist Nov 28, 2012. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  6. Apsu revised this gist Nov 28, 2012. 1 changed file with 8 additions and 2 deletions.
    10 changes: 8 additions & 2 deletions uefi-setup.sh
    Original file line number Diff line number Diff line change
    @@ -1,5 +1,11 @@
    #!/bin/bash

    # **************** READ THIS FIRST ******************
    #
    # This is not a script for you to run. I repeat, do not download and run this!
    #
    # This is only a guide to show the required steps for successful UEFI + GRUB2 installation
    # Many of the choices are examples or assumptions; don't blindly type shit into your machine
    # until/unless you at least read the comments around each command
    #
    # These steps assume you've booted in UEFI mode by preparing your USB stick per these instructions:
    # https://wiki.archlinux.org/index.php/UEFI#Archiso
    #
  7. Apsu revised this gist Nov 28, 2012. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions uefi-setup.sh
    Original file line number Diff line number Diff line change
    @@ -15,10 +15,10 @@ cgdisk /dev/sda
    # Create EFI System Partition (EF00) filesystem
    mkfs.vfat -F32 -n efi /dev/sda1

    # Assuming a single btrfs root
    # In this example, I'm using btrfs
    mkfs.btrfs -KL root /dev/sda2

    # Mount the needful
    # Mount the needful -- note the btrfs-specific mount options
    mount -o ssd,discard,noatime,compress=lzo /dev/sda2 /mnt
    mkdir -p /mnt/boot/efi
    mount -o noatime /dev/sda1 /mnt/boot/efi
  8. Apsu revised this gist Nov 25, 2012. 1 changed file with 2 additions and 0 deletions.
    2 changes: 2 additions & 0 deletions uefi-setup.sh
    Original file line number Diff line number Diff line change
    @@ -2,6 +2,8 @@

    # These steps assume you've booted in UEFI mode by preparing your USB stick per these instructions:
    # https://wiki.archlinux.org/index.php/UEFI#Archiso
    #
    # If you're using an actual CD burned from the official Arch ISO, just make sure you've booted it in UEFI mode

    # Assuming /dev/sda is the target disk
    cgdisk /dev/sda
  9. Apsu revised this gist Nov 19, 2012. 1 changed file with 4 additions and 0 deletions.
    4 changes: 4 additions & 0 deletions uefi-setup.sh
    Original file line number Diff line number Diff line change
    @@ -36,6 +36,10 @@ genfstab -pU /mnt >> /mnt/etc/fstab
    # Chroot, and gimme some bash plox
    arch-chroot /mnt /bin/bash

    # Genfstab does the wrong thing when you have a FAT32 partition mounted
    vi /etc/fstab
    # Modify /dev/sda1 options to just "noatime"; remove all the other codepage/etc options

    # Do other installation needfuls
    # ...

  10. Apsu created this gist Nov 19, 2012.
    55 changes: 55 additions & 0 deletions uefi-setup.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,55 @@
    #!/bin/bash

    # These steps assume you've booted in UEFI mode by preparing your USB stick per these instructions:
    # https://wiki.archlinux.org/index.php/UEFI#Archiso

    # Assuming /dev/sda is the target disk
    cgdisk /dev/sda
    # Make a partition of type EF00 (EFI System Partition)
    # Minimum size I can get without complaints from mkfs.vfat is 64M
    # Might want to name it something useful like "efi"
    # Make your other partition(s) as you see fit

    # Create EFI System Partition (EF00) filesystem
    mkfs.vfat -F32 -n efi /dev/sda1

    # Assuming a single btrfs root
    mkfs.btrfs -KL root /dev/sda2

    # Mount the needful
    mount -o ssd,discard,noatime,compress=lzo /dev/sda2 /mnt
    mkdir -p /mnt/boot/efi
    mount -o noatime /dev/sda1 /mnt/boot/efi

    # Networking stuff
    # ...

    # Install as per usual, but snag grub-efi
    pacstrap /mnt base base-devel grub-efi-x86_64

    # Super important, before chroot!
    modprobe efivars

    # Facestab needfuls
    genfstab -pU /mnt >> /mnt/etc/fstab

    # Chroot, and gimme some bash plox
    arch-chroot /mnt /bin/bash

    # Do other installation needfuls
    # ...

    # Bootloader install
    grub-install

    # Can check/modify UEFI firmware entries
    efibootmgr # -t 0 for timeout, -b xxxx -B xxxx to delete, etc

    # Generate grub.cfg
    grub-mkconfig -o /boot/grub/grub.cfg

    # Exit chroot
    exit

    # Rebooten Sie!
    reboot