steffend
Hey there!
This is more of a feature requests to the people knowing the internals of fwup. I’m currently testing some nerves systems in QEMU, therefore I’m using mix firmware.image to write a raw disk image. The problem is that, compared to a real device, the application partition is never expanded to a reasonable size. To workaround this, I currently need to
- resize the image (
qemu-img resize disk.img +20G) - boot up the image once to create the filesystem
- stop the machine again and boot into the gparted live system
- resize the partition in gparted
- stop the machine and eject the gparted live iso
- finally boot up nerves with a reasonable app partition size
I tried to look into the fwup internals, but that’s out of my comfort zone…
I’m imagining something like mix firmware.image disk.img --size 20G to create an image with 20GB in size where the application partition expands like when burning a 20GB SD card. This is probably something that would need to be implemented in fwup itself, e.g. fwup -a -i firmware.fw -t complete -d disk.img --size 20G.
Thanks!
Trending in Questions
Other Trending Topics
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #deployment
- #library
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #elixirconf
- #channels
- #exunit
- #discussion
- #code-sync
- #javascript
- #podcasts
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #blog-post
- #elixir-ls
- #ai
- #elixirconf-us
- #phoenix_html
- #iex
- #graphql
- #genstage
- #websockets
- #supervisor
- #advent-of-code
- #distillery
- #processes
- #api
- #forms
- #hex
- #security
- #metaprogramming










Showing Posts 1 to 7- Show Best Posts
- Show All (oldest first)
- Show All (newest first)
fhunleth
What you’re doing sounds like the normal path outside of qemu, but just not automated.
Before I expand on this, if you’re only going to be working in qemu with a 20GB application partition, I’d change the
fwup.confto specify a 20GB partition. To do this, change the line that looks like this:to
Normally the
fwup.conffiles specify a lowest expected size of the destination media. This is for practical reasons since there’s variation in 4GB eMMC parts or maybe you want to accommodate whatever MicroSD or eMMC that is the easiest to buy or maybe you want flash programming to go faster on the manufacturing line.Regardless of the reason, the application data partition needs to be formatted on the first boot. Nerves does that for you in
Nerves.Runtime. However, you could change that code to run gparted to max out the application data partition first and then do the first-time format. This would save the reboot and the manual hassle that you’re going through.Sadly, we’ve never done this with Nerves. In hindsight, I’m a little surprised that the need hasn’t arisen, but I’m not sure many Nerves users need to max out the application data partition. Or more likely, the change was too device-specific and never contributed upstream. I hope that in your case, adjusting the
fwup.confmight be “good enough”.steffend
I don’t want to make assumptions about the minimum size, as QEMU is really just for testing.
I tried to do the following
but sadly, fwup still doesn’t expand the application partition. I assume it doesn’t do any expansion when it targets an image - but that sounds like something that should not be too hard to implement, right?
If that’s not possible, I might just set the minimum size to 2GB or something
fhunleth
fwupcan expand the final partition to the size of the media that its targeting usingexpand = truein the partition description. Most Nerves systems use this option includingnerves_system_x86_64. See nerves_system_x86_64/fwup.conf at main · nerves-project/nerves_system_x86_64 · GitHub.The trick is that
fwuphas to be able to determine the size of the destination. If it can’t, then you can pass the--max-size <512-byte blocks>option tofwup.Your first line of creating the 20G
disk.imgshould create a file thatfwupcan figure out the size for automatically. I just looked at the code and I don’t see why this wouldn’t work (assumingexpand = trueon the final partition). If it doesn’t, could you post an issue with thefwup.confor a simplified version that doesn’t work so I can replicate?steffend
Indeed,
expand = true: nerves_containers_x86_64/fwup.conf at 0da6d8b483b568a5353c681ef0545dc0c9d6a574 · nerves-containers/nerves_containers_x86_64 · GitHubNice, that sounds like exactly what I need! But trying it, it doesn’t work:
Looking at the resulting image, the MBR did not expand
You can use the example repo I’m currently testing with, all the systems are prebuilt: GitHub - nerves-containers/docker_example: Example project using the nerves_containers base systems · GitHub
steffend
Possibly related commit Update fwup config to fill out data partition for qemu · nerves-containers/nerves_containers_x86_64@399bc4b · GitHub
- the repo is basically a fork of
nerves_system_x86_64.fhunleth
@steffend I added support for part of the issue that you ran into since it was trivially reproducible. I expect that this fixes the case when you create the
disk.imgfile and do not use--max-size.PR is at When writing regular files, check file size to support expansion by fhunleth · Pull Request #231 · fwup-home/fwup · GitHub. Manual build instructions for
fwupare at fwup/docs/build_osx.md at main · fwup-home/fwup · GitHub, but no worries if you don’t have time to try it out.The fact that
--max-sizedoesn’t work is strange since there actually is a unit test that I thought exercised that case. I will investigate that next time I get a spare moment.Thank you for bringing this to my attention.
fhunleth
I went through your test steps to verify that the final partition was properly expanded on your
docker_examplerepository. Both usingqmeu-imgand the--max-sizeoption work for me with thefwupPR modifications. I’m going to go ahead and make afwup1.11.0 release so that it’s generally available.