From c49e53eaee17dea082c3078f139c16a19d1e59fa Mon Sep 17 00:00:00 2001
From: Bob Mottram <bob@freedombone.net>
Date: Tue, 20 Jun 2017 11:00:06 +0100
Subject: [PATCH] Set kernel options within grub

---
 src/freedombone-image-customise | 4 ++++
 src/freedombone-utils-setup     | 2 ++
 2 files changed, 6 insertions(+)

diff --git a/src/freedombone-image-customise b/src/freedombone-image-customise
index 5240112a0..859fc694b 100755
--- a/src/freedombone-image-customise
+++ b/src/freedombone-image-customise
@@ -1069,6 +1069,8 @@ function image_setup_utils {
 
     if [[ $ARCHITECTURE == 'qemu'* || $ARCHITECTURE == 'amd64' || $ARCHITECTURE == 'x86_64' || $ARCHITECTURE == 'i686' || $ARCHITECTURE == 'i386' ]]; then
         chroot "$rootdir" apt-get -yq install grub2
+        sed -i 's|GRUB_CMDLINE_LINUX_DEFAULT=.*|GRUB_CMDLINE_LINUX_DEFAULT="quiet ifnames=0 slub_debug=FZP slab_nomerge page_poison=1"|g' $rootdir/etc/default/grub
+        chroot "$rootdir" update-grub
     fi
 
     chroot "$rootdir" apt-get -yq install locales locales-all debconf
@@ -1380,6 +1382,8 @@ chroot "$rootdir" apt-get install -y locales locales-all debconf wireless-tools
 if [[ $ARCHITECTURE == 'qemu'* || $ARCHITECTURE == 'i386' || $ARCHITECTURE == 'i686' || $ARCHITECTURE == 'amd64' || $ARCHITECTURE == 'x86_64' ]]; then
     chroot "$rootdir" apt-get install -y cryptsetup zsh pinentry-curses iotop bc
     chroot "$rootdir" apt-get install -y grub2 hostapd
+    sed -i 's|GRUB_CMDLINE_LINUX_DEFAULT=.*|GRUB_CMDLINE_LINUX_DEFAULT="quiet ifnames=0 slub_debug=FZP slab_nomerge page_poison=1"|g' $rootdir/etc/default/grub
+    chroot "$rootdir" update-grub
 fi
 
 sed -i "s|#host-name=.*|host-name=${PROJECT_NAME}|g" $rootdir/etc/avahi/avahi-daemon.conf
diff --git a/src/freedombone-utils-setup b/src/freedombone-utils-setup
index 887907dd2..f31fadc71 100755
--- a/src/freedombone-utils-setup
+++ b/src/freedombone-utils-setup
@@ -225,6 +225,8 @@ function initial_setup {
 
     if [[ $ARCHITECTURE == 'qemu'* || $ARCHITECTURE == 'amd64' || $ARCHITECTURE == 'x86_64' || $ARCHITECTURE == 'i686' || $ARCHITECTURE == 'i386' ]]; then
         apt-get -yq install grub2
+        sed -i 's|GRUB_CMDLINE_LINUX_DEFAULT=.*|GRUB_CMDLINE_LINUX_DEFAULT="quiet ifnames=0 slub_debug=FZP slab_nomerge page_poison=1"|g' /etc/default/grub
+        update-grub
     fi
 
     if [ ! -d $INSTALL_DIR ]; then
-- 
GitLab