5

I am using Yocto to build a custom image for my Raspberry Pi2. Followed this tutorial in portuguese and this one in english.

QUESTION 1: Why my config.txt (added by hand) isn't loaded?

I was able to generate my image and my Pi2 booted nicely. Now the distribution I have doesn't have a /boot/config.txt, so I did add one by hand, but It doesn't look like it taking it into account.

QUESTION 2: How do I tell Yocto to create a config.txt with these variables?

# uncomment if hdmi display is not detected and composite is being output
hdmi_force_hotplug=1

# uncomment to force a specific HDMI mode (here we are forcing 800x480!)
hdmi_group=2
hdmi_mode=1
hdmi_mode=87
hdmi_cvt 800 480 60 6 0 0 0

max_usb_current=1
  • 1
    "the distribution I have doesn't have a /boot/config.txt, so I did add one by hand" -> Exactly where and exactly how? I want to rule out the possibility you put in it in the boot folder of the root fs partition but not with the system running. That directory is just a mount point for the first small vfat partition that any configuration of OS on a pi must use -- the same partition that contains the bootloader, firmware, and kernel. But when the system is not running, /boot will be empty and anything you put there inaccessible when it is. – goldilocks May 26 '15 at 12:05
  • You're question as posed in the bounty is different than the one in the original question. Also, there is no such thing as the "rpi-config" module -- I presume you mean raspi-config, which is just an interactive shell script that, among other things, will edit /boot/config.txt. – goldilocks May 26 '15 at 12:14
  • 1
    Make sure that directory is for sure actually what it is on the pi then (a mount point for the first vfat partition; it should contain the kernel and firmware you'd normally see) since /boot is a standard directory on linux beyond the pi, which can create problems/confusion if you are using a non-pi centric distro. E.g, I use Fedora, and I had to create a subdirectory in /boot to mount that partition, so the equivalent of the pi /boot there is actually /boot/rpi. – goldilocks May 26 '15 at 14:06
  • 2
    I'm stressing this point because I believe config.txt is read by the GPU before an OS is even booted, so if it is in the right partition (the first one) it should not make any difference what image you are using. The fact that its not being used implies it either isn't where it is supposed to be, or some settings are being overridden subsequently. – goldilocks May 26 '15 at 14:07
  • 1
    I don't need the bounty, but if you think you've found a solution to this, please post an answer of your own for posterity. I dunno if you can end up collecting your own bounty though ;). – goldilocks May 27 '15 at 1:08
3

Answer to QUESTION 1 (Read Comments section down below question)

The config.txt is read from the FAT32 partition!!! The config.txt I added has no effect indeed. It can't. Read Comment section below.

Partitions

devpts on /dev/pts type devpts (rw,relatime,gid=5,mode=620,ptmxmode=000)
root@raspberrypi2:/# fdisk -l

Disk /dev/mmcblk0: 7948 MB, 7948206080 bytes
4 heads, 32 sectors/track, 121280 cylinders
Units = cylinders of 128 * 512 = 65536 bytes

        Device Boot      Start         End      Blocks  Id System
/dev/mmcblk0p1   *          65         384       20480   c Win95 FAT32 (LBA)
/dev/mmcblk0p2             385        7104      430080  83 Linux

root

root@raspberrypi2:/# ls -al /
drwxr-xr-x   17 root     root          1024 Jan  1  1970 .
drwxr-xr-x   17 root     root          1024 Jan  1  1970 ..
drwxr-xr-x    2 root     root          2048 May 24 19:10 bin
drwxr-xr-x    2 root     root          1024 May 24 19:18 boot
drwxr-xr-x   14 root     root         13240 May 24 19:11 dev
drwxr-xr-x   33 root     root          2048 Jan  1  1970 etc
drwxr-xr-x    3 root     root          1024 May 24 19:09 home
drwxr-xr-x    6 root     root          2048 May 24 19:11 lib
drwx------    2 root     root         12288 May 24 19:11 lost+found
drwxr-xr-x    2 root     root          1024 May 22 14:35 media
drwxr-xr-x    2 root     root          1024 May 22 14:35 mnt
dr-xr-xr-x   88 root     root             0 Jan  1  1970 proc
drwxr-xr-x    8 root     root           380 May 24 19:11 run
drwxr-xr-x    2 root     root          2048 May 24 19:10 sbin
dr-xr-xr-x   11 root     root             0 Jan  1  1970 sys
lrwxrwxrwx    1 root     root             8 Jan  1  1970 tmp -> /var/tmp
drwxr-xr-x    9 root     root          1024 May 22 15:21 usr
drwxr-xr-x    8 root     root          1024 May 22 18:43 var

boot folder

root@raspberrypi2:/boot# ls -al
drwxr-xr-x    2 root     root          1024 May 24 19:18 .
drwxr-xr-x   17 root     root          1024 Jan  1  1970 ..
lrwxrwxrwx    1 root     root            19 May 24 19:10 Image -> /boot/Image-3.18.11
-rw-r--r--    1 root     root       8648032 May 22 20:15 Image-3.18.11
-rw-r--r--    1 root     root          1247 May 24 19:18 config.txt

Created /boot/rpi and mounted the FAT32 partition

root@raspberrypi2:/boot# mount /dev/mmcblk0p1 /boot/rpi
root@raspberrypi2:/boot# ls -al
drwxr-xr-x    3 root     root          1024 May 24 19:16 .
drwxr-xr-x   17 root     root          1024 Jan  1  1970 ..
lrwxrwxrwx    1 root     root            19 May 24 19:10 Image -> /boot/Image-3.18.11
-rw-r--r--    1 root     root       8648032 May 22 20:15 Image-3.18.11
-rw-r--r--    1 root     root          1247 May 24 19:18 config.txt  <=== DELETE THIS
drwxr-xr-x    3 root     root         16384 Jan  1  1970 rpi <===

root@raspberrypi2:/boot# cd rpi

root@raspberrypi2:/boot/rpi# ls -al
drwxr-xr-x    3 root     root         16384 Jan  1  1970 .
drwxr-xr-x    3 root     root          1024 May 24 19:16 ..
-rwxr-xr-x    1 root     root          4702 May 24 12:12 bcm2708-rpi-b-plus.dtb
-rwxr-xr-x    1 root     root          4423 May 24 12:12 bcm2708-rpi-b.dtb
-rwxr-xr-x    1 root     root          5690 May 24 12:12 bcm2709-rpi-2-b.dtb
-rwxr-xr-x    1 root     root             0 May 24 12:12 bcm2835-bootfiles-20150206.stamp
-rwxr-xr-x    1 root     root         17856 May 24 12:12 bootcode.bin
-rwxr-xr-x    1 root     root           117 May 24 12:12 cmdline.txt
-rwxr-xr-x    1 root     root         32874 May 24 12:12 config.txt
-rwxr-xr-x    1 root     root          6133 May 24 12:12 fixup.dat
-rwxr-xr-x    1 root     root          2345 May 24 12:12 fixup_cd.dat
-rwxr-xr-x    1 root     root          9191 May 24 12:12 fixup_x.dat
-rwxr-xr-x    1 root     root            54 May 24 12:12 image-version-info
-rwxr-xr-x    1 root     root       8648032 May 24 12:12 kernel7.img
drwxr-xr-x    2 root     root          2048 May 24 12:12 overlays
-rwxr-xr-x    1 root     root       2641752 May 24 12:12 start.elf
-rwxr-xr-x    1 root     root        554008 May 24 12:12 start_cd.elf
-rwxr-xr-x    1 root     root       3598760 May 24 12:12 start_x.elf

Answer to QUESTION 2 (not tested yet but should work)

In your own .bbappend

COMPATIBLE_MACHINE += "raspberrypi2"

In your image config file in IMAGE_INSTALL add the rpi-config module

In [PATH]/meta-rpi/recipes-bsp/bootfiles/rpi-config_git.bbappend create the function to add the additional variables:

do_deploy_append() {
echo "hdmi_force_hotplug=1" >>${DEPLOYDIR}/bcm2835-bootfiles/config.txt
echo "hdmi_group=2" >>${DEPLOYDIR}/bcm2835-bootfiles/config.txt
echo "hdmi_mode=1" >>${DEPLOYDIR}/bcm2835-bootfiles/config.txt
echo "hdmi_mode=87" >>${DEPLOYDIR}/bcm2835-bootfiles/config.txt
echo "hdmi_cvt 800 480 60 6 0 0 0" >>${DEPLOYDIR}/bcm2835-bootfiles/config.txt
echo "max_usb_current=1" >>${DEPLOYDIR}/bcm2835-bootfiles/config.txt
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.