Building for x86 : how to generate only one image?

Hi.
I'm building for x86/64. The make command generates four images : squashfs / ext4 and EFI / MBR. I use a low end refurbished laptop, and that takes time.

In order to render the build faster, is there a way to force building of only one image?
Does it involve editing building script?

I need only MBR images. I would like to build only the ext4 or only the squashfs image. I need the ext4 for a stable router, and the squashfs for a testing router (I have two as you understand).
Thank you.

the content should be the same, only packaging differs, generating the actual images shouldn't be that big part of the whole process - it's not compiling the same binary 4x for 4 different image formats.

(I sure hope)

The time needed for those images is minimal, even more so compared to the time it takes for all the binaries to be compiled (toolchain etc). If you want to disable some of those images you need to go into the configuration, open Target images and deselect what you don't want.

I'm using the x86/64 image builder, and run a make command. So I don't have the menu you are refering to (from the whole image builder).

Yes I know all this. Actually generating the four images is what take most time. Just ran a build ...
1:50 (min) to download files until the "building images" message
6:10 end
building the four images took approximately 4:20, hence 1:05 min per image

I recommend that you use the Online Image Builder to build your custom OpenWrt firmware (with packages that you want already installed in the firmware, along with some commands to run on first boot):

P.S. Don't delete the packages that appear in "Custom package selection", they are necessary or you will brick the router, but you can replace those packages if you want.

I know such online engine builder (great stuff !).
Actually, when selecting snapshot, firewall4 is the default firewall package, and it's generating a flaw (nftables) :wink:

1 Like

Hi all.
I have came to a solution. As I guessed, it involves editing a script.

Goal : using the x86_64 image builder, generate only one image (squashfs MBR in this case) instead of the 4 generated by default. The real goal is to spare build time.

I have installed the building system, and studied what happened to .config once I have checked/unchecked a few options in menuconfig.

It appears that modifying two lines in .config achevies the goal. You may have hard feelings manually editing .config :wink: Put comments in front of:
line 177
# CONFIG_TARGET_ROOTFS_EXT4FS=y
line 189
# CONFIG_GRUB_EFI_IMAGES=y

Now just run the MAKE command. After downloading the packages, only one image is generated.
Keep in mind that this solution is harsh and may not fits for everyone's case.

Just curious: How much build time is your solution saving?

1 Like

Should be under or around 20s per image on any system built within the last decade. We're talking about compressing around 20-30 MB (depending on how many optional packages get included) with squashs-lzma. Yes, compressing with lzma is relatively slow, but it profits significantly from multiple cores and the input data size is small, if not to say tiny.

  • 2 min to download packages
  • 1 min per image, 4 images
    total 6min

As I can skip 3 images, I can save 3 min, so about half of the building time.
I'm using a low end laptop which is dedicated for building. It has a slow APU (2 cores) and a single HDD. I can understand that such tweak may seem meaningless for a high end computer, but not in my case.

1 Like

The download phase is done once, and a fixed constant depending on your WAN speed - but the image creation step looks quite off…

$ wget https://downloads.openwrt.org/snapshots/targets/x86/64/openwrt-imagebuilder-x86-64.Linux-x86_64.tar.xz

$ tar -xJf openwrt-imagebuilder-x86-64.Linux-x86_64.tar.xz
$ cd openwrt-imagebuilder-x86-64.Linux-x86_64/

$ time make image PACKAGE="luci-ssl"
[…]
Calculating checksums...

real    0m48,927s
user    0m31,046s
sys     0m6,411s

I manually started a stopwatch at "Building images", and got a total of just under 30s on my 2013 vintage system for the full set of images.

He is probably using a netbook or a laptop with netbook-grade CPU, I have one with an A4-1200 APU and that hardware is so absolute garbage-tier that it's not even capable of printing a pdf over USB at full speed. The CPU chokes and goes 100% on the print spooler service that is converting the pdf into the protocol to the printer over USB, and the printer pauses like 3 times per page to wait for the data stream from the laptop. Loading basic programs is still slow even if I have put a basic SSD in it. It's faster than with the original hard drive, that's for sure, but it's still not very responsive by modern standards.

I still use it to run SPI flashing tools and similar, troubleshooting networking equipment and other very basic tasks where I need Windows OS to run the tools

Yes I'm using a low end netbook with a slow APU. It is 10x slower than an average 10y old i5.

I don't complain as the netbook was free, and its only purpose is to create builds.

1 Like

Get a free cloud server at Azure, Google, Oracle or Amazon, compile it there.

1 Like

This has gone off topic.
I have a lot of computers at home, from glorious vintage 8bit :heart_eyes:, to a modern high end gaming.
I don't need more computer power. I have installed OpenWrt on several routers, in different places (family, relatives), so what I need is a transportable solution dedicated to build. That is why I use this laptop, despite being very slow. Building for ath79 or mt7621 is fast enough, only building for x86 is rather slow.

OT indeed, but a cloud hosted system is very transportable, only you don't have to carry it, and it's always accessible, from everywhere ,)

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.