Re: [QEMU 7.2.0] Emulating custom peripheral designed for qemu 4.0.0

2023-03-30 Thread Peter Maydell
On Thu, 30 Mar 2023 at 12:51, Fenix GDH  wrote:
> I am working on emulating some soho router firmwares, but most of them use 
> SoCs not supported by qemu. I found the Firmguide, where the authors 
> implemented some specific devices on QEMU 4.0.0 in order to emulate linux 
> kernel. I'm trying to import these devices to the latest QEMU, but I got 
> several compiling errors.

> I noticed some functions syntax changed from version 4.0.0 to 7.2.0.
> Now I'm trying to parse it manually, but is there any documentation
> that can help this migration?

No, we don't document internal API changes like this. You can
usually find out how to change the code by looking through the
git history or git blame information for where the change to the
API was made to see how other boards were changed. And some
fixes are simple -- for instance your issue with serial_hd()
not being declared is likely just a missing #include line.

thanks
-- PMM



[QEMU 7.2.0] Emulating custom peripheral designed for qemu 4.0.0

2023-03-30 Thread Fenix GDH
Hi all!

I am working on emulating some soho router firmwares, but most of them use
SoCs not supported by qemu. I found the *Firmguide
, *where the authors implemented
some specific devices
 on
QEMU 4.0.0 in order to emulate linux kernel. I'm trying to import these
devices to the latest QEMU, but I got several compiling errors.

This is a example for ar71xx_generic.c file:

In file included from /home/fenix/qemu-7.2.0/include/hw/qdev-core.h:8,
 from /home/fenix/qemu-7.2.0/include/hw/sysbus.h:6,
 from ../hw/mips/ar71xx_generic.c:7:
/home/fenix/qemu-7.2.0/include/qom/object.h:1314:56: note: expected ‘const
char *’ but argument is of type ‘int’
 1314 | bool object_property_set_bool(Object *obj, const char *name,
  |^~~~
../hw/mips/ar71xx_generic.c:806:5: warning: implicit declaration of
function ‘memory_region_allocate_system_memory’
[-Wimplicit-function-declaration]
  806 | memory_region_allocate_system_memory(>ram, OBJECT(machine),
"ram", machine->ram_size);
  | ^~~~
../hw/mips/ar71xx_generic.c:806:5: warning: nested extern declaration of
‘memory_region_allocate_system_memory’ [-Wnested-externs]
../hw/mips/ar71xx_generic.c:808:88: warning: implicit declaration of
function ‘serial_hd’ [-Wimplicit-function-declaration]
  808 | serial_mm_init(get_system_memory(), 0x1802, 0x2,
s->cpu->env.irq[0x6], 115200, serial_hd(0), DEVICE_BIG_ENDIAN);
  |
   ^
../hw/mips/ar71xx_generic.c:808:88: warning: nested extern declaration of
‘serial_hd’ [-Wnested-externs]
../hw/mips/ar71xx_generic.c:808:88: warning: passing argument 6 of
‘serial_mm_init’ makes pointer from integer without a cast
[-Wint-conversion]
  808 | serial_mm_init(get_system_memory(), 0x1802, 0x2,
s->cpu->env.irq[0x6], 115200, serial_hd(0), DEVICE_BIG_ENDIAN);
  |
   ^~~~
  |
   |
  |
   int
In file included from ../hw/mips/ar71xx_generic.c:13:
/home/fenix/qemu-7.2.0/include/hw/char/serial.h:104:11: note: expected
‘Chardev *’ {aka ‘struct Chardev *’} but argument is of type ‘int’
  104 | SerialMM *serial_mm_init(MemoryRegion *address_space,
  |   ^~
../hw/mips/ar71xx_generic.c:851:5: warning: implicit declaration of
function ‘mips_load_kernel’ [-Wimplicit-function-declaration]
  851 | mips_load_kernel(MIPS_CPU(first_cpu), );
  | ^~~~
../hw/mips/ar71xx_generic.c:851:5: warning: nested extern declaration of
‘mips_load_kernel’ [-Wnested-externs]
../hw/mips/ar71xx_generic.c:800:34: warning: unused variable ‘binfo’
[-Wunused-variable]
  800 | static struct mips_boot_info binfo;

I noticed some functions syntax changed from version 4.0.0 to 7.2.0. Now
I'm trying to parse it manually, but is there any documentation that can
help this migration?


Thanks