Code Monkey home page Code Monkey logo

archiso-sb-shim's Introduction

archiso-sb-shim

This repo attempts to provide an easy way to create an Archlinux Live CD/USB ISO ready to run on a Secure Boot enabled system, using the shim method with your own keys.

But for this to work, you will need to already have installed your own keys in the MOK list with mokutil.

Or, if you put your DER certificate in the current directory (named DB.cer), then it will be included in the ESP of the archiso, and you will be able to enroll it during the boot of the ISO.

NOTE: This will not install an archlinux ready to boot with Secure Boot though. You will have to complete the needed steps to make it work, by yourself. This would mean doing almost the same thing that here aka. install sbsigntools, shim-signed, and mokutil, and your keys into the shim MOK list.

Scripted method

The script archiso-sb-shim.sh automates the method described below. This is a very basic script; use at your own risk.

It needs sbsigntools package to be installed.

Manual method

Prerequisite

Install the sbsigntools from [extra].

As described in the arch wiki, you need to install shim-signed package from the AUR.

Keep the generated packages around, as we will need them later on.

Copy your keys (DB.key and DB.crt) to the current directory. Look at the wiki on how to do that if you don't have ones.

Patch mkarchiso

Install archiso package, if it is not already done.

Make a copy of mkarchiso, and apply the patch:

cp /usr/bin/mkarchiso .
patch -p0 -i mkarchiso.patch

Copy and configure a profile

Copy an archiso profile; we will use here releng.

cp -a /usr/share/archiso/configs/releng myarchiso

We need to add the package previously mentionned (aka shim-signed) to the iso. To do so:

  1. Add the following line at the end of packages.x86_64:

    mokutil
    shim-signed
    
  2. Modify pacman.conf inside the archiso profile you just copied

Define a custom repo at the end of the file. You just need to uncomment the last 3 lines, and choose a directory where you will put that repo alongside the 2 packages mentionned earlier.

[custom]
SigLevel = Optional TrustAll
Server = file:///tmp/custom.d

Create a custom repo

To make the previous bit work, we need to create a custom repo for the package from AUR we need: shim-signed.

mkdir /tmp/custom.d
cd /tmp/custom.d
cp <somewhere>/shim-signed-*.pkg.* .
repo-add custom.db.tar.gz shim-signed-*.pkg.*

Voilà !

That's it. We just have to build the ISO by running our mkarchiso now:

./mkarchiso -v -w /tmp/archisotmp -o ~ ./myarchiso

archiso-sb-shim's People

Contributors

solsticedhiver avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

Forkers

lokawn

archiso-sb-shim's Issues

"efibootimg" variable is incorrectly referenced as "efiboot.img" in the patch file

Hello,

It seems you have used incorrect variable name in your patch file.
${efiboot.img} is used, and ${efibootimg} should be used, at least - it looks so...
My build passes only when the blow corrections are applied to the patch file:

--- mkarchiso.patch-orig        2022-09-08 14:04:27.795838919 +0200
+++ mkarchiso.patch     2022-09-08 14:05:50.579990918 +0200
@@ -26,10 +26,10 @@
 +    mcopy -i "${efibootimg}" \
 +        "${pacstrap_dir}/usr/share/shim-signed/mmx64.efi" ::/EFI/BOOT/mmx64.efi
 +    # Copy systemd-boot EFI binary as grubx64.efi chainloaded by shimx64.efi
-+    mcopy -i "${efiboot.img}" \
++    mcopy -i "${efibootimg}" \
 +        "${pacstrap_dir}/usr/lib/systemd/boot/efi/systemd-bootx64.efi" ::/EFI/BOOT/grubx64.efi
 +    if [[ -f DB.cer ]] ;then
-+        mcopy -i "${efiboot.img}" DB.cer ::/EFI/BOOT/DB.cer
++        mcopy -i "${efibootimg}" DB.cer ::/EFI/BOOT/DB.cer
 +    fi

Without it, building ISO always fails:

[...]
[mkarchiso] INFO: Done! SYSLINUX set up for BIOS booting from a disk successfully.
[mkarchiso] INFO: Setting up SYSLINUX for BIOS booting from an optical disc...
[mkarchiso] INFO: Done! SYSLINUX set up for BIOS booting from an optical disc successfully.
[mkarchiso] INFO: Setting up systemd-boot for UEFI booting...
[mkarchiso] INFO: Creating FAT image of size: 47104 KiB...
mkfs.fat 4.2 (2021-01-31)
/usr/sbin/mkarchiso: line 767: ${efiboot.img}: bad substitution

Thanks for all your work.
Much appreciated!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.