Device Tree Hacking/Adding CPU: Difference between revisions

From OLPC
Jump to navigation Jump to search
(Created page with '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" de…')
 
No edit summary
 
Line 16: Line 16:
ok finish-device
ok finish-device
ok dend
ok dend
ok boot
ok boot█


To add under script control, place these lines before the final boot:
To add under script control, place these lines before the final boot:
Line 29: Line 29:
finish-device
finish-device
dend
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:
Verify using shell commands:
Line 40: Line 63:
-r--r--r-- 1 root root 5 Sep 15 08:40 name
-r--r--r-- 1 root root 5 Sep 15 08:40 name
-r--r--r-- 1 root root 4 Sep 15 08:40 phandle
-r--r--r-- 1 root root 4 Sep 15 08:40 phandle
# █
bash-4.2#

Latest revision as of 08:46, 15 September 2014

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
# █