Automating Kernel Build scripts

I would like to run ./build_kernel.sh from another script. Any idea how I can get it to not stop at menuconfig, or automatically exit menuconfig with no changes?

It’s sorta baked in another a not very descriptive name:

cp -v system.sh.sample system.sh
echo "AUTO_BUILD=1" >> system.sh

Regards,

That worked great. Thanks!

Another question: What’s the best way to handle a custom device tree automatically?

My first attempt is to call ./build_kernel.sh, then replace KERNEL/arch/arm/boot/dts folder with my dts folder containing Makefile, .dts, and includes, then call tools/rebuild.sh.

Is there a better way?

Honestly, it might just be best to fork my project, there’s really not too much churn from release to release… As long as you use git format-patch -1 after committing your changes under ./KERNEL/ just stick a new directory at the end of the ‘drivers’ section of patch.sh

Regards,

OK. Thanks.

Another question: I have several gpios setup in my device tree. I get an error message “Failed to get gpio property of” for the first gpio that uses &gpio0, and then none of the gpios show up in /sys/class/gpio folder. When I comment out the ones that use &gpio0, the other gpios show up in /sys/class/gpio folder. Here’s an example of one of the gpios getting that’s giving me the error message:

gpio {
compatible = “gpio-of-helper”;
status = “okay”;
pinctrl-names = “default”;
pinctrl-0 = <&gpio_pins>;
wastefull {
gpio-name = “wastefull”;
gpio = <&gpio0 2 0>;
input;
};
};

Any ideas what’s going on here?

Also having problems with /dev/uio* missing. I’m trying to update a custom device tree that worked with 4.4.70-bone-rt-r17 to make it work with 5.10.186-bone-rt-r76. I also tried using using am335x-bonegreen device tree that came with 5.10.186-bone-rt-r76 and enabling pru overlay in /boot/uEnv.txt, but /dev/uio* is still missing.

Added these lines to /boot/uEnv.txt
enable_uboot_overlays=1
uboot_overlay_pru=AM335X-PRU-UIO-00A0.dtbo
enable_uboot_cape_universal=1

lsmod |grep uio
uio_pruss 4928 2
uio_pdrv_genirq 3661 0
uio 8760 6 uio_pruss,uio_pdrv_genirq

Any ideas how to troubleshoot this? Oh, and is there a better place/way to get support for these types of questions?

Sorry was traveling, missed this completely…

Do NOT use gpio-of-helper…

What do you want to use the gpio’s for? pru, toggle pin, output, input etc…?

Regards,

what does sudo beagle-version show? what you did ^ works…

Oh, here or https://forum.beagleboard.org/ either case i’m a moderator, and was traveling last week so missed everything…

Regards,

It been awhile, but it appears I’m using gpio-of-helper to set input/output/dir-changeable and init-high/init-low. I believe I needed these setup as soon as possible in the boot process.

Nothing has worked yet. Still missing /dev/uio*, but the kernel modules appear to have been loaded with both my custom device tree and the am335x-bonegreen device tree with AM335X-PRU-UIO-00A0 overlay enable. I don’t know how to tell if adding those lines to /boot/uEnv.txt actually did anything.

I don’t seem to have a beagle-version. I’m the one you helped make a ‘bare’ filesystem, so that’s likely why it’s not there.

Here’s is the bash script, just download and run it locally… https://github.com/rcn-ee/repos/blob/master/bb-beagle-version/suite/bookworm/debian/beagle-version

Add these udev rules;

Regards,

Here’s the output of the beagle-version script:

eeprom:[ÿÿÿÿ*]
model:[TI_AM335x_BeagleBone_Green]
UBOOT: Booted Device-Tree:[am335x-bonegreen.dts]
kernel:[5.10.186-bone-rt-r76]
device-tree-override:[uname_boot=run check_recovery; setenv bootdir /boot; setenv bootfile vmlinuz-${uname_r}; if test -e ${interface} ${bootpart} ${bootdir}/${bootfile}; then echo loading ${bootdir}/${bootfile} ...; run loadimage; setenv fdtdir /boot/dtbs/${uname_r}; if test -e ${interface} ${bootpart} ${fdtdir}/${fdtfile}; then run loadfdt; else echo; echo unable to find [dtb=${fdtfile}] did you name it correctly? ...; run failumsboot; fi; setenv rdfile initrd.img-${uname_r}; if test -n ${uenv_root}; then run args_uenv_root; else run args_mmc_old; fi; echo debug: [${bootargs}] ... ; echo debug: [bootz ${loadaddr} - ${fdtaddr}] ... ; bootz ${loadaddr} - ${fdtaddr}; fi;]
/boot/uEnv.txt Settings:
/uEnv.txt exists, uboot overlays is DISABLED, remove /uEnv.txt
uboot_overlay_options:[enable_uboot_overlays=1]
uboot_overlay_options:[uboot_overlay_pru=AM335X-PRU-UIO-00A0.dtbo]
uboot_overlay_options:[enable_uboot_cape_universal=1]
pkg check: to individually upgrade run: [sudo apt install --only-upgrade <pkg>]
WARNING:pkg:[bb-cape-overlays]:[NOT_INSTALLED]
WARNING:pkg:[bb-customizations]:[NOT_INSTALLED]
WARNING:pkg:[bb-usb-gadgets]:[NOT_INSTALLED]
WARNING:pkg:[bb-wl18xx-firmware]:[NOT_INSTALLED]
pkg:[kmod]:[28-1]
WARNING:pkg:[librobotcontrol]:[NOT_INSTALLED]
WARNING:pkg:[firmware-ti-connectivity]:[NOT_INSTALLED]
groups:[debian : debian adm kmem dialout cdrom floppy audio dip video plugdev users systemd-journal input render netdev admin i2c tisdk weston-launch bluetooth cloud9ide gpio]
cmdline:[console=tty0 console=ttyS1,115200n8 console=ttyS1,115200n8 lcd_detect=0xfff7ff ipaddr= serverip= gatewayip= netmask=255.255.255.0 root=/dev/mmcblk0p2 ro rootfstype=ext4 rootwait fsck.mode=force fsck.repair=yes uio_pruss.extram_pool_sz=0x200000 net.ifnames=0]
dmesg | grep remote
dmesg | grep pru
[    0.000000] Kernel command line: console=tty0 console=ttyS1,115200n8 console=ttyS1,115200n8 lcd_detect=0xfff7ff ipaddr= serverip= gatewayip= netmask=255.255.255.0 root=/dev/mmcblk0p2 ro rootfstype=ext4 rootwait fsck.mode=force fsck.repair=yes uio_pruss.extram_pool_sz=0x200000 net.ifnames=0
dmesg | grep pinctrl-single
[    1.543174] pinctrl-single 44e10800.pinmux: 142 pins, size 568
dmesg | grep gpio-of-helper
dmesg | grep wlcore
lsusb
Bus 001 Device 002: ID 0781:5571 SanDisk Corp. Cruzer Fit
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
END

ah, that explains it… cool, you’ve encoded your own script into uname_boot, thus disabling all u-boot logic else-where… So it’s up to you to manually load AM335X-PRU-UIO-00A0.dtbo yourself in u-boot…

Regards,

Oh, I needed a way to easily recover a “bricked” product in the field. The “check_recovery” checks for a recovery image on the USB drive and copies over the broken image. That’s why I needed the ‘bare’ filesystem, because u-boot wants to copy the image into ram before it copies it to mmc, so the image has to be less than 512MB. Everything after “check _recovery” was copied from uname_boot in u-boot source code, but I did strip out some logic that wasn’t being used for my case. Maybe I stripped out too much. I’ll look into that.

I removed the uname_boot from /boot/uEnv.txt. This is what is looks like now:

uname_r=5.10.186-bone-rt-r76
enable_uboot_overlays=1
uboot_overlay_pru=AM335X-PRU-UIO-00A0.dtbo
enable_uboot_cape_universal=1
cmdline=fsck.mode=force fsck.repair=yes uio_pruss.extram_pool_sz=0x200000 net.ifnames=0

Still no /dev/uio*. Here are the results of beagle-version:

eeprom:[ÿÿÿÿ*]
model:[TI_AM335x_BeagleBone_Green]
UBOOT: Booted Device-Tree:[am335x-bonegreen.dts]
kernel:[5.10.186-bone-rt-r76]
/boot/uEnv.txt Settings:
/uEnv.txt exists, uboot overlays is DISABLED, remove /uEnv.txt
uboot_overlay_options:[enable_uboot_overlays=1]
uboot_overlay_options:[uboot_overlay_pru=AM335X-PRU-UIO-00A0.dtbo]
uboot_overlay_options:[enable_uboot_cape_universal=1]
pkg check: to individually upgrade run: [sudo apt install --only-upgrade ]
WARNING:pkg:[bb-cape-overlays]:[NOT_INSTALLED]
WARNING:pkg:[bb-customizations]:[NOT_INSTALLED]
WARNING:pkg:[bb-usb-gadgets]:[NOT_INSTALLED]
WARNING:pkg:[bb-wl18xx-firmware]:[NOT_INSTALLED]
pkg:[kmod]:[28-1]
WARNING:pkg:[librobotcontrol]:[NOT_INSTALLED]
WARNING:pkg:[firmware-ti-connectivity]:[NOT_INSTALLED]
groups:[debian : debian adm kmem dialout cdrom floppy audio dip video plugdev users systemd-journal input render netdev admin i2c tisdk weston-launch bluetooth cloud9ide gpio]
cmdline:[console=tty0 console=ttyS1,115200n8 console=ttyS1,115200n8 lcd_detect=0xfff7ff ipaddr= serverip= gatewayip= netmask=255.255.255.0 root=/dev/mmcblk0p2 ro rootfstype=ext4 rootwait fsck.mode=force fsck.repair=yes uio_pruss.extram_pool_sz=0x200000 net.ifnames=0]
dmesg | grep remote
dmesg | grep pru
[ 0.000000] Kernel command line: console=tty0 console=ttyS1,115200n8 console=ttyS1,115200n8 lcd_detect=0xfff7ff ipaddr= serverip= gatewayip= netmask=255.255.255.0 root=/dev/mmcblk0p2 ro rootfstype=ext4 rootwait fsck.mode=force fsck.repair=yes uio_pruss.extram_pool_sz=0x200000 net.ifnames=0
dmesg | grep pinctrl-single
[ 1.571793] pinctrl-single 44e10800.pinmux: 142 pins, size 568
dmesg | grep gpio-of-helper
dmesg | grep wlcore
lsusb
Bus 001 Device 002: ID 0781:5571 SanDisk Corp. Cruzer Fit
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
END

I am using a 2016 version of u-boot, but I don’t think it predates any of the parameter set in uEnv.txt. I found similar instructions to add these parameters from 2016. I put alot of effort to add LCD support to u-boot, so I’m saving that upgrade for last.

so, /boot/uEnv.txt is ignored…

Regards,

PS, honestly, with your u-boot customization let’s just skip overlays… We can build your device tree with fdtoverlay:

fdtoverlay -i am335x-bonegreen.dtb -o am335x-bonegreen.dtb AM335X-PRU-UIO-00A0.dtbo

Regards,

/uEnv.txt is there for boards that boot from eMMC. I don’t believe it gest loaded when booting from SD card.

I removed it, but /uEnv.txt had this:

uenv_root=PARTUUID=9d0be788-8e92-374a-910f-5d3b1bedce3c
uenvcmd=mw.b 0x44E10042 0x40;if test “{lcd_detect}" = "0xfffffe"; then setenv dtb am335x-bonegreen640x480.dtb; elif test "{lcd_detect}” = “0xffefff”; then setenv dtb am335x-bonegreen480x272.dtb; else setenv dtb am335x-bonegreen800x480.dtb; fi;setenv interface mmc;setenv mmcdev 1;setenv bootpart 1:1;

/boot/uEnv.txt gets loaded when booting from SD card:

uname_r=5.10.186-bone-rt-r76
enable_uboot_overlays=1
uboot_overlay_pru=AM335X-PRU-UIO-00A0.dtbo
enable_uboot_cape_universal=1
cmdline=fsck.mode=force fsck.repair=yes uio_pruss.extram_pool_sz=0x200000 net.ifnames=0

There is also a uEnv.txt on a FAT partition with MLO and u-boot. It sets the dtb:

set_bootpart=if test -e mmc 0:3 /boot/uEnv.txt; then setenv bootpart 0:3; else setenv bootpart 0:2; fi;
uenvcmd=setenv console ${console} console=ttyS1,115200n8;setenv stderr ns16550_serial;setenv stdout ns16550_serial;mw.b 0x44E10042 0x40;setenv dtb am335x-bonegreen.dtb;setenv interface mmc;setenv mmcdev 0;run set_bootpart;

Here’s output of beagle-version after removing /uEnv.txt

eeprom:[ÿÿÿÿ*]
model:[TI_AM335x_BeagleBone_Green]
UBOOT: Booted Device-Tree:[am335x-bonegreen.dts]
kernel:[5.10.186-bone-rt-r76]
/boot/uEnv.txt Settings:
uboot_overlay_options:[enable_uboot_overlays=1]
uboot_overlay_options:[uboot_overlay_pru=AM335X-PRU-UIO-00A0.dtbo]
uboot_overlay_options:[enable_uboot_cape_universal=1]
pkg check: to individually upgrade run: [sudo apt install --only-upgrade ]
WARNING:pkg:[bb-cape-overlays]:[NOT_INSTALLED]
WARNING:pkg:[bb-customizations]:[NOT_INSTALLED]
WARNING:pkg:[bb-usb-gadgets]:[NOT_INSTALLED]
WARNING:pkg:[bb-wl18xx-firmware]:[NOT_INSTALLED]
pkg:[kmod]:[28-1]
WARNING:pkg:[librobotcontrol]:[NOT_INSTALLED]
WARNING:pkg:[firmware-ti-connectivity]:[NOT_INSTALLED]
groups:[debian : debian adm kmem dialout cdrom floppy audio dip video plugdev users systemd-journal input render netdev admin i2c tisdk weston-launch bluetooth cloud9ide gpio]
cmdline:[console=tty0 console=ttyS1,115200n8 console=ttyS1,115200n8 lcd_detect=0xfff7ff ipaddr= serverip= gatewayip= netmask=255.255.255.0 root=/dev/mmcblk0p2 ro rootfstype=ext4 rootwait fsck.mode=force fsck.repair=yes uio_pruss.extram_pool_sz=0x200000 net.ifnames=0]
dmesg | grep remote
dmesg | grep pru
[ 0.000000] Kernel command line: console=tty0 console=ttyS1,115200n8 console=ttyS1,115200n8 lcd_detect=0xfff7ff ipaddr= serverip= gatewayip= netmask=255.255.255.0 root=/dev/mmcblk0p2 ro rootfstype=ext4 rootwait fsck.mode=force fsck.repair=yes uio_pruss.extram_pool_sz=0x200000 net.ifnames=0
dmesg | grep pinctrl-single
[ 1.570239] pinctrl-single 44e10800.pinmux: 142 pins, size 568
dmesg | grep gpio-of-helper
dmesg | grep wlcore
lsusb
Bus 001 Device 002: ID 0781:5571 SanDisk Corp. Cruzer Fit
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
END

/uEnv.txt is always loaded ‘first’ by default going back 10 years in our builds of u-boot…

Regards,