Category Archives: Work

Stuff about work

PXE Grub and All in One Images

So one little advertised feature of grub is grub-mkstandalone. Over the past week I have been playing with grub-mkstandalone to create grub.efi for a new board. We had an issue that the default grub with CentOS 7 performs badly on some EFI firmware when using tftp and it suddenly occured to me that grub-mkstandalone allows you to put file into the grub.efi itself.

So for the arm64 server I was working on.

grub-mkstandalone -O arm64-efi -o grub.efi boot/grub/grub.cfg Image

The contect of the boot/grub/grub.cfg

set timeout=5

menuentry 'Centos Image' --class os {
echo 'Loading Linux ...'
linux (memdisk)/Image earlycon=uart8250,mmio32,0x80300000 console=ttyS0,115200 acpi=force ip=dhcp root=/dev/nfs rw

# echo 'Loading initial ramdisk ...'
# initrd (tftp)/boot/initrd

And can now load Image without using the tftp implementation in grub 😀

Example DSDT for FVP Base Model

As a follow-on from yesterdays post, for development work like the rest of the arm64 community we had to spend a long time working with the models as hardware was not available. So here is a example DSDT for FVP Base Model.

DefinitionBlock (
 "dsdt.aml", // output filename
 "DSDT", // table signature
 2, // DSDT compliance revision
 "RTSMVEV8", // table ID
 0x00000004) // OEM revision
 Scope (\_SB)
 Method (_OSC, 4, NotSerialized)
 /* Platform-Wide OSPM Capabilities */
 /* APEI support unconditionally */
 Return (Arg3)
 } Else {
 CreateDWordField (Arg3, Zero, CDW1)
 /* Set invalid UUID error bit */
 Or (CDW1, 0x04, CDW1)
 Return (Arg3)

 // Two Emulated aarch64 CPUs each with 4 cores
 Device(CPU0) { // Cluster 0, Cpu 0
 Name(_HID, "ACPI0007")
 Name(_UID, 0)
 Device(CPU1) { // Cluster 0, Cpu 1
 Name(_HID, "ACPI0007")
 Name(_UID, 1)
 Device(CPU2) { // Cluster 0, Cpu 2
 Name(_HID, "ACPI0007")
 Name(_UID, 2)
 Device(CPU3) { // Cluster 0, Cpu 3
 Name(_HID, "ACPI0007")
 Name(_UID, 3)
 Device(CPU4) { // Cluster 1, Cpu 0
 Name(_HID, "ACPI0007")
 Name(_UID, 4)
 Device(CPU5) { // Cluster 1, Cpu 1
 Name(_HID, "ACPI0007")
 Name(_UID, 5)
 Device(CPU6) { // Cluster 1, Cpu 2
 Name(_HID, "ACPI0007")
 Name(_UID, 6)
 Device(CPU7) { // Cluster 1, Cpu 3
 Name(_HID, "ACPI0007")
 Name(_UID, 7)

 // SMC91X
 Device (NET0) {
 Name (_HID, "LNRO0003")
 Name (_UID, 0)

 Name (_CRS, ResourceTemplate () {
 Memory32Fixed (ReadWrite, 0x1a000000, 0x00010000)
 Interrupt (ResourceConsumer, Level, ActiveHigh, Exclusive, , , ) {0x2F}

 Device (SREG) {
 Name (_HID, "LNRO0009")
 Name (_UID, 0)

 Method (_CRS, 0x0, Serialized) {
 Name (RBUF, ResourceTemplate() {
 Memory32Fixed (ReadWrite, 0x1c010000, 0x1000)
 Return (RBUF)

 Device (VIRT) {
 Name (_HID, "LNRO0005")
 Name (_UID, 0)

 Name (_CRS, ResourceTemplate() {
 Memory32Fixed (ReadWrite, 0x1c130000, 0x1000)
 Interrupt (ResourceConsumer, Level, ActiveHigh, Exclusive) {0x4A}

 // UART PL011
 Device(COM0) {
 Name(_HID, "ARMH0011")
 Name(_CID, "PL011")
 Name(_UID, Zero)

 Name(_CRS, ResourceTemplate() {
 Memory32Fixed(ReadWrite, 0x1c090000, 0x1000)
 Interrupt(ResourceConsumer, Level, ActiveHigh, Exclusive) { 0x25 }

Juno booting from ACPI tables.

So my work at Linaro for the last year and a half has been on bring ACPI to arm64. The first actual hardware platform that this work can be booted on is the Juno development board.

Using the ACPI tables devloped for MS Windows and published by ARM

And the kernel based on the series of patches published by Linaro on LKML

It is now possible to boot the Juno to userspace (using root on NFS as the USB support is not in mainline yet).

Here is dmesg of successful boot.

Initializing cgroup subsys cpu
Linux version 3.17.0-rc2+ (graeme@xora-haswell) (gcc version 4.8.3 20140401 (prerelease) (crosstool-NG linaro-1.13.1-4.8-2014.04 - Linaro GCC 4.8-2014.04) ) #168 SMP PREEMPT Fri Aug 29 17:11:37 BST 2014
CPU: AArch64 Processor [410fd030] revision 0
Detected VIPT I-cache on CPU0
Early serial console at I/O port 0x0 (options '')
bootconsole [uart0] enabled
efi: Getting EFI parameters from FDT:
EFI v2.40 by ARM Juno EFI Aug 7 2014 10:38:36
efi: ACPI=0xf9b80000 ACPI 2.0=0xf9b80014 
ACPI: Early table checksum verification disabled
ACPI: RSDP 0x00000000F9B80014 000024 (v02 ARMLTD)
ACPI: XSDT 0x00000000F9B7F0E8 00003C (v01 ARMLTD ARM-JUNO 20140727 01000013)
ACPI: FACP 0x00000000F9B42000 00010C (v05 ARMLTD ARM-JUNO 20140727 ARM 00000099)
ACPI: DSDT 0x00000000F9B3F000 000317 (v01 ARMLTD ARM-JUNO 20140727 INTL 20140424)
ACPI: GTDT 0x00000000F9B41000 000060 (v01 ARMLTD ARM-JUNO 20140727 ARM 00000099)
ACPI: APIC 0x00000000F9B40000 00020C (v01 ARMLTD ARM-JUNO 20140727 ARM 00000099)
On node 0 totalpages: 519952
 DMA zone: 7112 pages used for memmap
 DMA zone: 0 pages reserved
 DMA zone: 519952 pages, LIFO batch:31
ACPI: GICC (acpi_id[0x0002] address[000000002c02f000] MPDIR[0x100] enabled)
ACPI: GICC (acpi_id[0x0003] address[000000002c02f000] MPDIR[0x101] enabled)
ACPI: GICC (acpi_id[0x0004] address[000000002c02f000] MPDIR[0x102] enabled)
ACPI: GICC (acpi_id[0x0005] address[000000002c02f000] MPDIR[0x103] enabled)
ACPI: GICC (acpi_id[0x0000] address[000000002c02f000] MPDIR[0x0] enabled)
ACPI: GICC (acpi_id[0x0001] address[000000002c02f000] MPDIR[0x1] enabled)
ACPI: 6 CPUs enabled, 6 CPUs total
psci: probing for conduit method from ACPI.
psci: Using standard PSCI v0.2 function IDs
PERCPU: Embedded 11 pages/cpu @ffffffc07ea28000 s13760 r8192 d23104 u45056
pcpu-alloc: s13760 r8192 d23104 u45056 alloc=11*4096
pcpu-alloc: [0] 0 [0] 1 
Built 1 zonelists in Zone order, mobility grouping on. Total pages: 512840
Kernel command line: console=ttySBSA0 earlycon=pl011,0x7ff80000 root=/dev/nfs nfsroot= ip=dhcp
PID hash table entries: 4096 (order: 3, 32768 bytes)
Dentry cache hash table entries: 262144 (order: 9, 2097152 bytes)
Inode-cache hash table entries: 131072 (order: 8, 1048576 bytes)
Memory: 2015420K/2079808K available (4039K kernel code, 256K rwdata, 1484K rodata, 221K init, 185K bss, 64388K reserved)
Virtual kernel memory layout:
 vmalloc : 0xffffff8000000000 - 0xffffffbdffff0000 ( 247 GB)
 vmemmap : 0xffffffbe00000000 - 0xffffffbfc0000000 ( 7 GB maximum)
 0xffffffbe01c00000 - 0xffffffbe037c8000 ( 27 MB actual)
 PCI I/O : 0xffffffbffa000000 - 0xffffffbffb000000 ( 16 MB)
 fixed : 0xffffffbffbdfe000 - 0xffffffbffbdff000 ( 4 KB)
 modules : 0xffffffbffc000000 - 0xffffffc000000000 ( 64 MB)
 memory : 0xffffffc000000000 - 0xffffffc07f000000 ( 2032 MB)
 .init : 0xffffffc0005e6000 - 0xffffffc00061d5c0 ( 222 KB)
 .text : 0xffffffc000080000 - 0xffffffc0005e5dd4 ( 5528 KB)
 .data : 0xffffffc00061e000 - 0xffffffc00065e1e0 ( 257 KB)
SLUB: HWalign=64, Order=0-3, MinObjects=0, CPUs=2, Nodes=1
Preemptible hierarchical RCU implementation.
 RCU restricting CPUs from NR_CPUS=8 to nr_cpu_ids=2.
RCU: Adjusting geometry for rcu_fanout_leaf=16, nr_cpu_ids=2
NR_IRQS:64 nr_irqs:64 0
clocksource_of_init: no matching clocksources found
Architected cp15 timer(s) running at 50.00MHz (phys).
sched_clock: 56 bits at 50MHz, resolution 20ns, wraps every 2748779069440ns
Console: colour dummy device 80x25
Calibrating delay loop (skipped), value calculated using timer frequency.. 100.00 BogoMIPS (lpj=500000)
pid_max: default: 32768 minimum: 301
ACPI: Core revision 20140724
ACPI: All ACPI Tables successfully acquired
Mount-cache hash table entries: 4096 (order: 3, 32768 bytes)
Mountpoint-cache hash table entries: 4096 (order: 3, 32768 bytes)
No CPU information found in DT
hw perfevents: enabled with arm/armv8-pmuv3 PMU driver, 7 counters available
Remapping and enabling EFI services.
Freed 0x18cb000 bytes of EFI boot services memory
CPU1: Booted secondary processor
Detected PIPT I-cache on CPU1
Brought up 2 CPUs
SMP: Total of 2 processors activated.
devtmpfs: initialized
atomic64_test: passed
regulator-dummy: no parameters
NET: Registered protocol family 16
cpuidle: using governor ladder
cpuidle: using governor menu
vdso: 2 pages (1 code @ ffffffc000625000, 1 data @ ffffffc000624000)
hw-breakpoint: found 6 breakpoint and 4 watchpoint registers.
software IO TLB [mem 0xfe400000-0xfe800000] (4MB) mapped at [ffffffc07e400000-ffffffc07e7fffff]
Serial: AMBA PL011 UART driver
ACPI: Added _OSI(Module Device)
ACPI: Added _OSI(Processor Device)
ACPI: Added _OSI(3.0 _SCP Extensions)
ACPI: Added _OSI(Processor Aggregator Device)
ACPI: Interpreter enabled
ACPI Exception: AE_NOT_FOUND, While evaluating Sleep State [\_S1_] (20140724/hwxface-580)
ACPI Exception: AE_NOT_FOUND, While evaluating Sleep State [\_S2_] (20140724/hwxface-580)
ACPI Exception: AE_NOT_FOUND, While evaluating Sleep State [\_S3_] (20140724/hwxface-580)
ACPI Exception: AE_NOT_FOUND, While evaluating Sleep State [\_S5_] (20140724/hwxface-580)
ACPI: (supports S0)
ACPI: Using GIC for interrupt routing
SCSI subsystem initialized
Switched to clocksource arch_sys_counter
pnp: PnP ACPI init
pnp: PnP ACPI: found 0 devices
NET: Registered protocol family 2
TCP established hash table entries: 16384 (order: 5, 131072 bytes)
TCP bind hash table entries: 16384 (order: 6, 262144 bytes)
TCP: Hash tables configured (established 16384 bind 16384)
TCP: reno registered
UDP hash table entries: 1024 (order: 3, 32768 bytes)
UDP-Lite hash table entries: 1024 (order: 3, 32768 bytes)
NET: Registered protocol family 1
RPC: Registered named UNIX socket transport module.
RPC: Registered udp transport module.
RPC: Registered tcp transport module.
RPC: Registered tcp NFSv4.1 backchannel transport module.
futex hash table entries: 512 (order: 3, 32768 bytes)
fuse init (API version 7.23)
msgmni has been set to 3985
io scheduler noop registered
io scheduler cfq registered (default)
Serial: 8250/16550 driver, 4 ports, IRQ sharing disabled
console [ttySBSA0] enabled
bootconsole [uart0] disabled
ARMH9118:00 supply vdd33a not found, using dummy regulator
ARMH9118:00 supply vddvario not found, using dummy regulator
libphy: smsc911x-mdio: probed
smsc911x ARMH9118:00 eth0: attached PHY driver [Generic PHY] (mii_bus:phy_addr=ARMH9118:00-ffff:01, irq=-1)
smsc911x ARMH9118:00 eth0: MAC Address: 00:02:f7:00:58:7b
mousedev: PS/2 mouse device common for all mice
TCP: cubic registered
NET: Registered protocol family 17
drivers/rtc/hctosys.c: unable to open rtc device (rtc0)
smsc911x ARMH9118:00 eth0: SMSC911x/921x identified at 0xffffff8000008000, IRQ: 192
Sending DHCP requests ., OK
IP-Config: Got DHCP answer from, my address is
IP-Config: Complete:
 device=eth0, hwaddr=00:02:f7:00:58:7b, ipaddr=, mask=, gw=
 host=,, nis-domain=(none)
 bootserver=, rootserver=, rootpath=
 nameserver0=, nameserver1=
VFS: Mounted root (nfs filesystem) readonly on device 0:13.
Freeing unused kernel memory: 220K (ffffffc0005e6000 - ffffffc00061d000)

Chromebook Ubuntu 13.04 Touchpad Fix

This one is nice and simple, to fix the sensitivity of the touchpad back to what you were used to under ChromeOS.

xinput set-prop 7 "Synaptics Finger" 5 5 256

If I could work out where xfce4 keeps its autostart files then I could get this to run at startup.


I blame ‘hrw’ for showing off his Chromebook at Connect, but when I returned to the UK I obtained one.

Running chrome itself is of little interest to me, much more interested in using it as a laptop. So first of all I used ChrUbuntu to get a 12.04 on it. Then I followed hrw’s instructions how to upgrade to 13.04. I messed it up a couple of times but eventually succeeded.

I will say two tips before rebooting, make sure you have ssh server running, and make sure you have a /etc/X11/xorg.conf working. Also if you are doing internal its really helpful to already have a valid install on external SD card you can boot in emergency.

It seems at the moment armsoc Xorg driver prevents suspend by crashing on VT change and then forcing a VT change when it restarts. So if you actually want to use the device you might need to switch to fbdev driver for now!

Very nice little device, I hope more of this sort of low power laptop appear to replace the now killed netbook market.


Synaptic Touchpad Configuration LXDE

This is probably not the cleanest or the neatest way to do this but until LXDE gets a synaptic applet of its own its one way to configure your touchpad on login so it functions how you want it.

First create a file $HOME/bin/ with you configuration set using synclient.

#! /bin/sh

synclient TapButton1=1
synclient TapButton2=3
synclient TapButton3=2

And make it executable chmod 755 $HOME/bin/

Now create a file to autostart this on login $HOME/.config/autostart/touchpad.desktop.

[Desktop Entry]
GenericName=Touchpad Config
Comment=Personal Touchpad Settings

This is probably not standards compliant ;-).

Now if you logout and login your touchpad should be configured correctly. If you copied my setting one finger tap for left button, two finger tap for right button, three finger tap for middle button.

Crazy Emacsen

Stole most of this from a blog.

But crazy emacsen for setting base directory for kernel compiles and a correct for me compile command.

((nil . (
    (eval . (setq default-directory (locate-dominating-file
        buffer-file-name ".dir-locals.el")
    (compile-command . "make ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabi- -j4 uImage")

Chrooting for Droid

I bet we have all found the issue that building random BSP versions of Android require old versions of Ubuntu which we long ago upgraded or don’t run at all.

This is easilly fixed with a few tools which are available on most distros these days, I happen to be using Fedora 18(ish) but similar should work on any distro.

Firstly install schroot, debootstrap and dpkg.

yum install schroot debootstrap dpkg

Make somewhere to install our chroots

mkdir /chroot/lucid-64

Now install the lucid 64bit into this, I am running from 64bit and want 64bit so its all easy.

debootstrap lucid /chroot/lucid-64

Now create the file /etc/schroot/chroot.d/lucid-64.conf

description="Lucid 64bit for Android"

If you need to import some filesystems into you chroot automatically then check the file /etc/schroot/default/fstab, home is already included but you may wish to import things like your build directory if it is not in home.

Now run schroot to enter your chroot and use su to get to root user.

Final task is to install a few packages needed for a build, your may need different packages, this is just a list needed for random BSP.

apt-get install git-core flex bison gperf libesd0-dev zip gawk ant zlib1g-dev build-essential tofrodos bc
apt-get install lib32readline5-dev libstdc++6 lib32z1 lib32z1-dev lib32ncurses5 lib32bz2-1.0 lib32asound2 g++-multilib libx11-dev libncurses5-dev uboot-mkimage

One thing to watch out is not mixing repo/git operation inside and outside the chroot as there are likely different versions of git and it gets a little upset.

OpenVPN Reliability

It has always puzzled me why OpenVPN is much more reliable run by hand from command line than via NetworkManager. I think I have finally discovered the cause thanks to a Ubuntu bug report on Launchpad.

Launchpad Bug

This links to the official OpenVPN bug filed

OpenVPN Bug

I have applied the workaround in the launchpad ticket to my Fedora 18(ish) system and it certainly seems to have improved the situation a lot.

Lucid on Omapzoom2

So Ive been doing some work getting a Ubuntu Lucid beta image running on the zoom2 machine. This is basically the same image as what runs on a beagle slightly modded for zoom2 (serial is different port). Running the Netbook Remix version. I have two external keyboards and a mouse plugged in via usb hub and of course the debug board for networking. This is a photo so you can see it is really running 🙂

I used the kernel image that we use for Ångström images as Ubuntu doesn’t have a zoom2 kernel yet.

And this is a screen shot taken on the zoom2 (you’ll just have to believe me).