Skip to content

Commit

Permalink
mxgrub: Factor out initramfs code to create_initramfs.sh
Browse files Browse the repository at this point in the history
  • Loading branch information
pmenzel committed Jun 30, 2017
1 parent 4271a6e commit 6ae5d50
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 1 deletion.
37 changes: 37 additions & 0 deletions mxgrub/create_initramfs
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
#!/bin/sh

if [ -z "$1" ]; then
echo "You need to supply an initrd file name"
exit 1
fi

# Prepare microcode updates for AMD and Intel processors
DSTDIR=kernel/x86/microcode
INITRDNAME="$1"
INITRDPATH=/boot/grub/"$INITRDNAME".igz
INITRDDIR="$TMPDIR"/"$INITRDNAME"
mkdir -p "$INITRDDIR"
cd "$INITRDDIR"
mkdir -p "$DSDDIR"

if [ -d /lib/firmware/amd-ucode ]; then
cat /lib/firmware/amd-ucode/microcode_amd*.bin > "$DSTDIR"/AuthenticAMD.bin
fi

if [ -d /lib/firmware/intel-ucode ]; then
cat /lib/firmware/intel-ucode/* > "$DSTDIR"/GenuineIntel.bin
fi

find . | cpio -o -H newc > "$TMPDIR"/ucode.cpio

cd ..

# Clean up
rm -rf "$INITRDDIR"

cd /project/admin/initramfs
find .|cpio -H newc -o | gzip > "$TMPDIR"/"$INITRDNAME"

#
cat ucode.cpio $INITRDNAME > /boot/grub/"$INITRDNAME"
rm "$TMPDIR"/ucode.cpio "$TMPDIR"/"$INITRDNAME"
2 changes: 1 addition & 1 deletion mxgrub/mxgrub
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ sub cmd_update {
}

sub cmd_initramfs {
sys('bash','-c','cd /project/admin/initramfs;find .|cpio -H newc -o | gzip > /boot/grub/initramfs.igz');
sys('/project/mxtools/mxgrub/create_initramfs', 'initramfs');
}

our ($opt_list,$opt_update,$opt_initramfs,$opt_test);
Expand Down

0 comments on commit 6ae5d50

Please sign in to comment.