qemu-discuss
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Initialize RAM from a file and save it to the file


From: Philippe Mathieu-Daudé
Subject: Re: Initialize RAM from a file and save it to the file
Date: Mon, 19 Jul 2021 12:07:13 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.11.0

On 7/19/21 12:04 PM, Peter Maydell wrote:
> On Mon, 19 Jul 2021 at 10:35, Hiroko Shimizu <hiroko07168@gmail.com> wrote:
>>
>> Hello,
>> I'd like to initialize RAM from a specific file when RAM is created.
>> Then,  I tried using memory_region_init_ram_from_file().
> 
> If you want to put something specific into RAM on startup the
> easiest way is to use the 'generic loader' on the command line:
> https://qemu-project.gitlab.io/qemu/system/generic-loader.html
> 
> You only need to use memory_region_init_ram_from_file() if you
> want guest changes to the RAM as it runs to be written back to
> the file.
> 
>> I wonder what file format is necessary.
> 
> The file is mmap()ed, so it is raw binary.
> 
> If you really need the "write back guest memory changes" behaviour,
> I would suggest that rather than making your machine create the
> RAM memory region in a specific file-backed way, you instead
> create the RAM memory region normally, and on the commandline
> use
>   -object memory-backend-file,id=myram,[other-options] -machine
> memory-backend=myram
> to make QEMU use that file backend for the machine's main RAM.
> (Check the docs for what the 'other-options' ought to be.)

Ah great, this is surely what I was looking for, thanks =)

Phil.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]