opkginstall new packages somewhere else; however:
make image PROFILE=TLMR3020 PACKAGES="blkid block-mount kmod-fs-ext4 kmod-usb2 kmod-usb-uhci kmod-usb-ohci kmod-usb-storage"
You need to mount a file system, on which the overlay will be copied to.
Make sure that you can mount and have read/write access to your external storage device. For example, check if you can read/write from a manually mounted file system on your partitioned USB drive at
sda to your actual needs):
mount /dev/sda1 /mnt/sda1
You should check if the mount was succesful by running
df. Now check if you can write to
/mnt/sda1 by writing a file to it and reading it back.
As described in extroot theory you can use pivot-overlay or pivot-root. This section will only cover pivot-overlay which is the recommended extroot implementation. If you really want pivot-root, check the Barrier Breaker section.
opkg update ; opkg install block-mount kmod-fs-ext4 kmod-usb-storage-extras
mount /dev/sda1 /mnt ; tar -C /overlay -cvf - . | tar -C /mnt -xf - ; umount /mnt
block detect > /etc/config/fstab ; vi /etc/config/fstab
option targetof your root overlay partition to show
overlay, as it will cause broken, duplicate mounts)
option targetof your other partition(s) to show whatever mount point(s) you want them to have (make sure to also create the directories those mount points point to)
config 'global' option anon_swap '0' option anon_mount '0' option auto_swap '1' option auto_mount '1' option delay_root '5' option check_fs '0' config 'mount' option target '/overlay' option uuid 'c91232a0-c50a-4eae-adb9-14b4d3ce3de1' option enabled '1' config 'swap' option uuid '08b4f0a3-f7ab-4ee1-bde9-55fc2481f355' option enabled '1' config 'mount' option target '/data' option uuid 'c1068d91-863b-42e2-bcb2-b35a241b0fe2' option enabled '1'
mountshould show USB partition mounted as
root@OpenWRT:mount /dev/root on /rom type squashfs (ro,relatime) proc on /proc type proc (rw,noatime) sysfs on /sys type sysfs (rw,noatime) tmpfs on /tmp type tmpfs (rw,nosuid,nodev,noatime) /dev/ubi0_1 on /overlay type ubifs (rw,noatime) overlayfs:/overlay on / type overlay (rw,noatime,lowerdir=/,upperdir=/overlay/upper,workdir=/overlay/work) tmpfs on /dev type tmpfs (rw,relatime,size=512k,mode=755) devpts on /dev/pts type devpts (rw,relatime,mode=600) /dev/sda1 on /overlay type ext4 (rw,relatime,data=ordered) /dev/sda3 on /data type ext4 (rw,relatime,data=ordered) debugfs on /sys/kernel/debug type debugfs (rw,noatime)
dfshould show free space available on your
root@OpenWRT:df Filesystem 1K-blocks Used Available Use% Mounted on rootfs 27180 7796 17964 30% / /dev/root 2304 2304 0 100% /rom tmpfs 127668 1468 126200 1% /tmp /dev/ubi0_1 1998672 8056 1869376 0% /overlay overlayfs:/overlay 27180 7796 17964 30% / tmpfs 512 0 512 0% /dev /dev/sda1 1998672 8056 1869376 0% /overlay /dev/sda3 242846048 163864 230323224 0% /data
/etc/opkg.confto allow installation of packets bigger than your
/rompartitions free space:
echo option force_space >> /etc/opkg.conf
mkfs.ext4 /dev/sda1as per the example, also see storage).
config 'global' / option delay_root. On my system I had to set it to 15 seconds to get extroot working. Another hint to this being the culprit is having a working swap or other partitions mounted after booting, but not your extroot.
export PREINIT = 1;
mount_root, as described in 14946 ticket, which in the case of running Chaos Calmer r44266 in the Comtrend AR-5387un, has been the only thing that allowed me to achieve extroot.
kmod-fs-ext4 package is rather large, it can be a challenge setting up extroot on 4MB flash devices, where extroot is most needed.
Therefore, you can build an image to flash to your device with the required packages already included, this method saves considerable space on your device.
Using the image generator makes building the image very easy. See the Image Generator page for more detailed instructions.
make infofor a list):
make image PROFILE="TLMR3220" PACKAGES="kmod-fs-ext4 kmod-usb-storage"
Your new firmware file will be located within the
bin folder, with the packages to enable extroot already included.
iptableswill be broken.
Sometimes you may need to access the original root overlay, for example to change your extroot settings. A convenient way of doing this is to configure
/etc/config/fstab on your extroot partition to mount the original root overlay in another directory, like this:
config mount option target /overlay-boot option device /dev/mtdblock3 option fstype jffs2 option options rw,sync option enabled 1 option enabled_fsck 0This assumes the original, internal overlay was on
/dev/mtdblock3- check your router's page on this wiki and look at the flash map to confirm what MTD block it is for you. Or run
$ cat /proc/mtdand search the partition named
rootfs_datato know where is your overlay.
If you then create
/overlay-boot on the extroot partition, this directory will contain the original root overlay, which is used as the main root overlay until the extroot is up and running. So you can then for example edit
/overlay-boot/etc/config/fstab to change your extroot configuration (or temporarily disable it) should you ever need to.
For extroot on OpenWrt versions Barrier Breaker, Attitude Adjustment, Backfire see: extroot.old