NetBSD-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: /dev/tty01 will not open on Beaglebone Black



> On Sep 1, 2023, at 7:05 PM, Brook Milligan <brook%nmsu.edu@localhost> wrote:
> 
>> On Sep 1, 2023, at 5:33 PM, Brett Lymn <blymn%internode.on.net@localhost> wrote:
>> 
>> On Thu, Aug 31, 2023 at 09:02:53PM -0600, Brook Milligan wrote:
>>> 
>>> However, a write fails and hangs the board hard: no keyboard response, no response to pings.  I have attached the test program below, and would appreciate more eyes on it from (the many) people who obviously know serial line programming better than I do.  It gets as far as the write() call, but no further.
>>> 
>> 
>> This sounds like a driver bug.  In no circumstances should a user land program be able to
>> hang a machine.  I would log a kernel PR with your sample code attached.

I’ll submit a PR; what category?  This is likely a kernel bug (so kern?) but it applies to the Beaglebone Black (so port-evbarm?).  I’m thinking the former.

The bug is easy to replicate with just a native installation.  I have attached a file (kernel-hang.tgz) with the necessary bits.

- am335x-boneblack-comm_cape.dtb: a binary device tree file that can be loaded when booting a Beaglebone Black.  See below.  This enables the uart4 as intended for the Beaglebone comms cape, but the cape is not required.

- am335x-boneblack-comm_cape.dts: a device tree source file that enables uart4 as intended for the Beaglebone comms cape.  It includes the am335x-boneblack.dts file, which is the default for the Beaglebone Black.  As a result, the only differences are the few lines in this file.

- am335x-bone-common.dtsi.patch: a patch to replace /include/ with #include so the C preprocessor is happy with all the files.

- am335x-boneblack-comm_cape.dts.pp: the result of running the C preprocessor on am335x-boneblack-comm_cape.dts.

- Makefile: a makefile with two targets: patch and all used to make the other files.  The “patch” target applies the patch and the “all” target runs the C preprocessor and dtc.  Note that ${NETBSD_SRCDIR} should point to the root of the NetBSD source.

Replicating the kernel hang:

- Add the binary device file am335x-boneblack-comm_cape.dtb to /boot/dtb/ on a Beaglebone Black, so that it is available for the next boot.

- Boot into the U-Boot console, i.e., type space in the serial console immediately when U-Boot begins the boot process.

- Enter the following commands into the U-Boot console; this will boot the board with the new device tree:

	setenv bootargs "root=ld0a” 
	fatload mmc 0:1 $kernel_addr_r netbsd-GENERIC.ub 
	fatload mmc 0:1 $fdt_addr_r dtb/am335x-boneblack-comm_cape.dtb 
	bootm $kernel_addr_r - $fdt_addr_r

- When the kernel boots into multiuser, run cu as

	# cu -l /dev/tty01

  This should report “Connected”.  As soon as a character is typed into cu, the kernel will hang.

I would greatly appreciate input on how to address this.

Thanks a lot.

Cheers,
Brook


Attachment: kernel-hang.tgz
Description: Binary data






Home | Main Index | Thread Index | Old Index