LCA2012 – Wednesday last session

The Samba tour of scripting languages – Amitay Isaacs and Andrew Bartlett

  • Samba is C based
  • But seems to have a lot of scripting
  • Has to be portable no non-gnu systems like solaris, reply on POSIX sh, make (not gun make), awk, m4 and a c compiler
  • shell scripts for first testing. Over 10,000 lines if shell in building
  • Python , TCL and Lua bindings all added but unpopular and eventually removed
  • Perl over 20,00 lines
  • IDL build initially in awk. Switched to perl based PIDL
  • javascript before it was cool – embedded javascript engine
  • But the cool kids were using python so switched from Javascript to python
  • Exception based languages things cleaner
  • waf is python based build system
  • python bindings for most things, or via C hook
  • Lots of other stuff being written into python, called directly by samba for small tasks
  • 90,000 lines of python
  • Example: Samba3 upgrade –  python based tool in 3 weeks. Business login in python, exceptions test for bad input
  • At build time python checks to see if ABI has changed from previously and alert developer if it has.
  • Test frameworks – unit tests on standalone components. Environmental tests with everything running, different types on server setups, fake ips and tests made. All runnable as non-root
  • 9000 test in 1300 test suites. Mosts test in C, some in python or shell

 

 

Running Python in Grub – Josh Triplett

  •  ” I ported python to grub “
  • perception that Linux doesn’t need BIOS
  • Involves programming hardware in functional/safe/optismise configuration
  • Lots of stuff to support, a few decades of compatibility, very bare-metal programming, small number of people working on it
  • What can go wrong: Broken or disabled CPU features, missing or broken memory, sub-optimal power mngt, delays & latency, USB bios handoff. Undocumented customer interfaces
  • Why not test under Linux? Linux gets in the way, no direct BIOS access for tests
  • Grub2 – 32 bit addresses, written in C, can read files, menus, single thread, no OS to disturb, only uses a bit of BIOS itself
  • ORigin: Replacing DOS test programs, test for power mngt, new grub commands for command-line.
  • Grub script language – bashish, no expressions, can just glue things together in menus, have to write lots of C
  • Ported CPython 2.7 to GRUB
  • Wrote a C/Posix compatibility layer for GRUB, floating point functionality via fdlibm , ported much of python standard library
  • Build C extension modules, added “bits” module to access platform functionality
  • ACPICA already in Linux for parsing ACPI. ported as a grub module with python module to access it.
  • bits passes grub command line to python for python to parse
  • FUSE for Python and GRUB.  added a python device reading python/foo invokes a python callback.
  • logging to in-memory buffer and sends to log in FUSE via system. Save to ACPI table and then OS can grab it later
  • SMP support in grub, pyton scripting in ring0, python modules for platform interfaces CPU, PCI, PCI-e, ACPI including decoding and method evaluation, logging, test suite evaluation
  • BITS test: power mngt configuration, perf optimisation, CPU config registers, SMI frequency/latency , USB handoff from BIOS to OS including effects on SMI and C states.
  • Used by BIOS vendors before shipping boards, BIOS problems actually get fixed!
  • http://biosbits.org/
  • Freakiest stuff I’ve seen so far this week
Share