vivier / qemu-m68k

Other
40 stars 6 forks source link

too many issue in this project #16

Closed syjzwjj closed 7 years ago

syjzwjj commented 7 years ago

Hello there're too many issue in the newer version above v2.0.0,when build with the static qemu-m68k q800-v2.4.0, it comes one error first: /home/zwjj/Desktop/qemu-m68k-q800-v2.4.0/user-exec.c:112:5: error: too few arguments to function ‘cc->handle_mmu_fault’ ret = cc->handle_mmu_fault(cpu, address, is_write, MMU_USER_IDX);

we can see the file include/qom/cpu.h line 153: int (handle_mmu_fault)(CPUState cpu, vaddr address, int size, int rw, int mmu_index); in the new version , the size argument is not use anymore,and I change the code,it comes more error : /home/zwjj/Desktop/qemu-m68k-q800-v2.4.0/linux-user/main.c: In function ‘cpu_loop’: /home/zwjj/Desktop/qemu-m68k-q800-v2.4.0/linux-user/main.c:2997:14: error: ‘EXCP_UNSUPPORTED’ undeclared (first use in this function) case EXCP_UNSUPPORTED: ^ /home/zwjj/Desktop/qemu-m68k-q800-v2.4.0/linux-user/main.c:2997:14: note: each undeclared identifier is reported only once for each function it appears in

this error can be solved by adding a new line #define EXCP_UNSUPPORTED 61 in target-m68k/cpu.h , and comes more error:

/home/zwjj/Desktop/qemu-m68k-q800-v2.4.0/linux-user/syscall.c: In function ‘host_to_target_data_link_rtattr’: /home/zwjj/Desktop/qemu-m68k-q800-v2.4.0/linux-user/syscall.c:1563:10: error: ‘IFLA_CARRIER_CHANGES’ undeclared (first use in this function) case IFLA_CARRIER_CHANGES: ^ /home/zwjj/Desktop/qemu-m68k-q800-v2.4.0/linux-user/syscall.c:1563:10: note: each undeclared identifier is reported only once for each function it appears in /home/zwjj/Desktop/qemu-m68k-q800-v2.4.0/linux-user/syscall.c:1568:10: error: ‘IFLA_LINK_NETNSID’ undeclared (first use in this function) case IFLA_LINK_NETNSID: ^ /home/zwjj/Desktop/qemu-m68k-q800-v2.4.0/linux-user/syscall.c: In function ‘host_to_target_data_addr_rtattr’: /home/zwjj/Desktop/qemu-m68k-q800-v2.4.0/linux-user/syscall.c:1598:10: error: ‘IFA_FLAGS’ undeclared (first use in this function) case IFA_FLAGS:

and it seems that the macro in the new version is QEMU_IFLA_NUM_RX_QUEUES with QEMU prefix,I'm not sure how to change that.

The branch q800-v1.1.0 seems no problem ,but when I use the qemu-system-m68k to lauch the kernel build in lxc ,it comes with segmentation fault when lauch /sbin/init and use other command.Can you tell me how to fix these issue

syjzwjj commented 7 years ago

and I test on ubuntu 16.04 and ubuntu 14.04.5

glaubitz commented 7 years ago

Hi syjzwjj!

You are using a branch which is no longer in active development. All the work happens in the 680x0-master-dev branch. If the q800 branches contain any changes that you need which are not part of the 680x0-master-dev branch, you can try rebasing your branch from the 680x0-master-dev branch.

PS: I made a guide for qemu-user on m68k on Debian if you're interested [1].

Adrian

[1] https://wiki.debian.org/M68k/sbuildQEMU

syjzwjj commented 7 years ago

Hi , sudenly I found that I need to compile the M520x arch and I've successfuly cross compile the m68k vmlinux, so maybe don't need this repository , thanks a lot~ And I forgot to say that I've test the 680x0-master-dev branch and it also comes error that some macros didn't defined, you can compile this branch and see if errors still there,and this errors I remembered that most in tcg syscall translation,and the macros in this repository didn't existed in the newest version of qemu.So maybe this error is not very easy to solve. And I don't known if the link you provide support M520x architecture? It seems that the lxc container in the http://ftp.ports.debian.org/debian-ports/pool-m68k/ are all m6800 binary

glaubitz commented 7 years ago

If you want to use Coldfire M520x, you should use qemu upstream [1]. The code in this repository is dealing with full 680x0 support and also still under heavy development. You also didn't mention Coldfire at all, so I assumed you wanted to build the regular 680x0 emulator.

And since the master-680x0-dev branch builds fine on my Debian unstable machine, I don't think this is actually a valid bug report. The issue you are seeing is most likely a local issue and not specific to qemu-m68k. Please make sure you have all build dependencies installed and your build environment is up to date.

[1] http://wiki.qemu.org/download/qemu-doc.html#ColdFire-System-emulator

syjzwjj commented 7 years ago

Hi , I build on my ubuntu again,the error is here :

/home/zwjj/Desktop/qemu-m68k-680x0-master-dev/linux-user/syscall.c: In function ‘do_getsockopt’: /home/zwjj/Desktop/qemu-m68k-680x0-master-dev/linux-user/syscall.c:3025:14: error: ‘NETLINK_LIST_MEMBERSHIPS’ undeclared (first use in this function) case NETLINK_LIST_MEMBERSHIPS: { ^ /home/zwjj/Desktop/qemu-m68k-680x0-master-dev/linux-user/syscall.c:3025:14: note: each undeclared identifier is reported only once for each function it appears in make[1]: [linux-user/syscall.o] 错误 1 make: [subdir-m68k-linux-user] 错误 2

the error message of the code is here : https://github.com/vivier/qemu-m68k/blob/680x0-master-dev/linux-user/syscall.c#L3025

and I've install the libnl-3-dev package and the newest code in qemu is : https://github.com/qemu/qemu/blob/master/linux-user/syscall.c#L3146

I found the switch case handle NETLINK seems not exist now. This function that have error message is called by do_getsockopt seems like to handle the binary's getsockopt syscall,and handle the result of SOL_NETLINK, the second argument of getsocketopt. Maybe the switch case NETLINK_LIST_MEMBERSHIPS only for m68k? I guess not,because basically there is no difference on syscalls between different architectures in userland and this code run on linux-user mode , all syscall are rewrited by tcg and finnaly call the syscall function on host machine .I build the v1.7.0 branch and no error results ,this macro didn't exist : https://github.com/vivier/qemu-m68k/blob/680x0-v1.7.0/linux-user/syscall.c#L1651 . Why in newer version of this repository have the new code to handle the SOL_NETLINK level?And also search this macro in <linux/netlink.h> ,also didn't exist... Maybe I haven't install the correct netlink devel package ?

So the question comes up , why the newer branchs have the NETLINK_LIST_MEMBERSHIPS handle code ,I think this is the key point that maybe solve ,these error message are very intersting~

vivier commented 7 years ago

On Fedora, NETLINK_LIST_MEMBERSHIPS comes with kernel headers package.

glaubitz commented 7 years ago

If that's the case, it should be enough to run

apt install linux-image-$(uname -r)

to fix the issue.

syjzwjj commented 7 years ago

Issue still exist ,this package and linux-headers-$(uname -r) has been installed on my machine , and as vivier said , this macro in kernel headers package on fedora,have you test it on the ubuntu?

glaubitz commented 7 years ago

It builds fine on Debian unstable and I'm using it there all the time. It might be possible that the Ubuntu kernel is built without support for Netlink, no idea.

A quick search on sources.debian.net shows you where it's defined:

https://codesearch.debian.net/search?q=NETLINK_LIST_MEMBERSHIPS

glaubitz commented 7 years ago

Just as a heads-up: I just had a closer look and the problem occurs when using a kernel older than 4.8.x. The issue is reproducible on Debian Jessie which doesn't have anything newer than kernel 4.7.x currently. Linux 4.8.x is not yet available in Debian Backports.

Thus, while this problem report is actually valid, it's not a bug in qemu-m68k but rather just an issue of one of the dependencies being too old.

@vivier I think we can safely close this unless @syjzwjj objects.

syjzwjj commented 7 years ago

I've received and no problem now,thank you~