cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Highlighted
Visitor
Visitor
1,015 Views
Registered: ‎05-25-2018

"Warning: unable to open an initial console" Under Petalinux 2020.1 with Picozed SOM

Jump to solution

Hi All,

I am testing the new Petalinux 2020.1.  I am using a Picozed 7030 SOM with a custom breakout board.  I have a working system using 2018.3.  I would like to update our toolchain to 2020.1 and am conducting some initial tests.

After power-up, I get both u-boot and kernel output to my serial console, but I get no user space output and no login prompt.  The kernel logs generate a warning:

      Warning: unable to open an initial console

Some details on what I did to build the project:

  • Loaded 2018.3 Vivado in 2020.1 and upgraded IP without issue.
  • Built project in 2020.1 and exported XSA without issue.
  • Created a new Zynq project using "% petalinux-create -t project -template zynq".
  • Loaded the hardware configuration using "% petalinux-config --get-hw-description xsa"
  • Build the project using "% petalinux-build"
  • Created boot files for SD card using "% petalinux-package --boot --fsbl images/linux/zynq_fsbl.elf --fpga images/linux/system.bit --u-boot"
  • Copied BOOT.BIN, image.ub, and boot.scr to SD card (NOTE boot.scr is a new file in 2020.1).
  • Open PuTTY to view the serial console output (our breakout board routes a PS serial port to a UART to USB converter).
  • Placed SD card in custom board and applied power.

As noted above, u-boot and the kernel logs correctly displays to the serial console.  I don't get any output from init or user space.  The system is up and running.  I can remote in via ssh and run commands to debug/troubleshoot.  I reverted to my 2018.3 configuration and all works as expected.

A bit of research showed some items to check ...

The device tree has the following:

                serial@e0001000 {
                        compatible = "xlnx,xuartps\0cdns,uart-r1p8";
                        status = "okay";
                        clocks = < 0x01 0x18 0x01 0x29 >;
                        clock-names = "uart_clk\0pclk";
                        reg = < 0xe0001000 0x1000 >;
                        interrupts = < 0x00 0x32 0x04 >;
                        cts-override;
                        device_type = "serial";
                        port-number = < 0x00 >;
                        phandle = < 0x1e >;
                 };

[... removed ...]

       chosen {
                bootargs = "console=ttyPS0,38400 earlycon root=/dev/ram0 rw";
                stdout-path = "serial0:38400n8";
        };

        aliases {
                ethernet0 = "/amba/ethernet@e000b000";
                i2c0 = "/amba/i2c@e0004000";
                serial0 = "/amba/serial@e0001000";
                serial1 = "/amba_pl/serial@42c10000";
                serial2 = "/amba_pl/serial@42c20000";
                serial3 = "/amba/serial@e0000000";
                serial4 = "/amba_pl/serial@42c00000";
                spi0 = "/amba/spi@e000d000";
        };

Reviewing "dmesg" shows:

Booting Linux on physical CPU 0x0
Linux version 5.4.0-xilinx-v2020.1 (oe-user@oe-host) (gcc version 9.2.0 (GCC)) #1 SMP PREEMPT Thu Jun 11 17:15:46 UTC 2020
CPU: ARMv7 Processor [413fc090] revision 0 (ARMv7), cr=18c5387d
CPU: PIPT / VIPT nonaliasing data cache, VIPT aliasing instruction cache
OF: fdt: Machine model: xlnx,zynq-7000
earlycon: cdns0 at MMIO 0xe0001000 (options '38400n8')
printk: bootconsole [cdns0] enabled

[... removed ...]

e0000000.serial: ttyPS3 at MMIO 0xe0000000 (irq = 25, base_baud = 3125000) is a xuartps
e0001000.serial: ttyPS0 at MMIO 0xe0001000 (irq = 26, base_baud = 3125000) is a xuartps

[... removed ...]

of_cfs_init
of_cfs_init: OK
ALSA device list:
 mmcblk0: p1
  No soundcards found.
Warning: unable to open an initial console.
Freeing unused kernel memory: 1024K
mmc1: new high speed MMC card at address 0001
mmcblk1: mmc1:0001 Q2J55L 7.09 GiB
mmcblk1boot0: mmc1:0001 Q2J55L partition 1 16.0 MiB
Run /init as init process
mmcblk1boot1: mmc1:0001 Q2J55L partition 2 16.0 MiB
mmcblk1rpmb: mmc1:0001 Q2J55L partition 3 4.00 MiB, chardev (245:0)
 mmcblk1: p1 p2
udevd[77]: starting version 3.2.8
random: udevd: uninitialized urandom read (16 bytes read)
random: udevd: uninitialized urandom read (16 bytes read)
random: udevd: uninitialized urandom read (16 bytes read)

And finally I do have both console and serial devices:

root@picozed:~# ls -l /dev/console /dev/ttyPS0
crw-------    1 root     root        5,   1 Jan  1  1970 /dev/console
crw-rw----    1 root     dialout   253,   0 Jan  1  1970 /dev/ttyPS0

 

Any suggestions would be greatly appreciated!

0 Kudos
1 Solution

Accepted Solutions
Highlighted
Contributor
Contributor
895 Views
Registered: ‎04-02-2014

This is my guess, but it's probably a problem with drivers/tty/serial/xilinx_uartps.c.

The xilinx_uartps.c for v2020.1 looks like this:

/**
 * cdns_uart_probe - Platform driver probe
 * @pdev: Pointer to the platform device structure
 *
 * Return: 0 on success, negative errno otherwise
 */
static int cdns_uart_probe(struct platform_device *pdev)
{
	:
	:
	if (!cdns_uart_uart_driver.state) {
		cdns_uart_uart_driver.owner = THIS_MODULE;
		cdns_uart_uart_driver.driver_name = CDNS_UART_NAME;
		cdns_uart_uart_driver.dev_name = CDNS_UART_TTY_NAME;
		cdns_uart_uart_driver.major = CDNS_UART_MAJOR;
		cdns_uart_uart_driver.minor = CDNS_UART_MINOR;
		cdns_uart_uart_driver.nr = CDNS_UART_NR_PORTS;
#ifdef CONFIG_SERIAL_XILINX_PS_UART_CONSOLE
		cdns_uart_uart_driver.cons = &cdns_uart_console;
		cdns_uart_console.index = id;
#endif

		rc = uart_register_driver(&cdns_uart_uart_driver);
		if (rc < 0) {
			dev_err(&pdev->dev, "Failed to register driver\n");
			return rc;
		}
	}
	:
	:
#ifdef CONFIG_SERIAL_XILINX_PS_UART_CONSOLE
	/*
	 * If console hasn't been found yet try to assign this port
	 * because it is required to be assigned for console setup function.
	 * If register_console() don't assign value, then console_port pointer
	 * is cleanup.
	 */
	if (!console_port)
		console_port = port;
#endif

	rc = uart_add_one_port(&cdns_uart_uart_driver, port);
	if (rc) {
		dev_err(&pdev->dev,
			"uart_add_one_port() failed; err=%i\n", rc);
		goto err_out_pm_disable;
	}

#ifdef CONFIG_SERIAL_XILINX_PS_UART_CONSOLE
	/* This is not port which is used for console that's why clean it up */
	if (console_port == port &&
	    !(cdns_uart_uart_driver.cons->flags & CON_ENABLED))
		console_port = NULL;
#endif
	:
	:
}

 

"cdns_uart_uart_driver" is shared by the uart-port found by this driver.
And it initializes "cdns_uart_uart_driver" only on the first uart-port it finds.
At that time, "cdns_uart_console.index"(="cdns_uart_uart_driver.cons->index") is set to the id of the found uart-port.
As it is, only the uart-port first found by this driver can be used as console, but other than that, it cannot be used as console.

 

To resolve this issue, you can either replace it with xilinx_uartps.c from linux-xlnx v2019.2 or patch it (although it's still being tested) with:

#ifdef CONFIG_SERIAL_XILINX_PS_UART_CONSOLE
	/*
	 * If console hasn't been found yet try to assign this port
	 * because it is required to be assigned for console setup function.
	 * If register_console() don't assign value, then console_port pointer
	 * is cleanup.
	 */
	if (!console_port) {
		console_port = port;
		cdns_uart_uart_driver.cons->index = port->line; /* add this statement */
	}
#endif

	rc = uart_add_one_port(&cdns_uart_uart_driver, port);

 

This patch is my personal opinion. I wait for the official Xilinx answer.

 

 

View solution in original post

3 Replies
Highlighted
Visitor
Visitor
979 Views
Registered: ‎07-19-2019

I meet same problem in my custom ZYNQ 7010 board, it work fine in petalinux 2019.2, but hang in 2020.1, the kernel can boot up but cannot run into login prompt:

 
Warning: unable to open an initial console.
Freeing unused kernel memory: 1024K
random: fast init done
mmc0: new high speed SDIO card at address 0001
Run /init as init process
brcmfmac: brcmf_fw_alloc_request: using brcm/brcmfmac43456-sdio for chip BCM4345/9
brcmfmac mmc0:0001:1: Direct firmware load for brcm/brcmfmac43456-sdio.bin failed with error -2
udevd[129]: starting version 3.2.8
random: udevd: uninitialized urandom read (16 bytes read)
random: udevd: uninitialized urandom read (16 bytes read)
random: udevd: uninitialized urandom read (16 bytes read)
udevd[130]: starting eudev-3.2.8
FAT-fs (mmcblk1p1): Volume was not properly unmounted. Some data may be corrupt. Please run fsck.
EXT4-fs (mmcblk1p2): mounted filesystem with ordered data mode. Opts: (null)
 
... hang here ...
0 Kudos
Highlighted
Contributor
Contributor
896 Views
Registered: ‎04-02-2014

This is my guess, but it's probably a problem with drivers/tty/serial/xilinx_uartps.c.

The xilinx_uartps.c for v2020.1 looks like this:

/**
 * cdns_uart_probe - Platform driver probe
 * @pdev: Pointer to the platform device structure
 *
 * Return: 0 on success, negative errno otherwise
 */
static int cdns_uart_probe(struct platform_device *pdev)
{
	:
	:
	if (!cdns_uart_uart_driver.state) {
		cdns_uart_uart_driver.owner = THIS_MODULE;
		cdns_uart_uart_driver.driver_name = CDNS_UART_NAME;
		cdns_uart_uart_driver.dev_name = CDNS_UART_TTY_NAME;
		cdns_uart_uart_driver.major = CDNS_UART_MAJOR;
		cdns_uart_uart_driver.minor = CDNS_UART_MINOR;
		cdns_uart_uart_driver.nr = CDNS_UART_NR_PORTS;
#ifdef CONFIG_SERIAL_XILINX_PS_UART_CONSOLE
		cdns_uart_uart_driver.cons = &cdns_uart_console;
		cdns_uart_console.index = id;
#endif

		rc = uart_register_driver(&cdns_uart_uart_driver);
		if (rc < 0) {
			dev_err(&pdev->dev, "Failed to register driver\n");
			return rc;
		}
	}
	:
	:
#ifdef CONFIG_SERIAL_XILINX_PS_UART_CONSOLE
	/*
	 * If console hasn't been found yet try to assign this port
	 * because it is required to be assigned for console setup function.
	 * If register_console() don't assign value, then console_port pointer
	 * is cleanup.
	 */
	if (!console_port)
		console_port = port;
#endif

	rc = uart_add_one_port(&cdns_uart_uart_driver, port);
	if (rc) {
		dev_err(&pdev->dev,
			"uart_add_one_port() failed; err=%i\n", rc);
		goto err_out_pm_disable;
	}

#ifdef CONFIG_SERIAL_XILINX_PS_UART_CONSOLE
	/* This is not port which is used for console that's why clean it up */
	if (console_port == port &&
	    !(cdns_uart_uart_driver.cons->flags & CON_ENABLED))
		console_port = NULL;
#endif
	:
	:
}

 

"cdns_uart_uart_driver" is shared by the uart-port found by this driver.
And it initializes "cdns_uart_uart_driver" only on the first uart-port it finds.
At that time, "cdns_uart_console.index"(="cdns_uart_uart_driver.cons->index") is set to the id of the found uart-port.
As it is, only the uart-port first found by this driver can be used as console, but other than that, it cannot be used as console.

 

To resolve this issue, you can either replace it with xilinx_uartps.c from linux-xlnx v2019.2 or patch it (although it's still being tested) with:

#ifdef CONFIG_SERIAL_XILINX_PS_UART_CONSOLE
	/*
	 * If console hasn't been found yet try to assign this port
	 * because it is required to be assigned for console setup function.
	 * If register_console() don't assign value, then console_port pointer
	 * is cleanup.
	 */
	if (!console_port) {
		console_port = port;
		cdns_uart_uart_driver.cons->index = port->line; /* add this statement */
	}
#endif

	rc = uart_add_one_port(&cdns_uart_uart_driver, port);

 

This patch is my personal opinion. I wait for the official Xilinx answer.

 

 

View solution in original post

Highlighted
Visitor
Visitor
376 Views
Registered: ‎05-25-2018

I've accepted the patch as it corrected the early console and allowed serial output.  Unfortunately, the output was corrupted due to a baud rate mismatch. I've posted a separate forum post in regards to the baudrate issue:

To apply the patch, I followed the instructions in under Creating and Adding Patches For Software Components within a Petalinux Project (page 145 of UG1144 v2020.1).

  • Select devtool as described in the manual.
  • Get the kernel source: petalinux-build -c linux-xlnx -x modify
  • Change to directory components/yocto/workspace/sources/linux-xlnx
  • Update drivers/tty/serial/xilinx_uartps.c per the above post.
  • Build and test.
  • Commit the change: git commit drivers/tty/serial/xilinx_uartps.c 
  • Complete the patch: petalinux-build -c linux-xlnx -x finish

Hope the brief instructions prove useful.

Eric

0 Kudos