Device Tree Compiler

How does one get the device tree compiler installed on the BBB with Ubuntu (-uname 3.8.13)? I am trying to compile device trees specific to the BBB. I found a guide here for this in the “Thoughts” section, but it didn’t work for me. It would be nice to have a simple explicit set of instructions.

Thanks,

Jacob

Here's a quick script for ubuntu/debian that'll install the patched
dtc, till teh '@' gets accepted upstream..

wget -c https://raw.github.com/RobertCNelson/tools/master/pkgs/dtc.sh
chmod +x dtc.sh
./dtc.sh

Regards,

Thanks! Do I need to install the DTC using sudo apt-get install device-tree-compiler first?

It's up to you, as the repo version of device-tree-compiler will install it to..

/usr/bin/dtc

Where as the script installs it to:
/usr/local/bin/dtc

such that they will not collide..

Regards,

Because, it just doesn't work yet..

if you want to remove the hdmi cape and add the spi..

First disable the hdmi cape on bootup via (in uEnv.txt)

optargs=capemgr.disable_partno=BB-BONELT-HDMI,BB-BONELT-HDMIN

Regards,

A couple issues. I needed to write to and from slots, but everytime I try (even when using sudo) it said permission denied. So I tried changing the permissions with:

sudo chmod ugo+w

At this point it showed write access like below.

`

ubuntu@arm:/sys/devices/bone_capemgr.9$ ls -al
total 0
drwxr-xr-x 6 root root 0 Jan 1 2000 .
drwxr-xr-x 14 root root 0 Jan 1 2000 …
drwxr-xr-x 2 root root 0 Aug 6 23:12 baseboard
lrwxrwxrwx 1 root root 0 Aug 6 23:12 driver → …/…/bus/platform/drivers/bone-capemgr
-r–r--r-- 1 root root 4096 Aug 6 23:12 modalias
drwxr-xr-x 2 root root 0 Aug 6 23:12 power
drwxr-xr-x 2 root root 0 Aug 6 23:12 slot-4
drwxr-xr-x 2 root root 0 Aug 6 23:12 slot-5
-rw-rw-rw- 1 root root 4096 Aug 6 23:20 slots
lrwxrwxrwx 1 root root 0 Jan 1 2000 subsystem → …/…/bus/platform
-rw-r–r-- 1 root root 4096 Jan 1 2000 uevent

`

Next I try to cat slots with:

`

ubuntu@arm:/sys/devices/bone_capemgr.9$ cat slots
0: 54:PF—
1: 55:PF—
2: 56:PF—
3: 57:PF—
4: ff:P-O-L Bone-LT-eMMC-2G,00A0,Texas Instrument,BB-BONE-EMMC-2G
5: ff:P-O-L Bone-Black-HDMI,00A0,Texas Instrument,BB-BONELT-HDMI

`

So I know that I have the HDMI device tree mounted (or whatever the proper verbage for ‘mounted’ is). Now, I also know that this device tree utilizes the pins that I need for SPI1. So i need to remove device tree number 5. Hence, I type the following command that I found here.

`

ubuntu@arm:/sys/devices/bone_capemgr.9$ # echo -5 >/sys/devices/bone_capemgr*/slots
ubuntu@arm:/sys/devices/bone_capemgr.9$ cat slots
0: 54:PF—
1: 55:PF—
2: 56:PF—
3: 57:PF—
4: ff:P-O-L Bone-LT-eMMC-2G,00A0,Texas Instrument,BB-BONE-EMMC-2G
5: ff:P-O-L Bone-Black-HDMI,00A0,Texas Instrument,BB-BONELT-HDMI

`

But as you can see nothing happens. Why is that? I tried a reboot just in case that was what was required, but still the HDMI device tree is present. Also, the permissions that I set get overwritten upon a reboot. Why is it that every time I reboot my system, the user permissions change on slots? Ok, that should be enough to get me going.

Thanks,

Jacob

PS. Sorry for deleting my last post, but I wanted to be more thorough.

sudo sh -c "echo something > somewhere"

Will bypass the permission problem..

or you can load them on startup:
optargs=capemgr.enable_partno=BB-SPI-xyz

Regards,

Robert,

You have been awesome, thanks so much for the assistance. I don’t know if I am just not executing what you are telling me well or what, but it is still not working. I got into my uEnv.txt file (in /boot/uboot) and typed what you told me (see the uEnv.txt below), but now it is showing that I have the HDMIN device tree overlay too when I “cat slots”.

`

kernel_file=zImage
initrd_file=uInitrd
initrd_high=0xffffffff
fdt_high=0xffffffff

#Video: Uncomment to override:
#kms_force_mode=video=HDMI-A-1:1024x768@60

##BeagleBone Cape Overrides
##Note: On the BeagleBone Black, there is also an uEnv.txt in the eMMC, so if these changes do not seem to be makeing a difference…

##BeagleBone Black:
##Disable HDMI/eMMC
#capemgr=capemgr.disable_partno=BB-BONELT-HDMI,BB-BONE-EMMC-2G

console=ttyO0,115200n8

mmcroot=UUID=0a595bd3-2716-41ca-986a-0da77d5ebb0e ro
mmcrootfstype=ext4 rootwait fixrtc

loadkernel=load mmc ${mmcdev}:${mmcpart} 0x80200000 ${kernel_file}
loadinitrd=load mmc ${mmcdev}:${mmcpart} 0x81000000 ${initrd_file}; setenv initrd_size ${filesize}
loadfdt=load mmc ${mmcdev}:${mmcpart} 0x815f0000 /dtbs/${fdtfile}

boot_classic=run loadkernel; run loadinitrd
boot_ftd=run loadkernel; run loadinitrd; run loadfdt

device_args=run expansion_args; run mmcargs
mmcargs=setenv bootargs console=${console} ${optargs} ${kms_force_mode} root=${mmcroot} rootfstype=${mmcrootfstype} ${expansion} ${capemgr}

optargs=expansion_args=setenv expansion ip=${ip_method}
optargs=capemgr.disable_partno=BB-BONELT-HDMI,BB-BONELT-HDMIN

#Classic Board File Boot:
#uenvcmd=run boot_classic; run device_args; bootz 0x80200000 0x81000000:${initrd_size}

#uenvcmd=run boot_classic; run device_args; bootz 0x80200000 0x81000000:${initrd_size}
#New Device Tree Boot:
uenvcmd=run boot_ftd; run device_args; bootz 0x80200000 0x81000000:${initrd_size} 0x815f0000

`

I even tried uncommenting line that disables the HDMI and eMMC. Luckily it didn’t work or I would have been screwed because I am booting off of the eMMC currently (I didn’t realize when I did it that it was supposed to be for the eMMC, obviously). I noticed there is supposedly an eMMC version of the file, but I couldn’t find it. Should I have replaced the “optargs=expansion_arg” line with the one you posted? Sorry I am new to embedded linux, and I have never had to edit a uEnv.txt file, so I don’t want to do something that would mess up the kernel.

But as you can see nothing happens. Why is that? I tried a reboot just in
case that was what was required, but still the HDMI device tree is present.

You have already been told, and it is several other places in the
archives if you search:

Unloading device tree overlays is currently broken. It is an excellent
way to crash your kernel, cause erratic behavior, or just plain mess
things up. If you want something unloaded (like HDMI), you have to tell
the cape manager to not load it in the first place using a kernel
command line switch, typically passed via the uEnv.txt file to uBoot,
but that assumes you are using one of the typical stock images.

See Robert's first reply for a typical uEnv.txt entry that disables HDMI.

Also, the permissions that I set get overwritten upon a reboot. Why
is it that every time I reboot my system, the user permissions change
on slots? Ok, that should be enough to get me going.

Robert gave you the solution, but not the reason. The reason you can't
just "sudo echo whatever > root.owned.file" is the redirection is
happening before the sudo. That's why "sudo sh -c ..." fixes the issue,
the redirection happens after you are granted root privileges.

As for why the permissions change doesn't "stick", that's because sysfs
is a dynamic filesystem generated on the fly. There is no permanent
storage backing it up, so any changes you make disappear when you reboot.

You need to disable both the HDMI and the HDMIN (no audio) versions of
the display driver on the latest images.

I love it when people run old/broken release's. :wink: I can tell by this line:

##Disable HDMI/eMMC
#capemgr=capemgr.disable_partno=BB-BONELT-HDMI,BB-BONE-EMMC-2G

was actually a work/in/progress and in-correct at the time i uploaded
the image.. I think that was the may release. It was fixed in the
June/July releases.. Yuck..

You should atleast upgrade first, to solve a few of the 'other' problems.. :wink:

http://elinux.org/BeagleBoardUbuntu#eMMC:_BeagleBone_Black

Regards,

Charles,

I am aware I have to disable both HDMI and HDMIN. If you’ll notice in the uEnv.txt example that I posted, I used the changed the file to read:

`
optargs=capemgr.disable_partno=BB-BONELT-HDMI,BB-BONELT-HDMIN

`

Which is exactly what Robert told me to do, and as far as I can tell, disables both. Thanks for the heads up though. I wont try to unload device trees that way in the future. Also, keep in mind that there are often contradicting sources online. Hence, one of the reasons for me asking my question about unloading device trees.

Robert,

Ok. I updated to the newest release (7/22) as requested. I think the issue here is that I am changing the wrong uEnv.txt file? I do not have any SD card in, so I would assume that the file system that is mounted is on the eMMC. However, after changing the uEnv.txt (in /boot/uboot/)file to:

`

kernel_file=zImage
initrd_file=uInitrd
initrd_high=0xffffffff
fdt_high=0xffffffff

#Video: Uncomment to override:
#kms_force_mode=video=HDMI-A-1:1024x768@60

##BeagleBone Cape Overrides
##Note: On the BeagleBone Black, there is also an uEnv.txt in the eMMC, so if these changes do not seem to be makeing a difference…

##BeagleBone Black:
##Disable HDMI/eMMC
optargs=capemgr.disable_partno=BB-BONELT-HDMI,BB-BONELT-HDMIN

#,BB-BONE-EMMC-2G ← This does the eMMC too

console=ttyO0,115200n8

mmcroot=UUID=f1200610-1760-4283-99fd-46076bc38371 ro
mmcrootfstype=ext4 rootwait fixrtc

loadkernel=load mmc ${mmcdev}:${mmcpart} 0x80200000 ${kernel_file}
loadinitrd=load mmc ${mmcdev}:${mmcpart} 0x81000000 ${initrd_file}; setenv initrd_size ${filesize}
loadfdt=load mmc ${mmcdev}:${mmcpart} 0x815f0000 /dtbs/${fdtfile}

boot_classic=run loadkernel; run loadinitrd
boot_ftd=run loadkernel; run loadinitrd; run loadfdt

device_args=run expansion_args; run mmcargs
mmcargs=setenv bootargs console=${console} ${optargs} ${kms_force_mode} root=${mmcroot} rootfstype=${mmcrootfstype} ${expansion}

expansion_args=setenv expansion ip=${ip_method}
#Classic Board File Boot:
#uenvcmd=run boot_classic; run device_args; bootz 0x80200000 0x81000000:${initrd_size}

#New Device Tree Boot:
uenvcmd=run boot_ftd; run device_args; bootz 0x80200000 0x81000000:${initrd_size} 0x815f0000

`

Then I rebooted, and I used cat /sys/devices/bone_capemgr.8/slots which resulted in:

`

ubuntu@arm:~$ cat /sys/devices/bone_capemgr.8/slots
0: 54:PF—
1: 55:PF—
2: 56:PF—
3: 57:PF—
4: ff:P-O-L Bone-LT-eMMC-2G,00A0,Texas Instrument,BB-BONE-EMMC-2G
5: ff:P-O-- Bone-Black-HDMI,00A0,Texas Instrument,BB-BONELT-HDMI
6: ff:P-O-- Bone-Black-HDMIN,00A0,Texas Instrument,BB-BONELT-HDMIN

`

So it seems like I am editing the wrong uEnv.txt. If so, where the heck is the other copy, and how do I get to it?

Then I rebooted, and I used cat /sys/devices/bone_capemgr.8/slots which
resulted in:

ubuntu@arm:~$ cat /sys/devices/bone_capemgr.8/slots
0: 54:PF---
1: 55:PF---
2: 56:PF---
3: 57:PF---
4: ff:P-O-L Bone-LT-eMMC-2G,00A0,Texas Instrument,BB-BONE-EMMC-2G
5: ff:P-O-- Bone-Black-HDMI,00A0,Texas Instrument,BB-BONELT-HDMI
6: ff:P-O-- Bone-Black-HDMIN,00A0,Texas Instrument,BB-BONELT-HDMIN

             ^
             No "L" for the HDMI means they are not loaded

Looks like it's working.

So it seems like I am editing the wrong uEnv.txt. If so, where the heck is
the other copy, and how do I get to it?

You can double-check the kernel is getting the correct settings by
running "cat /proc/cmdline" and looking for the capemgr.disable entry.

Use "df" and "mount" to see where your fat partition is mounted (or
mount it somewhere manually if it's not currently mounted) so you know
you are editing the proper uEnv.txt file. Particularly on the default
Angstrom release, IIRC it auto-mounts the FAT partition under /media or
somesuch, but this is done by the gui and only happens if you leave HDMI
enabled. Once you turn off HDMI I think you have to manually mount the
boot partition. RCN's images include the boot partition in fstab, so
it's always in the same place.

From what I understand Jacob Stockton is correct. You can also . . .

cat /sys/kernel/debug/pinctrl/44e10800.pinmux/pinmux-pins | grep HDMI

and you should get no output if they have not loaded. You can test by . . .
cat /sys/kernel/debug/pinctrl/44e10800.pinmux/pinmux-pins | grep emmc

where you should get ten pin instances as a result back. 0-7 and 32, 33 I think they are.

Thanks Charles. Ok, we are almost where I need to be. I got all of the UARTs working (1,2,4,5) that I need and I have i2c-port enabled, but I don’t see the SPI in /dev. The literature I have found says it will be named spi1 or spidev, but I don’t see it in /dev.

`

./pingroups

[sudo] password for ubuntu:
registered pin groups:
group: pinmux_userled_pins
pin 21 (44e10854)
pin 22 (44e10858)
pin 23 (44e1085c)
pin 24 (44e10860)

group: pinmux_rstctl_pins
pin 20 (44e10850)

group: pinmux_i2c0_pins
pin 98 (44e10988)
pin 99 (44e1098c)

group: pinmux_i2c2_pins
pin 94 (44e10978)
pin 95 (44e1097c)

group: pinmux_bb_i2c1_pins
pin 86 (44e10958)
pin 87 (44e1095c)

group: pinmux_bb_uart1_pins
pin 97 (44e10984)
pin 96 (44e10980)

group: pinmux_bb_uart2_pins
pin 84 (44e10950)
pin 85 (44e10954)

group: pinmux_bb_uart4_pins
pin 28 (44e10870)
pin 29 (44e10874)

group: pinmux_bb_uart5_pins
pin 49 (44e108c4)
pin 48 (44e108c0)

group: pinmux_bb_spi1_pins
pin 100 (44e10990)
pin 101 (44e10994)
pin 102 (44e10998)
pin 103 (44e1099c)

group: pinmux_emmc2_pins
pin 32 (44e10880)
pin 33 (44e10884)
pin 0 (44e10800)
pin 1 (44e10804)
pin 2 (44e10808)
pin 3 (44e1080c)
pin 4 (44e10810)
pin 5 (44e10814)
pin 6 (44e10818)
pin 7 (44e1081c)

group: pinmux_userled_pins
pin 21 (44e10854)
pin 22 (44e10858)
pin 23 (44e1085c)
pin 24 (44e10860)

`

And…

`

ls /dev/
alarm loop3 ram3 tty21 tty48 ttyS2
ashmem loop4 ram4 tty22 tty49 ttyS3
autofs loop5 ram5 tty23 tty5 ubi_ctrl
binder loop6 ram6 tty24 tty50 uinput
block loop7 ram7 tty25 tty51 urandom
btrfs-control mapper ram8 tty26 tty52 usbmon0
bus mem ram9 tty27 tty53 usbmon1
char mmcblk0 random tty28 tty54 usbmon2
console mmcblk0boot0 rtc0 tty29 tty55 vcs
cpu_dma_latency mmcblk0boot1 shm tty3 tty56 vcs1
disk mmcblk0p1 snd tty30 tty57 vcs2
fd mmcblk0p2 stderr tty31 tty58 vcs3
full net stdin tty32 tty59 vcs4
fuse network_latency stdout tty33 tty6 vcs5
i2c-0 network_throughput tty tty34 tty60 vcs6
i2c-1 null tty0 tty35 tty61 vcs7
i2c-2 ppp tty1 tty36 tty62 vcsa
input psaux tty10 tty37 tty63 vcsa1
kmem ptmx tty11 tty38 tty7 vcsa2
kmsg pts tty12 tty39 tty8 vcsa3
log ram0 tty13 tty4 tty9 vcsa4
log_events ram1 tty14 tty40 ttyGS0 vcsa5
log_main ram10 tty15 tty41 ttyO0 vcsa6
log_radio ram11 tty16 tty42 ttyO1 vcsa7
log_system ram12 tty17 tty43 ttyO2 watchdog
loop-control ram13 tty18 tty44 ttyO4 watchdog0
loop0 ram14 tty19 tty45 ttyO5 zero
loop1 ram15 tty2 tty46 ttyS0
loop2 ram2 tty20 tty47 ttyS1

`

I know that UARTS are tty01, is the SPI named something similar?

Thanks,

Jacob

If you want SPI in user-space, you need to mark the SPI device as “spidev” compatible in the the dts file. See this recent article from David Anders:
http://elinux.org/BeagleBone_Black_Enable_SPIDEV

Mark

Im looking through David Ander’s article and I just dont understand whats going on when “applying diff to kernel”

could you offer any assistance

Im looking through David Ander’s article and I just dont understand whats going on when “applying diff to kernel”

could you offer any assistance

Open the file drivers/spi/spidev.c and add the line:

       { .compatible = "linux,spidev" },

This line should be placed after the line:

       { .compatible = "rohm,dh2228fv" },

Regards,
John

It’s a patch file to apply to the spidev.c file. As it’s only one line you can simply just edit the file and add the line, then rebuild the file. Mike

Hi Robert,

I am new to BeagleBone. Right now I am stuck up in the intial phase of using SPI0 (once I am able to use SPI0, I would go for SPI1). I tried to run the command for installing device tree compiler, but prompted “bash: dtc not found”

I have on my BBB :

Linux arm 3.8.13xenomai-bone28.1 #1 SMP Thu Nov 21 09:53:58 CET 2013 armv7l armv7l armv7l GNU/Linux

And when I tried to install the dtc by sudo apt-get install dtc, it does not work and gave error like:

Err http://security.ubuntu.com precise-security/universe Translation-en
Something wicked happened resolving ‘security.ubuntu.com:http’ (-11 - System error)

the same error appear when I used apt-get install for other packages.

I googled the error and accordingly two solutions:

  1. http://askubuntu.com/questions/150210/how-do-i-set-systemwide-proxy-servers-in-xubuntu-lubuntu-or-ubuntu-studio

I did what is asked for but still the same results. I want to tell that for checking if my BBB has proxy I used the following command

env | grep -i proxy

Nothing got printed with this command (so there is no proxy) to from the link above I only used the lines
no_proxy=“localhost,127.0.0.1,localaddress,.localdomain.com”
NO_PROXY=“localhost,127.0.0.1,localaddress,.localdomain.com”

But I have a doubt since BBB device connect to PC via USB and when I use a site to find my proxy it gives some IP, but when I used the command “env | grep -i proxy”. It does not print anything. I need your suggestion.

  1. I added these two lines in the file /etc/resolvconf/resolv.conf.d/tail

nameserver 8.8.8.8
nameserver 8.8.4.4

and then sudo /etc/init.d/resolvconf restart

Still apt-get install does not work and gives the same error as

Err http://security.ubuntu.com precise-security/universe Translation-en
Something wicked happened resolving ‘security.ubuntu.com:http’ (-11 - System error)

I would be highly obliged if you would give some suggestions.

BR