Main Menu

Building kexec

Started by Jhoefs, September 14, 2016, 21:43:15 PM

Previous topic - Next topic

Jhoefs

I would like to successfully build kexec kernel and have it installed so that when I boot I can run the kernel and boot from an internal SD card that this HP laptop does not offer as a boot option.

here is the terminal output (sorry for the length):

jhoefs-HP-Pavilion-dv7-Notebook-PC plopkexec-1.4.1 # ./build.sh
echo "#define BUILT \"Wed Sep 14 12:18:31 PDT 2016 on i686\"" > built
g++  -g -c -Wunused -Wuninitialized -O2 -march=i486  plpkexec.cpp
plpkexec.cpp: In function 'void* Dmesg(void*)':
plpkexec.cpp:189:37: warning: ignoring return value of 'char* fgets(char*, int, FILE*)', declared with attribute warn_unused_result [-Wunused-result]
  fgets (line, sizeof (line) - 1, pf);
                                     ^
g++  -g -c -Wunused -Wuninitialized -O2 -march=i486  keyboard.cpp
g++  -g -c -Wunused -Wuninitialized -O2 -march=i486  vt.cpp
g++  -g -c -Wunused -Wuninitialized -O2 -march=i486  run.cpp
g++  -g -c -Wunused -Wuninitialized -O2 -march=i486  tools.cpp
g++  -g -c -Wunused -Wuninitialized -O2 -march=i486  log.cpp
g++  -g -c -Wunused -Wuninitialized -O2 -march=i486  menu.cpp
menu.cpp: In member function 'void Menu::Header()':
menu.cpp:751:26: warning: format not a string literal and no format arguments [-Wformat-security]
     printf (title.c_str());
                          ^
g++  -g -c -Wunused -Wuninitialized -O2 -march=i486  menuentry.cpp
g++  -g -c -Wunused -Wuninitialized -O2 -march=i486  edit.cpp
g++  -g -c -Wunused -Wuninitialized -O2 -march=i486  scan_syslinux.cpp
g++  -g -c -Wunused -Wuninitialized -O2 -march=i486  scan_lilo.cpp
g++  -g -c -Wunused -Wuninitialized -O2 -march=i486  scan_grub.cpp
g++  -g -c -Wunused -Wuninitialized -O2 -march=i486  scan_grub2.cpp
g++  -g -c -Wunused -Wuninitialized -O2 -march=i486  devices.cpp
g++ -o init -Wall -D_FILE_OFFSET_BITS=64 --static -pthread  plpkexec.o keyboard.o vt.o run.o tools.o log.o menu.o menuentry.o edit.o scan_syslinux.o scan_lilo.o scan_grub.o scan_grub2.o devices.o
strip -s init
Extracting Linux kernel source code


And then it hangs on 'extracting linux kernel source code'.

Elmar

Quote from: Jhoefs on September 14, 2016, 21:43:15 PM
...
Extracting Linux kernel source code


And then it hangs on 'extracting linux kernel source code'.

Extracting the kernel can take some time.

Jhoefs

I will keep trying; my last attempt ended with:

Makefile:344: scripts/Kbuild.include: No such file or directory
/bin/bash: ./scripts/gcc-goto.sh: No such file or directory
Makefile:808: scripts/Makefile.kasan: No such file or directory
Makefile:809: scripts/Makefile.extrawarn: No such file or directory
Makefile:810: scripts/Makefile.ubsan: No such file or directory
make: *** No rule to make target 'scripts/Makefile.ubsan'.  Stop.

Thanks,

J

Elmar

Because you aborted the initial kernel extraction.

Remove the directory "kernel/linux-4.7" and start again "build.sh"

Jhoefs

Yes! successful build....

still having same problem as before, sudo update-grub2 is not automatically recognizing kexec (it's in the /boot/ directory)

I could probably just run it as an ISO, booting from a CD and then into the internal SD drive, I also know their is a way to load the kernel from grub2's command line but haven't been able to figure out how to do that yet

Elmar

Quote from: Jhoefs on September 15, 2016, 19:33:42 PM
Yes! successful build....

still having same problem as before, sudo update-grub2 is not automatically recognizing kexec (it's in the /boot/ directory)

Did you add plopkexec to a grub config file?

Jhoefs

Hi Elmar.

I don't know how to add it to a config file, and nothing I can google is helpful. I burned the ISO to disc and booted from that but Plopkexec actually failed in that instance. Do you mind telling me how to boot kexec from the Grub2 command line? The kernel is in /boot/ on the same USB Grub2 is booting from. Should be easy to get the device ID if I need that to specify the root, although seems redundant since its on the same disk. If it works from the command line, I can go ahead and use those same commands to manufacture an entry in the config file (and it would be helpful if someone could help me out with that, as well).

J

Elmar

I don't know how your system looks like. When you have just one partition for your linux, and its the first partition on the first hard disk, then edit /etc/grub.d/40_custom


#!/bin/sh
exec tail -n +3 $0

menuentry "PlopKexec" {
    set root=(hd0,1)
    linux /boot/plopkexec
}


then run "update-grub2"

vesalocal

#8
Hello, J

On your linux system simply type `info grub` for grub documentation.

Here is my grub.cfg file used to boot some experimental stuff from an USB drive:


# file /boot/grub/grub.cfg

set default="2"
set timeout="3"

insmod fat
set root='(hd0,msdos1)'

menuentry "TinyCore Linux 7.1" {
        linux /boot/vmlinuz blacklist=8139cp loglevel=3 tce showapps desktop=fluxbox tz=MEZ-1MEZ-2,M3.5.0,M10.5.0 kmap=qwertz/de-latin1
        initrd /boot/core.gz
}
menuentry "PLoP Bootmanager" {
        linux16 /boot/plpbt0.bin
}
menuentry "PlopKexec 1.4-test2" {
        linux /boot/plopkexec
}
menuentry "PlopKexec 0.3" {
        linux /boot/plopkexec03
}



BTW: you chose the hard way to gain some (basic linux) knowledge since playing around with grub may render your system no longer bootable...
For details on the installation of grub see `man grub-install` (!).
And always keep a backup of your grub.cfg and a rescue CD handy ;-)


Please don't forget to donate a few bucks to Elmar, the guy not only offering such great software, but always answering all our questions!