Device Tree Hacking/Adding CPU

From OLPC
Jump to: navigation, search

Adding a CPU node to the /cpus node.

XO-4 only.

There is one node already present.

To add another node, temporarily, interactively,

ok dev /cpus
ok new-device
ok " cpu" device-name
ok " cpu" device-type
ok 1 " reg" integer-property
ok : open true ;
ok : close ;
ok finish-device
ok dend
ok boot█

To add under script control, place these lines before the final boot:

dev /cpus
new-device
   " cpu" device-name
   " cpu" device-type
   1 " reg" integer-property
   : open true ;
   : close ;
finish-device
dend

For example, a /boot/olpc.fth file on USB drive may contain:

\ OLPC XO-4 boot script
visible
dev /cpus
new-device
   " cpu" device-name
   " cpu" device-type
   1 " reg" integer-property
   : open true ;
   : close ;
finish-device
dend

: olpc-fth-boot-me
  " rw console=ttyS2,115200 console=tty0 root=/dev/mmcblk0p2 debug" expand$ to boot-file
  " u:\boot\zImage"    expand$ to boot-device
  " int:\boot\initrd.img" expand$ to ramdisk
  boot
;

olpc-fth-boot-me

Verify using shell commands:

# ls -l /proc/device-tree/cpus
total 0
-r--r--r-- 1 root root 4 Sep 15 08:40 #address-cells
-r--r--r-- 1 root root 4 Sep 15 08:40 #size-cells
dr-xr-xr-x 2 root root 0 Sep 15 08:40 cpu@0
dr-xr-xr-x 2 root root 0 Sep 15 08:40 cpu@1
-r--r--r-- 1 root root 5 Sep 15 08:40 name
-r--r--r-- 1 root root 4 Sep 15 08:40 phandle
# █