qemu-system-arm run barebox image - yocto

may I ask? I need to build a barebox image inside yocto and run it in qemu, I can’t build a qemuarm image in yocto, there is no such recipe, in general, the question is, is it possible to somehow slip under such a dts into the barebox assembly that qemu-system-arm with -M mcimx6ul-evk option will be able to run barebox builded in yocto?

You can enable CONFIG_BOARD_ARM_GENERIC_DT=y in the barebox config and barebox will generate an images/barebox-dt-2nd.img file that is bootable like a Linux kernel: You can pass it to QEMU -kernel and it will receive a device tree from the outside.
barebox contains a test/emulate.pl script that can spawn QEMU VMs for you. Passing it --dryrun will print the options used (edited for formatting):
$ ./test/emulate.pl --no-tuxmake --dry-run virt#vexpress_defconfig
/usr/bin/qemu-system-arm -M virt -cpu cortex-a7 -m 1024M -kernel \
./build/images/barebox-dt-2nd.img -serial mon:stdio -trace file=/dev/null
In the above case, QEMU will provide the device tree, but you can pass your own as well (make sure to build barebox with a config that enables board and platform support in line with the FDT and QEMU machine you configure). See the barebox documentation on Emulated targets for more information.

Related

How to get XDP program into kernel with iproute2?

I am using "ip link" command to put xdp program into kernel, in my virtual machine(kernel-version:4.18)
command like this:
ip link set dev ens33 xdp obj xdpsock_kern.o sec .text
but after this command, the error said:
No ELF library support compiled in.
what should I do to solve this problem?
I solve this problem by reconfigure the iproutes.
git clone git://git.kernel.org/pub/pub/scm/network/iproute2/iproute2.git
cd iproute2/
./configure --prefix=/usr
make
sudo make install

esptool.py not recognized as internal or external command, operable program or batch file

I recently tried to load MicroPython on ESP8266 board, but failed. To do that I had to install esptool. I successfully installed it but when I wanted to use it, it would not work.
For instance,
esptool.py --help
'not recognized as internal or external command, operable program or batch file'
I found many questions on this topic, but none of the answers helped me. I tried adding everything to the Windows path and it still did not work.
Try installing esptool using pip command on Windows.
Then use only "esptool" instead of "esptool.py"
I was in the same position as the OP.
On Windows 10 I must use this syntax at a CMD prompt launched as an admin:
py -m esptool --help
I'm running Python 3.10.2 and esptool was installed using
py -m pip install --user pip
pip3 install esptool (Administration Mode)
Problem :
C:\WINDOWS\system32>esptool --chip esp328266 -p COM3 erase_flash
'esptool' is not recognized as an internal or external command,
operable program or batch file.
AFTER DOING THIS
C:\WINDOWS\system32>pip3 install esptool
Collecting esptool
Downloading esptool-3.1.tar.gz (175 kB)
----------Successfull----------------------
C:\WINDOWS\system32>esptool.py --chip esp8266 -p COM3 erase_flash
esptool.py v3.1
Serial port COM3
Connecting....
Chip is ESP8266EX
Features: WiFi
Crystal is 26MHz
MAC: e8:db:84:9b:5a:57
Uploading stub
Running stub
Stub running
Chip erase completed successfully in 2.7s
Hard resetting via RTS pin...
By using "esptool -h" I could check the help option.

QEMU can't run with --enable-trace-backends configured

I complied QEMU using:
./configure --enable-kvm --target-list=x86_64-softmmu --enable-trace-backends=simple
Then I started a VM using simply just:
qemu-system-x86_64 -nographic -vnc :1 -hda /home/cloud/ubuntu-rr.img -m 2048 -smp 4 --enable-kvm -smp 4 -monitor stdio
Nothing happened. I even couldn't call out the monitor with Ctrl+A C. It didn't work when I added -trace events=/tmp/events, either. What's wrong here? What should be the right way to utilize the QEMU tracing capability?
Thanks very much!
File /tmp/events should be created before start of qemu. So please create at least empty file or fill it with events you are going to trace.

QEMU - redirect guestOS booting to host machine

I used QEMU to bring CentOS.img (downloaded some where). I find the boot screen of CentOS.img took over the console session of the current terminal and I could see CentOS booting up process and prompts me to the login screen of the guestVM CentOS. This is really helpful for me as I ran QEMU instance from remote console machine.
Now, I created a new RHEL.img using iso and when I try to boot it; I was not able to see anything in the screen other then some symbol of (Y) :(
$>/usr/libexec/qemu-kvm -hda ./RHEL.img -bios bios.bin -nographic -net nic,model=e1000,macaddr=00:AD:BE:EF:4F:BD -net tap,script=./qemu-ifup -m 1024 -smp 2
...Y
on investigation, I find we can do it by redirecting RHEL boot to console using
# virt-edit RHEL_VM /boot/grub/grub.conf
...
title rhel (2.6.38.6-26.rc1.fc15.x86_64)
root (hd0,0)
kernel /vmlinuz ro [...] console=ttyS0
...
but nothing worked out. I am trying to bring the rhel VM session to the same console where I invoked qemu-kvm from remote terminal. Thanks in advance.
NOTE: I don't have GUI enabled on the physical host machine.
You could try adding a serial port and sending output to that. Although you do have to be able to boot it at least once to do these steps...
You might get lucky if you just add a serial port to the qemu command line and then telnet to that; hoping linux detects this and sends output there
edit /etc/init/ttyS0.conf and add
respawn
console none
start on (local-filesystems)
stop on [!12345]
script
exec start ttyS0
end script
then
ln -s /etc/init/ttyS0.conf /etc/rc2.d/S99ttyS0.conf
ln -s /etc/init/ttyS0.conf /etc/rc0.d/S99ttyS0.conf
ln -s /etc/init/ttyS0.conf /etc/rc6.d/S99ttyS0.conf
then do this to enable grub
Edit /etc/default/grub
1. Edit the GRUB_CMDLINE_DEFAULT="" line to start the console on /dev/ttyS0
GRUB_CMDLINE_LINUX_DEFAULT="console=tty0 console=ttyS0,38400n8"
2. Add a serial console section
# Serial console
GRUB_TERMINAL=serial
GRUB_SERIAL_COMMAND="serial --speed=38400 --unit=0 --word=8 --parity=no --stop=1"
3. Rebuild the grub.cfg file
sudo sh
grub-mkconfig > /boot/grub/grub.cfg

how to get root access on android 2.3 emulator

i am trying to get root access on my android emulator to run iptables. i went through many forums and tried many methods but nothing seems to work. the following is my device specification and i try everything on emulator.
version - 2.3
kernel version - 2.6.29-00261-g0097074-dirtydigit#digit #20
build number - sdk-eng 2.3 GRH55 79397 test-keys
so how to become root in the android. please help.
On the emulator provided with the SDK r10, you can get a root shell executing "adb shell" from your host computer. Once you have such root shell, you cat follow this steps to get a command that can log you as root from the terminal emulator:
# Remount /data to allow executables and setuids on it
mount -o remount,rw /dev/block/mtdblock1 /data
# There's no "cp" command on Android
cat /system/bin/sh > /data/su
# Give setuid permissions to the shell
chmod 7755 /data/su
Now, from the emulator, just run "/data/su" and that's it, you're root.
The normal "/system/xbin/su" command included in the SDK performs internal user id checks, so these commands...
mount -o remount,rw /dev/block/mtdblock0 /system
chmod 7755 /system/xbin/su
...just won't work. There's no way to trick /system/xbin/su to allow the normal user (UID 10018 in my case) to become root.
Please note that dealing with setuid programs can be a security risk (not higher than having a universal "su" command, though). Use this solution at your own risk.