attila-lendvai/openwrt-auto-extroot

Not able to generate image even with minimum packages

Opened this issue · 2 comments

PREINSTALLED_PACKAGES+=" blkid mount-utils swap-utils e2fsprogs fdisk" add to the size of the image and leave very little space so one can have functionality (like USB Storage PREINSTALLED_PACKAGES="block-mount kmod-usb-storage kmod-fs-exfat").

I commented out:

#PREINSTALLED_PACKAGES+=" kmod-usb-uhci kmod-usb-ohci"

# the following packages are optional, feel free to (un)comment them
#PREINSTALLED_PACKAGES+=" wireless-tools firewall iptables"
#PREINSTALLED_PACKAGES+=" kmod-usb-storage-extras kmod-mmc"
#PREINSTALLED_PACKAGES+=" ppp ppp-mod-pppoe ppp-mod-pppol2tp ppp-mod-pptp kmod-ppp kmod-pppoe"
#PREINSTALLED_PACKAGES+=" luci"

and yet I get errors:

[mktplinkfw] *** error: images are too big

and of course no .bin images are generated as a result.

Because I had the same issue of NAND memory running out on router trying to install USB support manually (opkg install), I figured your project would help. Of course, am still stuck in the same problem as before.

How do I go about this?

IIRC it's pretty dumb how the image is laid out, i.e. there's a fixed length allocated for the kernel in the makefiles or in some config, and if it doesn't fit, then image generation fails, or if it's too much then image space is wasted. you can try to alter that layout, and it's even possible to compile a smaller kernel leaving out some features, but i never ventured that deep.

and you're lucky that now you get an "images are too big" error. i don't remember seeing that, just silently not generating the images (maybe it was just lost in the build output noise).

which router is this?

Thanks @attila-lendvai

For now, I think I am happy that I got this done albeit with much mucking around and manually thus defeating the purpose of your project.

In case someone lands here looking for a way to combat the space problem on their router without access to a linux machine:

(assuming you are on OS X):

  1. Get docker and kitematic
  2. Get arch linux or any other distro you are comfortable with and set it up for basics (git, make)
  3. Follow instructions here on getting the Openwrt image builder tar ball
  4. Generate your custom image with minimal packages. you would only need 'kmod-usb-support block-mount kmod-fs-ext4'. Don't install luci as it takes up space. You can do everything in command line, you don't need it just yet.
  5. Copy the image out of docker with docker cp <container_hash>:</path/in/container/bin/ar71xx/blah-blah-sysupgrade.bin> .
  6. Upload this to your router
  7. Prep your flash drive. make sure it's partitioned according to your needs. extroot can only be in extX filesystem formats. I used e2fsprogs (installed via brew) and divided my 64gb stick into 250MB ext4 for root and rest as exfat (because it's readable both on mac and windows).
  8. Stick your flash drive into the router
  9. ssh into your router
  10. Follow instructions on creating extroot

Reboot and you should have more space and install away :)

P.S: In case you are unable to install kmod-fs-exfat or mount exfat on openwrt, this is the reason. ipk files are nothing but tar balls. It's a hassle to unpack-editing-repack which may or may not work. Instead simply extract the ipk file, within which you will have to extract the data tar ball and scp the kernel module exfat.ko to your router and manually insert it. The module won't load after a restart but you could insmod /root/exfat.ko and mount /dev/sdaX /path/ to "Startup" section in Luci as a workaround.