Linkit Smart 7688 move filesystem to SD Card

I updated my Linkit Smart 7688 to openWRT 18.06.2.
I then followed this manual to Mount the root FS on the internal SD card because the flash of my device is not sufficient.

The second command leads to a error :slight_smile:

root@openWrt:~# mkfs.ext4 /dev/mmcblk0p1
mke2fs 1.44.1 (24-Mar-2018)
The file /dev/mmcblk0p1 does not exist and no size was specified.

wondering if thats the right way to get the OS to the SD card...
Any ideas how to do that right?

Did you create partitions on the sdcard?

See prominent orange section at the top of the page... specifically, the partitioning with fdisk therein.

Be aware the linked page has a misleading title.....

Mounting the root FS on an SD card

The instructions are for and OVERLAYFS, it is NOT a true rootfs as the title implies.


hmm. I don't understand both.
How can i make my flash based linux work from SD card?

root@openwrt:/# df -h
Filesystem                Size      Used Available Use% Mounted on
/dev/root                 2.5M      2.5M         0 100% /rom
tmpfs                    61.2M     92.0K     61.1M   0% /tmp
/dev/mtdblock6           28.0M      2.6M     25.4M   9% /overlay
overlayfs:/overlay       28.0M      2.6M     25.4M   9% /
tmpfs                   512.0K         0    512.0K   0% /dev

it seams wrong to me that the SD card does not show up here. Its is inserted correctly.
Does a SD Card need drivers?

For more details, please refer to Rootfs on External Storage (extroot) in OpenWrt.

If you are putting the extroot on a non-USB device such as a mmc card all modules needed acccess the device should be in appropriate file in /etc/modules-boot.d. For example using a sdhci card on a mt7688/mt7628 device /etc/modules-boot.d/mmc needs have two lines added:

It's referrred to in the instructions you posted.

As wulfy23 states, if you follow those instructions you will be able to use the SD card for storage, as if it was "the" root file system.

As wulfy23 also points out, you're not really booting from SD, but just using it for storage.

If you actually want to boot from SD, you probably either need to change the boot loader args passed to the kernel or, more likely, build an image with the root partition specified as being on the SD card and appropriate drivers built into the kernel.

Unlike an x86 system with a BIOS, embedded systems generally can't "auto-detect" where the root file system resides and magically mount it.

You need to build the drivers into the kernel because if, for example, you need the ext4 driver to mount the root file system and the ext4 driver is on the root file system, you're stuck.

Thanks. I think i don't whant to boot from the SD.
I wish to have more disk space and lower the risk of destroying the flash storage with to many write cycles.

But it seams to me that the SD Card (that works on my Laptop) is not recognized.
Are you sure i don't miss a driver?

root@openwrt:/# df -h
Filesystem                Size      Used Available Use% Mounted on
/dev/root                 2.5M      2.5M         0 100% /rom
tmpfs                    61.2M    696.0K     60.5M   1% /tmp
/dev/mtdblock6           28.0M      2.6M     25.4M   9% /overlay
overlayfs:/overlay       28.0M      2.6M     25.4M   9% /
tmpfs                   512.0K         0    512.0K   0% /dev
root@openwrt:/# cd /mnt
root@openwrt:/mnt# ls
root@openwrt:/mnt# cd ..
root@openwrt:/# ls
bin      etc      mnt      proc     root     sys      usr      www
dev      lib      overlay  rom      sbin     tmp      var
root@openwrt:/# cd dev
root@openwrt:/dev# ls
bus                 mtd5                ttyS0
console             mtd5ro              ttyS1
cpu_dma_latency     mtd6                ttyS10
full                mtd6ro              ttyS11
gpiochip0           mtdblock0           ttyS12
gpiochip1           mtdblock1           ttyS13
gpiochip2           mtdblock2           ttyS14
hwrng               mtdblock3           ttyS15
kmsg                mtdblock4           ttyS2
log                 mtdblock5           ttyS3
memory_bandwidth    mtdblock6           ttyS4
mtd0                network_latency     ttyS5
mtd0ro              network_throughput  ttyS6
mtd1                null                ttyS7
mtd1ro              port                ttyS8
mtd2                ppp                 ttyS9
mtd2ro              ptmx                urandom
mtd3                pts                 watchdog
mtd3ro              random              watchdog0
mtd4                shm                 zero
mtd4ro              tty
root@openwrt:/dev# grep -e rootfs_data /proc/mtd
mtd6: 01c00000 00010000 "rootfs_data"

/mnt is empty...
My SD Card is 16Gb so it should be a big numer in Mb...

Typically one needs the file system kernel module (such as kmod-fs-ext4) and block-mount. If mounting a USB-connected device, then the appropriate USB drivers are needed, such as kmod-usb-storage and perhaps a couple others (kmod-usb-storage-uas for higher speed connectivity with USB 3, for example).

the kmod-fs-ext4, block-mount, kmod-usb-storage & kmod-usb-storage-uas are already installed. I installed kmod-usb-storage-uas just to check as i didn't think that a 2015 device has a USB3 SD-Card controller and nothing changed.

I then connected a USB thumb drive to the USB-Host-Port and for that i get immediately a serial line:

[10091.983803] usb 1-1: new high-speed USB device number 2 using ehci-platform
[10092.199439] usb-storage 1-1:1.0: USB Mass Storage device detected
[10092.234647] scsi host0: usb-storage 1-1:1.0
[10093.315114] scsi 0:0:0:0: Direct-Access     Kingston DataTraveler 3.0 PMAP PQ: 0 ANSI: 6
[10093.335330] sd 0:0:0:0: [sda] 60555264 512-byte logical blocks: (31.0 GB/28.9 GiB)
[10093.351169] sd 0:0:0:0: [sda] Write Protect is off
[10093.360734] sd 0:0:0:0: [sda] Mode Sense: 45 00 00 00
[10093.371909] sd 0:0:0:0: [sda] Write cache: disabled, read cache: enabled, doesn't support DPO or FUA
[10093.476327]  sda: sda1
[10093.495920] sd 0:0:0:0: [sda] Attached SCSI removable disk

When I attach or remove the SD Card nothing happens so I think there is some other problem here.
I just had a look in to the schematics. There is no controller between the Processor and the SD card slot so i have no idea where to start debug...

Any idea where to start search for the problem?

So the SD card reader is direct-attached, not through USB might provide some hints, including mmc_spi module discussed there under "How to implement the Hotplug of SD-card" (I haven't worked through this as the SD-card readers I have dealt with are USB-attached.)

Is it possible its not working because mraa is not installed?
This shows a Pinout list with ethernet ports so im not so sure why...
I can not install it because cmake is not available. And i think my left over disk space is not enough as well.

You should always build on the build system, not on the device itself.

cmake should be available within the build system for packages.

Installing a package into ROM typically consumes about half the flash space it would if you installed it afterwards.

The pinouts for Ethernet are there likely because that is how one would connect an Ethernet phy (or perhaps socket) to the board.

I got the device to recognize the SD card by building manual on a Linux system.
It now works with no need of additional installations of other packages. All through added some packages in the make configmenu and I don't exactly know which one is responsible for this nice behavour because there are many possibilities.
It seams that the official config does not have any spi packages installed that may break te usage of the SPI based SD cardreader, but the mmc packages are maybe related as well...

Can somebody determine the packages that are not responsible for SD Card recognicion and I/O, so i can make only one or two new builds to determine the exact package.

I think it would make sense to insert the related package in the official build as soon as I find it.

This is the my conifg.seed
This is the official config.seed

maybe its one of those:


found it:
works, as well as CONFIG_PACKAGE_kmod-sdhci-mt7620=y

I think it would be great to add the first kmod-mmc to the default installation as the board has a SD-Cardreader on board.

I don't understand how email-lists work. I live in 2019.
How can i ask the developers to add this Kernel Package by default to the


? :laughing:

For better or for worse, changing a kernel for one board on a target changes it for all. That would all the "weight" of the kernel module to all firmware, painful for devices with limited flash space for the kernel.

A package is probably "too late" if you want it to mount root as the module you need to load to mount root is on root.

You could use an initramfs for initial boot to load the module, or add it to your local build config. I believe target/linux/ramips/mt76x8/config-4.14 would be the proper place for a local build.[]=openwrt-devel

can i make a local build config reproducable?

I found this in the manual but it does not describe how to write the script... (it confuses me.)

I have seen that config.seed is a list of some information and packets i chosen in make menuconfig can i somehow create a list of build dependencies and copy that in to my buildpath before starting the compilation with make?

Yes, save your own config and it will be reproducible for a given set of sources (within reason, as it is a different compilation at a different time).

See below for how to configure your own local build -- copying config.seed directly is not a good way
as it is intended for buildbot use, not single-device builds.

Thanks i read that and somehow found out how to use ./scripts/env new linkit-smart-7688 and I configured it and checked the ./scripts/env diff that showed >7000 new lines. But i do not see any changes in the folder: / < buildroot > /env/files/.
I expected to find a bunch of files that configures my build and that i can copy to another build in the future...
Where are those configurations saved?

.config in the root of the build tree. I believe that script symlinks it to ./env/.config

./files/ is for files that get built into the ROM -- for example, ./files/etc/config/wireless would be installed in your ROM to /etc/config/wireless

there is no .config in the root of my build. Look here:

this is the config.seed

There almost certainly is. Likely a setting of your GUI to hide files. ls -A should list it.