Kernel Recipes 2013 - Conditional boot

  • 497 views
Uploaded 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 …

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.

More in: Technology
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Be the first to comment
    Be the first to like this
No Downloads

Views

Total Views
497
On Slideshare
0
From Embeds
0
Number of Embeds
2

Actions

Shares
Downloads
11
Comments
0
Likes
0

Embeds 0

No embeds

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
    No notes for slide

Transcript

  • 1. Kernel Recipes 24th September 2013 @Paris Custom Booting
  • 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. 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. Syslinux ● Syslinux provides libs to get HW information – CPU – Memory – PCI – DMI – ACPI – VESA – Included since 2009 (3.74)
  • 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. 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. Using LUA DEFAULT lua label lua com32 lua.c32 append script.lua pxelinux.cfg/default
  • 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. 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. Enough Slides ! Live Demo !
  • 11. Thanks ! ● IRC : erwan_taf on freenode ● Twitter : erwanaliasr1 ● email : erwan.velu@enovance.com