How to compile/build openwrt for a specific router to be exactly the same as the released stable image for it?
Short answer: You can't (reasons)
Long answer: Depending on your use-case, this might not be necessary and you can get away with firmware-selector and/or attended sysupgrade and/or the ImageBuilder.
What would you like to achieve?
I'd like to compile an identical image first, then add additional packages. This way the new version will be as close as possible to the original version with manually installed packages.
isn't the online (or offline) image builder good enough for this ?
or are those packages out of repository ?
I am not sure that it is identical because even when I add all the packages that should be in it (such as luci etc) the image has a different size.
compared to .... ?
this statement is suddenly becoming very vague ...
...compared to the original image officially distributed for this router.
that's a problem because (assuming you don't go over the flash size limit) ... ?
what does officially mean, or whom, perhaps ?
It's not actually a problem, but a question: since both my build and the official build have the same packages, why are they significantly different in size?
officialy = downloaded from https://downloads.openwrt.org/releases/22.03.5/
It's not a rootfs compression thing, is it ?
What's your device ?
TP-Link TL-WR1043N/ND v4
What is "significantly different", i.e. by how many bytes do they differ?
Did you try the firmware-selector at https://firmware-selector.openwrt.org/?version=22.03.5&target=ath79%2Fgeneric&id=tplink_tl-wr1043nd-v4
For self compiled images it is to be expected that there are differences for the reasons given in my first answer.
https://downloads.openwrt.org/releases/22.03.5/targets/ath79/generic/openwrt-22.03.5-ath79-generic-tplink_tl-wr1043nd-v4-squashfs-sysupgrade.bin size 6029646 bytes
compilation: make image PROFILE="tplink_tl-wr1043nd-v4" PACKAGES="cgi-io -kmod-nls-base -kmod-phy-ath79-usb -kmod-usb-core -kmod-usb-ehci -kmod-usb-ledtrig-usbport -kmod-usb2 libiwinfo-lua liblua5.1.5 liblucihttp-lua liblucihttp0 libubus-lua lua luci luci-app-firewall luci-app-opkg luci-base luci-lib-base luci-lib-ip luci-lib-jsonc luci-lib-nixio luci-mod-admin-full luci-mod-network luci-mod-status luci-mod-system luci-proto-ipv6 luci-proto-ppp luci-ssl luci-theme-bootstrap px5g-wolfssl rpcd rpcd-mod-file rpcd-mod-iwinfo rpcd-mod-luci rpcd-mod-rrdns uhttpd uhttpd-mod-ubus"
openwrt-22.03.4-ath79-generic-tplink_tl-wr1043nd-v4-squashfs-sysupgrade.bin size 5964608 bytes
Well, you comipled 22.03.4 while the download contains 22.03.5 - no wonder there is a difference.
Error copying link. However, https://downloads.openwrt.org/releases/22.03.4/targets/ath79/generic/openwrt-22.03.4-ath79-generic-tplink_tl-wr1043nd-v4-squashfs-sysupgrade.bin also has size 6029646 bytes
Since your profile above shows 5 removed packages why do you wonder that the image is smaller?
According to mainfests, they contain the same packages.
First few packages have a
- in front of them, that means they are removed.
Problem solved. file openwrt-22.03.5-ath79-generic.manifest doesn't contain packages from generic-tp-link.mk so i need to add packages kmod-usb2 and kmod-usb-ledtrig-usbport
In simple terms, to compile it is enough to use the command:
make image PROFILE="tplink_tl-wr1043nd-v4" PACKAGES="luci-ssl"
Thank you for your help