1

Background

I have an embedded Android device device that uses the U-Boot bootloader. The system also uses the Busybox suite.

I have access to the U-Boot shell through a UART port and can dump, modify, and upload a new filesystem but I have no terminal access to the OS. One limitation I have with U-Boot is that the saveenv command has been disabled however, the setenv command seems to work for the current boot session.

The bootargs U-Boot variable is currently set to storagemedia=nand (there is no console= setting).

So far I have tried using echo on various serial ports and modifying the inittab file to setup a TTY shell for the UART port.

My attempts to setup a TTY shell

::respawn:/sbin/getty -L serial 115200 -n -l /bin/autologin
::respawn:/sbin/getty -L serial0 115200 -n -l /bin/autologin
::respawn:/sbin/getty -L s0 115200 -n -l /bin/autologin
::respawn:/sbin/getty -L console 115200 -n -l /bin/autologin

The original Line in the inittab file (doesn't work)

# [THE ORIGINAL LINE]
ttyFIQ0::respawn:/sbin/getty -L  ttyFIQ0 0 vt100 #

Regardless of what I do, the last few lines I receive from the UART port are:

## Booting Android Image at 0x62ce3248 ...                                      
Kernel load addr 0x62ce3a48 size 4400 KiB                                       
## Flattened Device Tree blob at 61f00000                                       
   Booting using the fdt blob at 0x61f00000                                     
   XIP Kernel Image ... OK                                                      
CACHE: Misaligned operation at range [62ce3a48, 6312f888]                       
   Loading Device Tree to 60ff1000, end 60fff36c ... OK                         
Adding bank: 0x60000000 - 0x61000000 (size: 0x01000000)                         
Adding bank: 0x61200000 - 0x70000000 (size: 0x0ee00000)                         
                                                                                
Starting kernel ...

After the Starting kernel ... message, I receive nothing indicating that a TTY shell is running even though, the OS boots and runs perfectly. If I type anything into the terminal after the Starting kernel ... message has been received, the OS freezes.

Question

How do I setup a TTY shell for the Operating System that will use the UART port so that I can finally interact with the embedded device OS through a terminal?

8
  • Please edit the question to indicate the model of the processor and add the appropriate tag for that chip. Commented Jan 7, 2024 at 7:52
  • 1
    "After the Starting kernel ... message, ..." - That message is from U-Boot. You seem to be asking the wrong questions. What indication is there that the kernel actually boots successfully? Perhaps there are no terminals with any shell simply because the kernel has not booted successfully??? Perhaps you need to reconsider your choice of "no console= setting" in the bootargs variable (assuming the kernel has been configured to support a serial or network console). You might even need to use earlycon or earlyprintk to learn what is going on. Commented Jan 7, 2024 at 8:59
  • Sorry, I forgot to mention that the OS is successfully loaded after the "Starting kernel ..." message and the device functions normally. Does this mean that the kernel was successful? Thank you for the tip with earlyprintk and earlycon, I'll try to get those running. Commented Jan 7, 2024 at 16:03
  • 1
    "So far modifying earlycon and earlyprintk ..." - Whatever random things you're doing seems like wild guessing. "My attempts to setup a TTY shell ..." - Unless it's a customized kernel, you have not specified any terminal name that is likely to exist (except for console). The convention for naming device nodes for a serial terminal has the form ttySn, such as ttyS0 or ttyS1. Commented Jan 8, 2024 at 8:46
  • 1
    That is not what I was suggesting; earlycon or earlyprintk have additional configuration requirements. The likeliest chance of success is with the inittab or the console= setting in the bootargs variable. Commented Jan 8, 2024 at 21:42

1 Answer 1

1

The reason I couldn't establish a shell connection on the UART0 port was because the UART0 port was being used by the fiq-debugger which prevented me from starting a getty program on the UART0 port through device ttyFIQ0. After looking around the .dtb file (in the Flattened Device Tree blob at 61f00000), I noticed that serial devices (named something like serial@20060000) had their status set to status = disabled.

I modified the .dtb file to enable all of the serial ports (set their status to status = okay. Then, I also had to modify the serial-id property of the fiq-debugger in the .dtb file to be a value other than 0x00 since 0x00 refers to UART0 which is the only accessible UART port on circuit board I was using.

Finally, I modified the inittab file on the device to run a getty program on port ttyS0 (this device was originally disabled in the .dtb file). With that final change, the RK3128 allowed a serial terminal on UART0.

Sign up to request clarification or add additional context in comments.

2 Comments

Where did you find the *.dtb files?
I dumped the nand and found .dtb files at hex offset 0x477538 (this offset may be different for you). I posted a guide detailing how I enabled UART debugging.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.