1

So, I have a custom AOSP image that I'm building, and it allows me to provide my own kernel and debugging features that I want (this is just for the record, because you can't do some things that are needed with a regular AVD). I need to change the contents of /vendor, and I thought that I could do this by providing my .img file to the emulator with:

emulator -vendor /path/to/my/vendor.img

But, as I checked, the md5sum does not match for some files between my vendor.img and in the /vendor/path/to/file when I run the emulator and connect with adb shell. This is perplexing to me, because when I run with -verbose, I can see the arguments given to qemu for the drive and I expect that img to be mounted under /vendor. Looking at the original vendor-qemu.img with 7z, I can check the md5sum of ome files and see that despite the -vendor argument, the sums did not change to the values in my img, but match the old intead. I even went to the length of renaming the original vendor-qemu.img and putting my img in it's place with the name vendor-qemu.img. Same result with the md5sums though.

Perhaps I could be wrong, and the -vendor emulator argument shouldn't change the contents of /vendor in the running emulator instance. What do I do to get the /vendor directory contents of a running emulator instance to match with the vendor.img?

Adam Miller
  • 111
  • 1
  • /vendor should be the path that the vendor.img is mounted to, if I understand correctly. So, if I change the vendor.img, then that should change the contents of /vendor, but it doesn't. – Adam Miller Nov 05 '21 at 16:30
  • I don't know what FEC would have to do with this. I thought that qemu sees the .img files as drives, android mounts them to directories – Adam Miller Nov 05 '21 at 17:02
  • No. I did not know that it did that. I was wondering if I could rebuild the vendor.img by adding or editing files in the out/target/product/generic_x86_64/vendor and just calling make. – Adam Miller Nov 05 '21 at 20:56
  • just realized you already posted on stackoverflow. I completely misunderstood the question. issue is not with modifications in first place. You ask about how to load modified vendor.img - probably only on reboot. That's how it works on mobile phone, android partitions are loaded ro on boot and dm-verity prevents modifications during runtime. Don't know what running emulator instance is, but I doubt it's possible to replace disk during runtime – alecxs Nov 05 '21 at 21:20
  • I'm not trying to replace it during runtime. I want to have the entire contents of /vendor to match the vendor.img that I am trying to boot the emulator with. – Adam Miller Nov 05 '21 at 21:58
  • I don't think so. Actually, the vendor.img is a sparse image as returned by file. I was able to use simg2img and img2simg in a script to decompress all of the contents of the original and then make a new one. Also, I don' think the system image contains /vendor, I checked and found an img with an empty /vendor.

    Since you pointed out FEC, I thought about it again, and think that dropping the files into the AOSP build process would do the trick. That way, I wouldn't be scripting the creation of my own vendor.img, just drop my files into place and let the system do the rest.

    – Adam Miller Nov 06 '21 at 15:01
  • Just using simg2img and then decompressing with 7z works. I then went the other way with img2simg – Adam Miller Nov 06 '21 at 23:14
  • I only use 7z for extraction, to go from img to a folder. I had a whole different script for creating the img, where I did mount a folder and used mkfs to format it the way the old one was. Right now, no matter if I swap the img files out, the vendor folder remains unchanged though. I think I want to investigate the FEC possibility. – Adam Miller Nov 07 '21 at 18:05

1 Answers1

0

The way I found to do it was to go to:

out/target/product/<lunch tgt>/vendor/

And just put the vendor contents the way you wish them to be. When finished do:

make vendorimage && make systemimage

Adam Miller
  • 111
  • 1