I'm trying to debug an embedded device, connection via serial port, connected with USB to UART cable. Embedded Linux v.2.6.26.5 How to access the root filesystem "/" and subdirectories under the root FS? The shell
command is not available in U-boot mode. Is there a way to access shell CLI from U-boot?
The available U-boot commands and logs is here and here.
2 Answers
I guess you need to Follow the Third stage of U-boot.
The third stage is the loading of the Linux kernel. However, before the Linux kernel takes control, u-boot passes a command line to the kernel containing essential parameters. These parameters can be viewed after the operating system has booted by typing the following into a Terminal window:
$ cat /proc/cmdline
root=/dev/mmcblk0p2 rootwait rw console=ttyS0,115200n8 console=tty0 no_console_suspend vdaccfg=0xa000 logo=osd1,loaded,0x7900000,720p,full dmfc=3 cvbsmode=576cvbs hdmimode=1080p m_bpp=32 vout=hdmi disablehpd=true
The kernel initializes the hardware, mounts the root filesystem (according to the root=... kernel parameter) and passes the control flow to /sbin/init. if you need more details abt Uboot Follow this link
-
You mean I need wait until the Linux kernel fully loaded (stage 3 of U-boot), not interrupt the automatic boot process?– mintoCommented Apr 10, 2017 at 10:31
-
follow the link i gave below the stage 3 there is Disk layout and partitioning and u-boot environment setup . which ll help you setup ur / partition. Commented Apr 10, 2017 at 10:48
Depending on the filesystem and media you might be able to dump data in hexadecimal form directly under u-boot shell. If you are reverse engineering observe help
output to understand what type of media storage device access and manipulation commands you have compiled in to U-boot and go on from there. After loading to memory or maybe even sometimes without it you can use 'md' to dump it. Use load addresses after the u-boot portion in memory or it will reboot. Keep in mind that most of the times the filesystems are compressed and can't be permanently modified (squashfs is common). Sometimes u-boot comes with a command that can load and read the uncompressed data. Peeking the filesystem from memory dump can be tedious so it's often best to log an entire partition dump locally, convert it to binary and deal with it locally.
You may succeed loading a shell by modifying the init=
kernel argument to point to a shell program. Usually with embedded devices it's busybox so that would be /bin/ash
.