how to boot a U-boot / Uimage with qemu - arm

How do I boot an U-boot / Uimage?
in
/boot/uimage file
/boot-loader/u-boot bin
I tried to load it in arm and ppc but no luck
not sure what command i really need
i think i need to mount the folder as the folder has rest of the files it needs???
this is on a file in boot-loader
### console configuration ###
setenv stderr serial
setenv stdin serial
setenv stdout serial
#setenv baudrate 115200
setenv console ttyS2
and
setenv loadaddr 0x80007fc0
setenv image_file /boot/uImage
I think it outputs what it's doing on serial console but not sure if it has shell
only evidence to suggest it has shell is in a code its asking about product type and S/N
can only assume thats set through serial

Related

Copying files to mmc device from bootmenu

I want to copy files to mmc device over the network using TFTP.
I know that we can switch to the mmc device using "mmc dev" command at U-boot prompt. After switching to the mmc device, I need to copy the files to the mmc device over the network using tftp from U-bot prompt.
You cannot directly copy from MMC to TFTP.
Go through these step instead:
Setup network:
setenv autoload no
dhcp
Load the file to memory:
load mmc 0:1 $loadaddr /test.txt
The load command set environment variable filesize.
TFTP put:
tftpput $loadaddr $filesize 192.168.1.3:/upload/test.txt
Of course you should adjust the server IP address and the file paths.
In your U-Boot configuration you need:
CONFIG_CMD_DHCP=y
CONFIG_CMD_TFTPPUT=y

How to disable messages to console during boot of Coral Dev Board?

I have purchased a coral dev board. The output of messages to the console during boot seem to add about 1 second to the boot time, therefore I want to disable the console or reduce the number of messages written to the console. To achieve this I have tried two different things.
I have set the bootargs parameter in U-Boot to pass quiet as kernel parameter to silence the console using these commands:
setenv bootargs quiet
saveenv
I have also added the following lines to U-Boot config file imx8mq_phanbell.h:
CONFIG_SILENT_CONSOLE
CONFIG_SILENT_CONSOLE_UPDATE_ON_SET
CONFIG_SYS_DEVICE_NULLDEV
Then I have rebuilt u-boot and flashed it to the board and set the u-boot variable silent to 1.
Neither of these changes have had any effect on the output from the console during boot.
Can you help me with this problem?
I have solved my issue by first adding the quiet parameter to the cmdline variable defined in the file boot.txt found here: https://coral.googlesource.com/build/+/refs/heads/docker/boot.txt.
Then I compiled boot.txt to a script image file with the mkimage tool and replaced boot.scr used by U-Boot in /boot with this file.
This does indeed reduce boot time.
Thanks Fredrik for the response, to reiterate but this works for any kernel params that needs to be added:
Download boot.txt:
$ curl https://coral.googlesource.com/build/+/refs/heads/docker/boot.txt\?format\=TEXT | base64 --decode | tee boot.txt > /dev/null
Install mkimage:
$ sudo apt install u-boot-tools
Make your necessary changes in the cmdline="" line, for this example, we need to add "quiet loglevel=0":
cmdline=<preexsisting> + quiet loglevel=0
compile to boot.scr:
$ mkimage -A arm -T script -O linux -d boot.txt boot.scr
replace boot image file
$ mv boot.scr > /boot
Reboot and the new kernel params should be loaded.

Hot-plug in detect by Interrupt

I am currently using udev to detect USB hot-plug event in my application but as far as I know its a polling process, it requires one thread continuously monitoring kernel uevent.
Is there any way that kernel notifies me by an interrupt or it signal to my process whenever Hot-Plug event detected?
Thanks
First write a udev rule to identify the device and run a script (action) when that device is connected to the host.
Get the information of your device with below command, in my example, it is USB console adapter. This command will report a bunch of things that we can use to identify the device on hotplugging by means of udev rule file.
$ udevadm info -a -n /dev/ttyUSB0
Now make a file - /etc/udev/rules.d/99-usbdev.rules with below content.
SUBSYSTEM=="tty", ATTRS{idVendor}=="xxxx", ATTRS{idProduct}=="xxxx",
ATTRS{product}=="USB to UART Bridge Controller",
RUN+="/usr/bin/devattached.sh"
Reload udev rules and service:
$ udevadm control --reload-rules
$ systemctl restart udev.service
Debug: if the udev rule is not working!!
udevadm monitor --udev
Make a script with your desired action and put it on the exact same path provided in 'RUN+'. Don't forget to give executable permission to that script. Make use of pgrep and kill commands to send the signal to your process from the script.

Read serial port from micaz

I would like to know if there is a mean to read in a terminal outputs generated by a MicaZ (printf), I tried the command: make login but it doesn't work.
I think that the is no rule login in micaz makefile.
Try command:
sudo cat /dev/ttyUSB1
Before doing this, check that your Micaz is connected through ttyUSB1.
You can check it using command:
ls /dev
If ttyUSB1 is in the list above, it will work.
As far as I remember the MIB510 board, used to program the MicaZ, has two serial ports. One for ISP and the other as a serial console. You might also want to use minicom to be able to fully interact with the serial console. On ubuntu you can install it with sudo apt-get install minicom and is run with minicom -8 -b9600 -D/dev/ttyUSB1 set the baudrate according to your setup.
Here you can find an introduction to minicom.
Good luck!

Running scripts in u-boot with qemu on arm

I'm working with u-boot on ARM using QEMU. I'm using the 'versatilepb' machine since both Linux and u-boot work well with it. I would like to write a script to handle some of the boot procedures (set kernel args, calculate CRC's, etc...) - but I can't seem to find how to run my script. I've got the script in memory and I can identify it with u-boot:
VersatilePB # iminfo 0x285EC
## Checking Image at 000285ec ...
Legacy image found
Image Name: Test Linux Boot
Image Type: ARM Linux Script (uncompressed)
Data Size: 300 Bytes = 300 Bytes
Load Address: 00000000
Entry Point: 00000000
Contents:
Image 0: 292 Bytes = 292 Bytes
Verifying Checksum ... OK
However, I can't figure out how to run it:
VersatilePB # run 0x285EC
Unknown command 'run' - try 'help'
VersatilePB # autoscr 0x285EC
Unknown command 'autoscr' - try 'help'
VersatilePB # go 0x285EC
## Starting application at 0x000285EC ...
qemu: fatal: Trying to execute code outside RAM or ROM at 0x56190526
I understand that the last command failed since I have a script image (built using mkimage -A arm -T script -C none -n "Test Linux Boot" -d myscript.sh ./boot-commands.img) and not an actual standalone application.
My test script is extremely simple and is just meant to boot a Linux kernel:
#Global Variables
FLASH_ADDR=0x34000000
BOOT_ARGS="console=ttyAMA0"
#Now we'll try booting it from the beginning of flash
setenv bootcmd bootm $FLASH_ADDR
setenv bootargs $BOOT_ARGS
Typing bootm 0x34000000 at the u-boot command line successfully boots the Linux kernel
Am I missing something on how to run a u-boot script?
This is a community wiki answer.
You should add the version of u-boot that you are using. For the "run" command, verify that CONFIG_CMD_RUN is defined in your configuration. by sessyargc.jp
The command autoscr is enabled by defining CONFIG_CMD_SOURCE in your configuration as per U-boot command documetnation. by Joe Kul
The scripts do not run as plain ascii and must be pre-processed by mkimage as per the documentation.

Resources