initramfs init has generated signal 11 but has no handler for it - linux

I built an embedded Linux kernel 2.6.19 on powerpc MPC860 CPU. I created a initramfs.cpio with only one "init" file in the / directory(no other files and no other directories). The init is cross-compiled to an elf format file. The init only set int i=0 and return 0.
All I want to do is to make sure the kernel can successfully call this init. Then I will add more stuff in the file system later.
But the serial port output error message "init has generated signal 11 but has no handler for it".
I have BDM interface connected to the board. The serial port is OK. gdb is OK. I cannot set breakpoint to the kernel_execve() because I use u-boot "bootm " command to boot the kernel.
Is there any method to debug it?

Related

Amend boot cmdline in custom image build

I'm building a custom image that uses the meta-intel layer (I'm targeting Intel boards, such as the Minnowboard Turbot, for instance), and I want to tweak the options for booting.
First problem
As far as I understand, meta-intel uses systemd-boot (via rmc-boot) as EFI_PROVIDER.
So I should be able to override the specific BOOT_TIMEOUT parameter by setting :
SYSTEMD_BOOT_TIMEOUT := "0"
in my custom image, as far as I can see in this file
Unfortunately, that doesn't work (the boot timeout is still 4 seconds). How come ?
Second problem
As well, I would like to append options to the boot.conf file (in /boot/loader/entries, loaded by /boot/loader/loader.conf), such as quiet, or vt.global_cursor_default=0 for instance.
I see in the Intel machine conf that there is an APPEND configuration, but overriding it or appending to it in my custom image doesn't work (it's still not written in the boot.conf file) :
APPEND += "quiet vt.global_cursor_default=0"
I've checked that the configuration is correctly read and it's the case :
$ bitbake my-custom-image -e | grep ^APPEND= -A1 -B1
# " quiet rootwait console=ttyS0,115200 console=tty0${#bb.utils.contains("IMAGE_FEATURES", "read-only-rootfs", " ro", "", d)}"
APPEND=" quiet vt.global_cursor_default=0 rootwait console=ttyS0,115200 console=tty0"
#
But no matter what I do, the command line doesn't change on the built image.
What do I miss ? There should be a relatively easy way to achieve what I'm after I guess, but so far I have not managed to do it.
Thanks a lot !
I have been looking at the kernel command line parameters for intel platform in Yocto with the meta-intel.
I have noticed differences between the wic and hddimg yocto images.
The hddimg seems to use the rmc boot entry definition whereas the wic image uses the boot entry defined in the wks kickstart.
My machine conf has the following :
WKS_FILE ?= "${#bb.utils.contains_any("EFI_PROVIDER", "systemd-boot rmc-boot", "systemd-bootdisk.wks", "mkefidisk.wks", d)}"
In turns systemd-bootdisk.wks has the following boot entry "boot" :
bootloader --ptable gpt --timeout=5 --append="rootwait rootfstype=ext4 console=ttyS0,115200 console=tty0"
The RMC definition for my Minnowboard Max has 2 entry a boot and an install.
Minnow Max B3 boot
Minnow Max B3 install
I am using the pyro release for Yocto. Perhaps integration of RMC boot definition has been integrated into the wic images.
I am looking for a common place to add the kernel command line parameter. Any idea ?

How to change boot partition for Beaglebone Black after flashing Debian 8.4 to eMMC?

I'm trying to get the current Debian 8.4 SD card image onto my Beaglebone Black's eMMC. The flashing itself worked flawlessly by enabling (uncommenting) this line in the /boot/uEnv.txt file:
cmdline=init=/opt/scripts/tools/eMMC/init-eMMC-flasher-v3.sh
Flashing completed successfully with blinking LED's as described in the HowTo. Next, I connected a serial-USB cable to the J1 connector in order to see the boot process in Putty's serial console. The system starts to boot but then stops with an error message:
Begin: Waiting for root file system ... Begin: Running /scripts/local-block ... done.
Begin: Running /scripts/local-block ... done.
[line above repeats multiple times]
Begin: Running /scripts/local-block ... done.
done.
Gave up waiting for root device. Common problems:
- Boot args (cat /proc/cmdline)
- Check rootdelay= (did the system wait long enough?)
- Check root= (did the system wait for the right device?)
- Missing modules (cat /proc/modules; ls /dev)
ALERT! /dev/mmcblk1p1 does not exist. Dropping to a shell!
I then get an (initramfs) prompt. From there, I figured out that mmcblk1p1 is not the right partition, it should be mmcblk0p1 instead. I think this is because of a different enumeration when the SD card is removed.
Now the big question: How and where can I set the partition the system starts from? It must be defined somewhere. I can mount the root partition mmcblk0p1 and edit files from the prompt, so I hope that there's just a small config file I need to tweak. Do I need to add something to the /boot/uEnv.txt file? (I already commented out the flasher script after flashing, of course).
Thanks for your help!
It should be as easy as editing uEnv.txt.
There should be a line containing: root=/dev/mmcblk1p1 - just edit that to say /dev/mmcblk0p1.
The current version of the flasher script (Dec 2019) changes the boot designation to eMMC automagically upon successful completion of the flash.

QEMU simple backend tracing dosen't print anything

I'm doing get simple trace file from QEMU.
I followed instructions docs/tracing.txt
with this command "qemu-system-x86_64 -m 2G -trace events=/tmp/events ../qemu/test.img"
i'd like to get just simple trace file.
i've got trace-pid file, however, it dosen't have anything in it.
Build with the 'simple' trace backend:
./configure --enable-trace-backends=simple
make
Create a file with the events you want to trace:
echo bdrv_aio_readv > /tmp/events
echo bdrv_aio_writev >> /tmp/events
Run the virtual machine to produce a trace file:
qemu -trace events=/tmp/events ... # your normal QEMU invocation
Pretty-print the binary trace file:
./scripts/simpletrace.py trace-events trace-* # Override * with QEMU
i followd this instructions.
please somebody give me some advise for this situation.
THANKS!
I got same problem by following the same document.
https://fossies.org/linux/qemu/docs/tracing.txt
got nothing because
bdrv_aio_readv and bdrv_aio_writev was not enabled by default, at least the version I complied, was not enabled. you need to open trace-events under source directory, looking for some line without disabled, e.g. I using:
echo "load_file" > /tmp/events
Then start qemu,
after a guest started, I run
./scripts/simpletrace.py trace-events trace-Pid
I got
load_file 1474.156 pid=5249 name=kvmvapic.bin path=qemu-2.8.0-rc0/pc-bios/kvmvapic.bin
load_file 22437.571 pid=5249 name=vgabios-stdvga.bin path=qemu-2.8.0-rc0/pc-bios/vgabios-stdvga.bin
load_file 10034.465 pid=5249 name=efi-e1000.rom
you can also add -monitor stdio to qemu command line, after it started, you can the following command in qemu CLI:
(qemu) info trace-events
load_file : state 1
vm_state_notify : state 1
balloon_event : state 0
cpu_out : state 0
cpu_in : state 0
1 means enabled events.
Modify the trace-events file in the source tree
As of v2.9.0 you also have to remove the disable from the lines you want to enable there, e.g.:
-disable exec_tb(void *tb, uintptr_t pc) "tb:%p pc=0x%"PRIxPTR
+exec_tb(void *tb, uintptr_t pc) "tb:%p pc=0x%"PRIxPTR
and recompile.
Here is a minimal fully automated runnable example that boots Linux and produces traces: https://github.com/cirosantilli/linux-kernel-module-cheat
For example, I used the traces to count how many boot instructions Linux has: https://github.com/cirosantilli/linux-kernel-module-cheat/blob/c7bbc6029af7f4fab0a23a380d1607df0b2a3701/count-boot-instructions.md
I have a lightly patched QEMU as a submodule, the key commit is: https://github.com/cirosantilli/qemu/commit/e583d175e4cdfb12b4812a259e45c679743b32ad

Reserving physical memory space as early as possible in Linux boot-time

I am trying to find a way to reserve physical memory for a proprietary memory type hardware as early as possible after system boots up (Linux CentOs with Intel Xeon server platform).
I did the following at setup_arch() in arch/x86/kernel/setup.c and it works, but found out that I am not allowed to patch the kernel. The requirement is no BIOS and kernel mod.
setup_arch()
{
....
// Calls a proprietary function that returns custom proprietary memory module's starting address and size.
memblock_reserve(mem_start_addr, mem_size);
.....
}
I cannot use memmap=xx/xx either at Grub, because the start and size of the device is unknown (it has to be "discovered" by software)
Is there any way to do this?
One idea is to write a custom grub module and set memmap=xx using it.
The following is how to do it.
Note that following method only works above CentOS 7 since CentOS 6.x or below uses grub 0.9x .
In that case, you may have to modify code of grub 0.9x and replace /boot/grub/stage1 or /boot/grub/stage2
$ git clone git://git.savannah.gnu.org/grub.git
$ cd grub
$ git checkout grub-2.02-beta2 # CentOS 7 currently uses grub-2.02-beta
$ vim grub-core/Makefile.core.def # add following row
module = {
name = my_custom_module;
common = lib/my_custom_module.c;
};
$ vim grub-core/lib/my_custom_module.c # create following file
#include <grub/dl.h>
#include <grub/env.h>
GRUB_MOD_LICENSE ("GPLv3+");
GRUB_MOD_INIT(my_custom_module){
// Calls a proprietary function that returns custom proprietary memory module's starting address and size.
const char *mem_size = "123";
grub_env_set("my_memsize",mem_size);
}
GRUB_MOD_FINI(my_custom_module){
}
$ ./autogen.sh
$ ./configure
$ make
Now you can find that grub-core/my_custom_module.mod is created.
so copy it to /boot/grub2/i386-pc/ (or whatever your *.mod file exists)
Edit the grub.conf and add something like
insmod my_custom_module
linux /boot/vmlinuz-3.10.el7.x86_64 root=UUID=1a3b5c7d9 ro memmap=${my_memsize}

Wine error: Application tried to create a window, but no driver could be loaded

I made a fcgi-isapi bridge, which I compile with wineg++ (keyword winelib). It is running a pure Win32 isapi extension using LoadLibrary/GetProcAddress. This works fine for a simple demo isapi dll, but not for a more complex one, where wine crashes somewhere inside the dll. WINEDEBUG=+olerelay,+storage,+relay gives me the following output:
0009:Call KERNEL32.InterlockedIncrement(00000150) ret=1001eebe
0009:Call KERNEL32.UnhandledExceptionFilter(0033f428) ret=7bc8e2f5
wine: Unhandled page fault on write access to 0x00000150 at address 0x7b8716bd (thread 0009), starting debugger...
Application tried to create a window, but no driver could be loaded.
Make sure that your X server is running and that $DISPLAY is set correctly.
couldn't load main module (0)
0009:Ret KERNEL32.UnhandledExceptionFilter() retval=00000000 ret=7bc8e2f5
Unhandled exception: page fault on write access to 0x00000150 in 32-bit code (0x7b8716bd).
Register dump:
CS:0023 SS:002b DS:002b ES:002b FS:0063 GS:006b
EIP:7b8716bd ESP:0033f8cc EBP:0033f8e0 EFLAGS:00010246( R- -- I Z- -P- )
EAX:00000001 EBX:00000000 ECX:00000000 EDX:00000150
ESI:0033f8fc EDI:0033f8d4
Stack dump:
0x0033f8cc: 7bc6592e 00000150 00000000 7ca3c7d4
0x0033f8dc: 00000000 0033fdc8 7b823b61 7b8be9d4
0x0033f8ec: 000102d1 0033f8f4 1001eebe 00000150
0x0033f8fc: 7ef82158 7ca3c7d0 f775d2c8 0033faac
0x0033f90c: 7bcd7208 00000000 f775c2b1 0000000f
0x0033f91c: 7bcbbed8 1004e06c 00000002 00115760
Backtrace:
=>0 0x7b8716bd in kernel32 (+0x616bd) (0x0033f8e0)
1 0x7b823b61 in kernel32 (+0x13b60) (0x0033fdc8)
2 0x7ef813d0 (0x0033fe18)
3 0x7ef815f5 (0x0033fe60)
4 0x7b85e84c in kernel32 (+0x4e84b) (0x0033fe78)
5 0x7b85f903 in kernel32 (+0x4f902) (0x0033feb8)
6 0x7bc77600 (0x0033fed8)
7 0x7bc7a59d (0x0033ffa8)
8 0x7bc775de (0x0033ffc8)
9 0x7bc4c65e (0x0033ffe8)
(tested with Wine 1.4.1 and 1.6.2, both give exactly the same output (only some different numbers)
My questions:
What happens really and how can I figure out the reason for the page fault error?
Does wine try to run a graphical debugger or is the dll itself trying to create a X11 object? And why does it fail? This installation is running in a 32bit chroot environment on a 64bit host, but I called xhost + and tested X11 using xlogo, gedit and even with a Win32 GUI application using Wine. There doesn't seem to be any X11 problem.
Update: here is the link to the source: http://gist.github.com/daald/5f37de8352e1c8ca62db
Try
wineconsole --backend=curses fastcgi-to-isapi.exe
As this post describes:
Wine has three options to run apps in command line mode:
On the bare linux console (wine)
On the linux console with curses (wine wineconsole --backend=curses)
In a win32 window (wine wineconsole --backend=user)
For wineconsole, the user backend is the default, that's why your
command line tried to open a window.
It does however not print the output of the program. If you need the output, you can first start wineconsole in interactive mode, then run the exe from there:
me#mycomputer:~$ wineconsole
Microsoft Windows 6.1.7601 (3.0)
Z:\home\me> HelloWorld.exe
Hello World!
Obviously not a good solution if you want to do it programmatically though.
As per this post, wine is meant for graphical programs. To run your program without a graphical interface, use wineconsole instead, e.g.
wineconsole fastcgi-to-isapi.exe
See: Text mode programs (CUI: Console User Interface).
Alternatively use a X virtual framebuffer, see: Run wine totally headless.

Resources