Your SlideShare is downloading. ×
0
Kernel Recipes 24th September 2013 @Paris
Custom Booting
Back to the Future
● First presentation of HDT @ KR2012
● Does HDT can define a way to boot ?
– NO, just inspecting hardwa...
Tweaking a Bootloader
● Only the bootloader can do this job
● Making the hardware detection ASAP
● Link between hw propert...
Syslinux
● Syslinux provides libs to get HW information
– CPU
– Memory
– PCI
– DMI
– ACPI
– VESA
– Included since 2009 (3....
Two ways to make it
● Creating specific COM32 modules
– like IFCPU
– Raw C code, compiled against syslinux
● Using LUA scr...
Ifcpu.c32
label ifcpu
com32 ifcpu.c32
append <cpu_features> -- boot_entry_1 -- boot_entry_2
label boot_entry_1
kernel vmli...
Using LUA
DEFAULT lua
label lua
com32 lua.c32
append script.lua
pxelinux.cfg/default
Using LUA
-- Including other modules
package.path = package.path .. ";pxelinux.cfg/?.lua;isolinux/?.lua"
require("hypervis...
Using LUA
function detect_hypervisor (append)
cpuflags = cpu.flags()
if ( string.match(cpuflags["flags.hypervisor"], "yes"...
Enough Slides !
Live Demo !
Thanks !
● IRC : erwan_taf on freenode
● Twitter : erwanaliasr1
● email : erwan.velu@enovance.com
Upcoming SlideShare
Loading in...5
×

Kernel Recipes 2013 - Conditional boot

661

Published on

When booting the same Linux Kernel over various hardware setups, it could necessary to add some arguements on the command line. Usually, people solve this issue by adding a new boot entry which features the necessary arguments.

This lightning talk will be demontrating how Syslinux can add dynamically arguments to the command line or even choose a different kernel regarding some hardware properties.

Published in: Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
661
On Slideshare
0
From Embeds
0
Number of Embeds
2
Actions
Shares
0
Downloads
14
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Transcript of "Kernel Recipes 2013 - Conditional boot"

  1. 1. Kernel Recipes 24th September 2013 @Paris Custom Booting
  2. 2. Back to the Future ● First presentation of HDT @ KR2012 ● Does HDT can define a way to boot ? – NO, just inspecting hardware with a cli/gui ● How can I make my system booting based on hardware properties ?
  3. 3. Tweaking a Bootloader ● Only the bootloader can do this job ● Making the hardware detection ASAP ● Link between hw properties and boot entry/option ● Anyone in the room for hacking grub2 ?
  4. 4. Syslinux ● Syslinux provides libs to get HW information – CPU – Memory – PCI – DMI – ACPI – VESA – Included since 2009 (3.74)
  5. 5. Two ways to make it ● Creating specific COM32 modules – like IFCPU – Raw C code, compiled against syslinux ● Using LUA scripts – Custom defined behaviors based on HW properties
  6. 6. Ifcpu.c32 label ifcpu com32 ifcpu.c32 append <cpu_features> -- boot_entry_1 -- boot_entry_2 label boot_entry_1 kernel vmlinuz_entry1 append ... label boot_entry_2 kernel vmlinuz_entry2 append ... cpu_features could be : 64: x86_64 compatible (lm) hvm: hardware virtualization (hvm or svm) pae : Physical Address Extension (PAE) multicore: multi-core CPUs smp : multi-processor system hypervisor : Running under an hypervisor
  7. 7. Using LUA DEFAULT lua label lua com32 lua.c32 append script.lua pxelinux.cfg/default
  8. 8. Using LUA -- Including other modules package.path = package.path .. ";pxelinux.cfg/?.lua;isolinux/?.lua" require("hypervisor") -- Setting up the original options append="" -- Adjust them regarding the hypervisor detection append=detect_hypervisor(append) -- Booting the kernel print("Booting with " .. append ) kernel = syslinux.loadfile("/vmlinuz") initrd = syslinux.initramfs_init() syslinux.initramfs_load_archive(initrd, "/core.gz"); syslinux.boot_it(kernel, initrd, append) script.lua
  9. 9. Using LUA function detect_hypervisor (append) cpuflags = cpu.flags() if ( string.match(cpuflags["flags.hypervisor"], "yes")) then print ("Hypervisor detected"); append=append .. "nr_cpus=1" else append=append .. "whatever_you_want" end return append end hypervisor.lua
  10. 10. Enough Slides ! Live Demo !
  11. 11. Thanks ! ● IRC : erwan_taf on freenode ● Twitter : erwanaliasr1 ● email : erwan.velu@enovance.com
  1. A particular slide catching your eye?

    Clipping is a handy way to collect important slides you want to go back to later.

×