Linux Kernel – Console Setting in Initramfs for ARM

armdevice-treeinitramfslinux-kernel

I'm in the process of porting the embedded system for a picozed-based platform from the Xilinx-v2013.4 (3.12 kernel) to the Xilinx-v2016.2 (4.4 kernel). The former version still makes use of an initial RAM disk (initrd) while the new uses an initial RAM fs (initramfs).

At boot time, the console is given through the serial interface on the USB connector. I expect it to be ttyPS0. At this point already, I don't know how this relation 'console-ttyPS0' is done !? Does it come from the device tree (I don't see any thing mentioning ttyPS0) ? In the former version (in the RAM disk), it was even not configured in the "init" scripts, neither in 'mdev' configuration file.

The boot process is running and then it hangs. Here is the output:

Starting kernel ...

Uncompressing Linux... done, booting the kernel.
Booting Linux on physical CPU 0x0
Linux version 4.4.0-test (pierrett@build0109-linux) (gcc version 4.8.3 20140320 (prerelease) (Sourcery CodeBench Lite 2014.05-23) ) #1 SMP PREEMPT Thu Aug 18 12:10:52 CEST 2016
CPU: ARMv7 Processor [413fc090] revision 0 (ARMv7), cr=18c5387d
CPU: PIPT / VIPT nonaliasing data cache, VIPT aliasing instruction cache
Machine model: zynq
bootconsole [earlycon0] enabled
cma: Reserved 16 MiB at 0x3dc00000
Memory policy: Data cache writealloc
PERCPU: Embedded 12 pages/cpu @ef7d2000 s18240 r8192 d22720 u49152
Built 1 zonelists in Zone order, mobility grouping on.  Total pages: 260608
Kernel command line: bootargs=console=ttyPS0,115200 root=/dev/ram initrd=0x8000000 rw earlyprintk rootwait
PID hash table entries: 4096 (order: 2, 16384 bytes)
Dentry cache hash table entries: 131072 (order: 7, 524288 bytes)
Inode-cache hash table entries: 65536 (order: 6, 262144 bytes)
Memory: 1009532K/1048576K available (4456K kernel code, 213K rwdata, 1564K rodata, 240K init, 193K bss, 22660K reserved, 16384K cma-reserved, 238976K highmem)
Virtual kernel memory layout:
    vector  : 0xffff0000 - 0xffff1000   (   4 kB)
    fixmap  : 0xffc00000 - 0xfff00000   (3072 kB)
    vmalloc : 0xf0800000 - 0xff800000   ( 240 MB)
    lowmem  : 0xc0000000 - 0xf0000000   ( 768 MB)
    pkmap   : 0xbfe00000 - 0xc0000000   (   2 MB)
    modules : 0xbf000000 - 0xbfe00000   (  14 MB)
      .text : 0xc0008000 - 0xc05e949c   (6022 kB)
      .init : 0xc05ea000 - 0xc0626000   ( 240 kB)
      .data : 0xc0626000 - 0xc065b450   ( 214 kB)
       .bss : 0xc065b450 - 0xc068bb54   ( 194 kB)
Preemptible hierarchical RCU implementation.
        Build-time adjustment of leaf fanout to 32.
        RCU restricting CPUs from NR_CPUS=4 to nr_cpu_ids=2.
RCU: Adjusting geometry for rcu_fanout_leaf=32, nr_cpu_ids=2
NR_IRQS:16 nr_irqs:16 16
ps7-slcr mapped to f0802000
L2C: platform modifies aux control register: 0x72360000 -> 0x72760000
L2C: DT/platform modifies aux control register: 0x72360000 -> 0x72760000
L2C-310 erratum 769419 enabled
L2C-310 enabling early BRESP for Cortex-A9
L2C-310 full line of zeros enabled for Cortex-A9
L2C-310 ID prefetch enabled, offset 1 lines
L2C-310 dynamic clock gating enabled, standby mode enabled
L2C-310 cache controller enabled, 8 ways, 512 kB
L2C-310: CACHE_ID 0x410000c8, AUX_CTRL 0x76760001
zynq_clock_init: clkc starts at f0802100
Zynq clock init
sched_clock: 64 bits at 333MHz, resolution 3ns, wraps every 4398046511103ns
clocksource: arm_global_timer: mask: 0xffffffffffffffff max_cycles: 0x4ce07af025, max_idle_ns: 440795209040 ns
clocksource: ttc_clocksource: mask: 0xffff max_cycles: 0xffff, max_idle_ns: 537538477 ns
ps7-ttc #0 at f080a000, irq=18
Console: colour dummy device 80x30
console [tty0] enabled
bootconsole [earlycon0] disabled

My feeling is that the trouble comes from a wrong setting of the console. In the boot log, one can notice that the "tty0" is enabled while in the boot arguments, I expect the console on ttyPS0.

Could any one explain how the correct console could be set at startup?

Additional info :

  • the device tree serial config :
ps7_uart_1: serial@e0001000 {
 clock-names = "ref_clk", "aper_clk";
 clocks = <0x2 0x18 0x2 0x29>;
 compatible = "xlnx,xuartps";
 current-speed = <115200>;
 device_type = "serial";
 interrupt-parent = <&ps7_scugic_0>;
 interrupts = <0x0 0x32 0x4>;
 port-number = <0x0>;
 reg = <0xe0001000 0x1000>;
 xlnx,has-modem = <0x0>;
};
  • the boot arguments :
console=ttyPS0,115200 root=/dev/ram initrd=0x8000000 rw earlyprintk rootwait
  • the kernel serial config :
#
# Serial drivers
# CONFIG_SERIAL_EARLYCON=y
# CONFIG_SERIAL_8250 is not set
#
# Non-8250 serial port support
#
# CONFIG_SERIAL_AMBA_PL010 is not set
# CONFIG_SERIAL_AMBA_PL011 is not set
# CONFIG_SERIAL_EARLYCON_ARM_SEMIHOST is not set
# CONFIG_SERIAL_MAX3100 is not set
# CONFIG_SERIAL_MAX310X is not set
CONFIG_SERIAL_UARTLITE=m
CONFIG_SERIAL_CORE=y
CONFIG_SERIAL_CORE_CONSOLE=y
# CONFIG_SERIAL_JSM is not set
# CONFIG_SERIAL_SCCNXP is not set
# CONFIG_SERIAL_SC16IS7XX is not set
# CONFIG_SERIAL_BCM63XX is not set
# CONFIG_SERIAL_ALTERA_JTAGUART is not set
# CONFIG_SERIAL_ALTERA_UART is not set
# CONFIG_SERIAL_IFX6X60 is not set
CONFIG_SERIAL_XILINX_PS_UART=y
CONFIG_SERIAL_XILINX_PS_UART_CONSOLE=y
# CONFIG_SERIAL_ARC is not set
# CONFIG_SERIAL_RP2 is not set
# CONFIG_SERIAL_FSL_LPUART is not set
# CONFIG_SERIAL_CONEXANT_DIGICOLOR is not set
# CONFIG_SERIAL_ST_ASC is not set
# CONFIG_SERIAL_STM32 is not set
# CONFIG_TTY_PRINTK is not set
# CONFIG_HVC_DCC is not set
# CONFIG_VIRTIO_CONSOLE is not set
# CONFIG_IPMI_HANDLER is not set
# CONFIG_HW_RANDOM is not set
CONFIG_XILINX_DEVCFG=y
# CONFIG_R3964 is not set
# CONFIG_APPLICOM is not set
# CONFIG_RAW_DRIVER is not set
# CONFIG_TCG_TPM is not set
CONFIG_DEVPORT=y
# CONFIG_XILLYBUS is not set
  • the "inittab" entry:

    ttyPS0::respawn:/sbin/getty -L ttyPS0 115200 vt100 # GENERIC_SERIAL

Best Answer

I am not seeing in your dmesg the UART lines. You also need to have at least one uart configured in the device tree.

I am using here an ARM A20, Lamobo R1, with serial console enabled. (115200, 8, N, 1)

In my specific case:

From dmesg

[    3.456402] Serial: 8250/16550 driver, 8 ports, IRQ sharing disabled
[    3.480137] 1c28000.serial: ttyS0 at MMIO 0x1c28000 (irq = 41, base_baud = 1500000) is a U6_16550A
[    3.503990] 1c28c00.serial: ttyS1 at MMIO 0x1c28c00 (irq = 42, base_baud = 1500000) is a U6_16550A
[    3.505687] console [ttyS1] enabled
[    3.529520] 1c29c00.serial: ttyS2 at MMIO 0x1c29c00 (irq = 43, base_baud = 1500000) is a U6_16550A

My options to kernel are, in /boot/boot.cmd, compiled to /boot/boot.scr , are:

setenv bootargs "console=ttyS1,115200n8 root=/dev/sda2 rootwait rootfstype=ext4 sunxi_ve_mem_reserve=0 sunxi_g2d_mem_reserve=0 sunxi_no_mali_mem_reserve sunxi_fb_mem_reserve=0 panic=10 enforcing=0 loglevel=1 ipv6.disable=1"

As you can see, I define as console the serial, and try to remove support/reserved memory for the mali graphical mode(s) to save resources, as I only use it in headless mode with a USB To RS232 TTL UART PL2303HX cable.

As I am using ArmBian/Debian with sysV and not systemd, also in /etc/inittab:

T0:2345:respawn:/sbin/getty -L ttyS0 115200 vt100

As for the device tree

    uart0: serial@01c28000 {
        pinctrl-names = "default";
        pinctrl-0 = <&uart0_pins_a>;
        status = "okay";
    };

    uart3: serial@01c28c00 {
        pinctrl-names = "default";
        pinctrl-0 = <&uart3_pins_b>;
        status = "okay";
    };

    uart7: serial@01c29c00 {
        pinctrl-names = "default";
        pinctrl-0 = <&uart7_pins_a>;
        status = "okay";
    };

For the kernel compile time options used:

$zcat /proc/config.gz  | grep  8250
CONFIG_SERIAL_8250=y
CONFIG_SERIAL_8250_DEPRECATED_OPTIONS=y
CONFIG_SERIAL_8250_CONSOLE=y
CONFIG_SERIAL_8250_DMA=y
CONFIG_SERIAL_8250_NR_UARTS=8
CONFIG_SERIAL_8250_RUNTIME_UARTS=8
# CONFIG_SERIAL_8250_EXTENDED is not set
CONFIG_SERIAL_8250_FSL=y
CONFIG_SERIAL_8250_DW=y
# CONFIG_SERIAL_8250_EM is not set
# CONFIG_SERIAL_8250_RT288X is not set
# Non-8250 serial port support
# CONFIG_DEBUG_LL_UART_8250 is not set
CONFIG_DEBUG_LL_INCLUDE="debug/8250.S"
CONFIG_DEBUG_UART_8250=y
CONFIG_DEBUG_UART_8250_SHIFT=2
# CONFIG_DEBUG_UART_8250_WORD is not set
# CONFIG_DEBUG_UART_8250_PALMCHIP is not set
# CONFIG_DEBUG_UART_8250_FLOW_CONTROL is not set

In addition to those, it is also needed: CONFIG_SERIAL_CORE_CONSOLE=y

Related Question