OpenWrt Forum Archive

Topic: Yet another MMC/SD + block-extroot on WRT54GL 1.1 HOWTO

The content of this topic has been archived on 30 Apr 2018. There are no obvious gaps in this topic, but there may still be some posts missing at the end.

Hi,

Since the last few days I tried to get block-extroot and MMC/SD storage working together on my WRT54GL1.1.
Yesterday I managed to get it working and I thought "Man, it was really a big PITA".

So I'm posting this to help other people stucked into this nightmare of bugs and mystical howtos... (hey that's all the fun about openwrt wink )
By assembling bits from posts in the forum , howtos from the wiki and experimenting I finally got it to work.
Prereq. :

         - A Linksys WRT54GL (mine was 1.1 but I am sure that others do fine) with the MMC/SD mod.     
         - A configured openwrt brcm-2.4 buildroot
         - A SD card with one partition formatted with ext2 (you can do this directly on the router if you installed the necessary tools like fdisk and e2fsprogs. I did this on my desktop)
         - A brain and at least one hand to type

I won't go explaining how to solder your storage to the motherboard as there are lots of (crystal clear) documentation on the web.
I won't explain the configuration of the buildroot , the provided doc is good and clear enough and if you have no experience in [s]compiling[/s] configuring something like a kernel you shouldn't be reading this.

One more thing, I tried to get this with the 2.6 build but mmc_over_gpio just crashed and reboot my router each time I wrote more than 16k on my sd card so it is 2.4 only. (sorry bleeding edge guys).
                                               
                                             =========================================

[size=15]1 - Buildroot stuff[/size]
Okay so you have your brcm-2.4 tree ready and up-to-date with your usual working config, after a nice "make menuconfig" check these as compiled in (not modules) :
                                     - Base system > block-extroot (block-mount should add itself auto) > Set settle time to 60s
                                     - Base system > block-hotplug ( hotplug2 should add itself auto )
                                     - Filesystems > kmod-fs-ext2 & kmod-nls-base
                                     - Kernel modules > Other modules > kmod-broadcom-sdhc

I choosed ext2 (hence no journalling) to protect my sdcard from constant writings but  you can choose any filesystem you want if you include the related modules in your config. Wear levelling is prone to lots of discussion and you should make your own idea on the question. By the way if you want journalling, you could save your card a bit by setting more time between journal updates on the sdcard with the commit=100 option... the system will write the journal every 100 seconds instead of every 5 seconds.

Next make a "files" directory at the root of your tree and put these files inside :

files/etc/config/fstab

config global automount                                                                                      
        option from_fstab 1                                                                                  
        option anon_mount 1                                                                                  
                                                                                                             
config mount                                                                                                 
        option target   /overlay                                                                             
        option device   /dev/sdcard/part1
        option fstype   ext2           
        option options  rw,noatime
        option enabled  1    
        option enabled_fsck 0
        option is_rootfs 1

Here we're declaring the sdcard partition to be mounted on /overlay at boot, fs is ext2 the noatime is for avoiding frequent writes on the sdcard, we're enabling the mount, disabling fs checking, and finally declaring it as an available root fs.
I didn't add the sync option because it's slowing things down writing everything on the sdcard immediately but be careful : if you power off the router without syncing your data first it will be lost in damnation forever.

files/etc/sdcard.conf

partition=1
         #mountpoint=/sdcard
         cs=7
         clk=3
         din=2
         dout=4
         major=0
         maxsec=32
         rahead=2
         dbg=0

Be careful to put your correct gpio pins number here. Notice the commented line, it's to avoid automounting on the sdcard dir at boot time.

files/etc/modules.d/33-sdhc

# May be required for rootfs
sdhc din=2 dout=4 clk=3 cs=7 mode=0

Be careful to put your correct gpio pins number here. Keep the comment line, init script will check this.

files/etc/init.d/fstab

#!/bin/sh /etc/rc.common
# Copyright (C) 2007 OpenWrt.org
# Copyright (C) 2010 Vertical Communications
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#


START=20

do_mount() {
        local cfg="$1"
        config_mount_by_section "$cfg"
}

do_swapon() {
        local cfg="$1"
        config_swapon_by_section "$cfg"
}

do_unmount() {
        local cfg="$1"

        config_get target "$cfg" target
        config_get_bool enabled "$cfg" "enabled" '1'
        [ -n "$target" -a "$enabled" -gt 0 ] || return 0
        umount $target
}

do_swapoff() {
        local cfg="$1"

        config_get device "$cfg" device
        config_get_bool enabled "$cfg" "enabled" '1'
        [ -n "$device" -a  "$enabled" -gt 0 ] && type swapoff >/dev/null || return 0
        swapoff $device
}

start() {
        . /lib/functions/mount.sh

        config_load fstab
        mkdir -p /var/lock
        lock /var/lock/fstab.lck
#       echo '# WARNING: this is an auto generated file, please use uci to set defined filesystems' > /etc/fstab
        lock -u /var/lock/fstab.lck
        config_foreach do_mount mount
        config_foreach do_swapon swap
}

stop() {
        . /lib/functions/mount.sh

        config_load fstab
        config_foreach do_unmount mount
        config_foreach do_swapoff swap
        swapoff -a
}

Here I just commented the line beginning with "echo '# WARNING: this is a..." to prevent a bug from happening when creating the symlink to /tmp/fstab.( Well I guess as I didn't check this with the line, blindly following one of the howto ).

files/lib/functions/extmount.sh

#!/bin/sh
# Copyright 2010 Vertical Communications

# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.

determine_root_device() {
        root_device="$(mount | grep ' / ' | cut -f1 -d\  | grep -v rootfs )"
}

set_jffs_mp() {
        jffs="$(awk '/jffs2/ {print $2}' /proc/mounts)"
}

er_load_modules() {
        mkdir -p /tmp/extroot_modules/modules.d
        mkdir -p /tmp/extroot_modules/modules
        ln -sf /etc/modules.d/* /tmp/overlay/etc/modules.d/* /tmp/extroot_modules/modules.d
        ln -sf /lib/modules/*/* /tmp/overlay/lib/modules/*/* /tmp/extroot_modules/modules
        local modules="$(grep -l '# May be required for rootfs' /tmp/extroot_modules/modules.d/*)"
        cd /tmp/extroot_modules/modules && {
                cat $modules | sed -e 's/^\([^#].*\)/insmod \.\/\1.o/'| sh 2>&- || :
        }
        rm -rf /tmp/extroot_modules
}

I modified one character in this script because it was only checking for 2.6 modules (*.ko) so I've made it checking for 2.4 modules (*.o) . It's at the third line beginning from the end ( cat $modules | ... ). Maybe this is a bug ...

files/lib/preinit/00_extroot.conf

extroot_settle_time="60"

Same as in .config, not sure if it's useful (or too much) but things are working for me like this.
This is telling the kernel to wait for a fs eligible for rootfs to mount.

files/lib/preinit/39_init_sd_card

#!/bin/sh
#
# Preinit script for sdhc card mod. Based on
# Init script for sdhc card mod - mmc, sd, sdhc support
# Script Version: 1.0
# OpenWRT Version: BACKFIRE 2.4 kernel 


# Save state of led's in /proc/diag/led/ as shell variables.
save_led_state() {
    for file in /proc/diag/led/*; do
    local var=`basename ${file}`
    local val=`cat ${file}`
    eval "${var}=${val}"
    done
}

# Restore saved led state. Default unknown led's to state "0".
restore_led_state() {
    for file in /proc/diag/led/*; do
    local var=`basename ${file}`
    eval "echo \"\${$var:-0}\" > ${file}"
    done
}

# Initialize the SD Card
init_sd_card()
{
    SD_MODNAME="sdhc"
    SD_MODARG=""
    SD_CONFIG="/etc/sdcard.conf"

    # If no config file is found then no need to go any further
    if [ ! -r ${SD_CONFIG} ]; then
        echo "sdcard - config not found: skipping"
        return
    fi
    echo "sdcard - found config at ${SD_CONFIG}"
    . ${SD_CONFIG}

    # We can compute the GPIO pin values supplied in the config file
    let mask="(1<<$cs)|(1<<$clk)|(1<<$din)|(1<<$dout)"

    # Error if gpio values not set.
    if [ "$mask" -eq "1" ]; then
        echo "sdcard - Gpio pins not set: skipping"
        return
    fi
    echo "sdcard - using cs=$cs clk=$clk din=$din dout=$dout"
    echo "sdcard - computed mask $mask"

    # If the dbg value is > 0, arrange to load the debug enabled module instead.
    [ ${dbg:-0} -eq 0 ] || SD_MODNAME="${SD_MODNAME}d"

    # Do nothing if the module is already loaded!
    if [ -d "/proc/sdcard" ]; then
        echo "sdcard - Already started..."
        return
    fi

    echo "sdcard - setting gpiomask"
    # Set the diag module gpio mask to disable it from using our GPIO pins
    # It buggers up the led state, so we save, then restore it afterwards
    save_led_state
    echo "$mask" > /proc/diag/gpiomask
    restore_led_state

    # Build module arguments from values in config file.
    # Don't provide the dbg module argument if set to 0
    for arg in clk din dout cs major maxsec rahead dbg gpio_input gpio_output gpio_enable gpio_control; do
        [ ${arg} == "dbg" ] && [ ${dbg:-0} -eq 0 ] && continue
        eval "z=\${${arg}:-z}"
        if [ "$z" != "z" ]; then
        SD_MODARG="${SD_MODARG} ${arg}=${z}"
        fi
    done
    echo "sdcard - inserting module $SD_MODNAME $SD_MODARG"
    # Insert the kernel module passing appropriate arguments
    insmod $SD_MODNAME $SD_MODARG
    if [ "$?" -gt "0" ] ; then
        echo "sdcard - Card not present or failed to initialize"
        echo "0x0000" > /proc/diag/gpiomask
        restore_led_state
        return;
    fi
    echo "sdcard - Card detected and initialized"
    

}

boot_hook_add preinit_mount_root init_sd_card

Props to  Mr_Smoke for the script from this post : http://forum.openwrt.org/viewtopic.php? … 65#p108765
It enables the sdcard and diag leds in a correct state to get it recognized before pivot_root does its magic.

[size=15]2 - Get it all together[/size]
Now you're ready to compile assuming you got your stuff configured too into .config.
Type

make -j<your number of cpu +1> V=99

and go make some coffee.
Returning with your cup, things should be done and you'll find a nice "openwrt-brcm-2.4-squashfs.trx" in the bin/brcm-2.4 directory. Flash it to the router, I prefer this method :

user@host # scp openwrt-brcm-2.4-squashfs.trx root@xxx.xxx.xxx.xxx:/tmp
user@host # slogin root@xxx.xxx.xxx.xxx
root@Openwrt # mtd -r /tmp/openwrt-brcm-2.4-squashfs.trx linux

The box should reboot itself, wait for it, telnet it to assign a passwd, disconnect and reconnect with ssh.
On the first boot you will see a /dev/mtdblock/# mounted on /rom/overlay and the sdcard on /overlay.
Reboot the router.
Slogin it and check your mounts , if everything worked all right you should see :

root@OpenWrt # mount
rootfs on / type rootfs (rw)
/dev/root on /rom type squashfs (ro)
none on /dev type devfs (rw)
none on /proc type proc (rw)
tmpfs on /tmp type tmpfs (rw,nosuid,nodev)
devpts on /dev/pts type devpts (rw)
/dev/sdcard/part1 on /overlay type ext2 (rw,noatime)
mini_fo:/overlay on / type mini_fo (rw)

root@OpenWrt # df -h
Filesystem                Size      Used Available Use% Mounted on
/dev/root                 1.3M      1.3M         0 100% /rom
tmpfs                     7.0M   1016.0K      6.0M  14% /tmp
/dev/sdcard/part1         3.6G      8.4M      3.4G   0% /overlay
mini_fo:/overlay          1.3M      1.3M         0 100% /

et voilà , sdcard is mounted as an overlay on the root filesystem. No double mounts sh*t, persistent and working with SDHC.
This was done with  Backfire (10.03, r23346) buildroot.

You will maybe find some things too much redundant or useless, I have not experimented every possible combination so there may be some things you can remove/enhance. I'm open to any suggestions. And if you find my english bad I'm sorry but it's not my primary language.

Thanks to all the people I read to make this working

[size=15]Sources :[/size]
http://wiki.openwrt.org/doc/howto/extroot
http://forum.openwrt.org/viewtopic.php?pid=107264
http://dev.openwrt.org/ticket/7768
http://wiki.openwrt.org/inbox/howto/con … ge-overlay
http://wiki.openwrt.org/doc/howto/buildroot

(Last edited by ektat on 15 Oct 2010, 00:08)

Hi
I tried your howto, like several else tutorials, but no one succeeds...
I added all the files in your howto, and changed also the "chmod" flaggs.

I've an wrt54g v2 with a different gpio config (cs=7 clk=4 din=5 dout=3).
but my router hangs during boot, if the sdcard is plugged.

First Question :
  Maybe it is caused by the dmz led, which blinks during boot?
  I think that the GPIO 7 let the DMZ led blink, so an access to the sdcard during boot should be difficult.

Second Question:
  do i have to copy the whole rom to the sdcard, or does that work like the overlay?

debugging is a bit difficult since i have no serial port,
maybe someone could make me a working rom with my gpio config?

I hope i will get this working someday big_smile

Hi DaDevil,

I don't understand what you say about "chmod" flags...
But if your router is freezing during bootup, I may suggest you to check your soldering if it's not already done.

For your first question , the blinking dmz led is for recovery mode (when you press the SES button during boot to get a minimal shell at router). I'm not sure about the G v2 but in the GL 1.1 it's the SES button led which is blinking on SDcard I/O. Once again , are you sure about your soldering points ?

For the second, you just have to copy the whole jffs, and it's only if you want to recover the files which was on the old partition.

Good luck

hi all

since almost 3 month, to root on my external disk, i am having problem while trying to build image for my linksys WRT350N V2  ARH=orion
I have tried every tutorial but i am still getting error...
When i tried a " Make V=99 " to see what was wrong, below is the result i got.... (the text in red at the end of the code color is the beginning of the error)

sergy@Sergy:~/wrt350N$ make V=99 ARCH="orion"
make[1]: Entering directory `/home/sergy/wrt350N'
make[2]: Entering directory `/home/sergy/wrt350N'
++ mkdir -p /home/sergy/wrt350N/staging_dir/target-orion_v5t_uClibc-0.9.30.1_eabi
++ cd /home/sergy/wrt350N/staging_dir/target-orion_v5t_uClibc-0.9.30.1_eabi
++ mkdir -p bin lib include stamp
mkdir -p /home/sergy/wrt350N/build_dir/target-orion_v5t_uClibc-0.9.30.1_eabi/stamp
touch /home/sergy/wrt350N/staging_dir/target-orion_v5t_uClibc-0.9.30.1_eabi/.prepared
make[3]: Entering directory `/home/sergy/wrt350N/toolchain/binutils'
make[3]: Nothing to be done for `prepare'.
make[3]: Leaving directory `/home/sergy/wrt350N/toolchain/binutils'
make[3]: Entering directory `/home/sergy/wrt350N/toolchain/binutils'
make -C /home/sergy/wrt350N/build_dir/toolchain-orion_v5t_gcc-4.3.3+cs_uClibc-0.9.30.1_eabi/binutils-2.19.1 all
make[4]: Entering directory `/home/sergy/wrt350N/build_dir/toolchain-orion_v5t_gcc-4.3.3+cs_uClibc-0.9.30.1_eabi/binutils-2.19.1'
make[5]: Entering directory `/home/sergy/wrt350N/build_dir/toolchain-orion_v5t_gcc-4.3.3+cs_uClibc-0.9.30.1_eabi/binutils-2.19.1'
Configuring in ./bfd
configure: loading cache ./config.cache
checking build system type... x86_64-pc-linux-gnu
checking host system type... x86_64-pc-linux-gnu
checking target system type... orion-openwrt-linux-uclibcgnueabi
checking for x86_64-linux-gnu-gcc... x86_64-linux-gnu-gcc
checking for C compiler default output file name... a.out
checking whether the C compiler works... yes
checking whether we are cross compiling... no
checking for suffix of executables...
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether x86_64-linux-gnu-gcc accepts -g... yes
checking for x86_64-linux-gnu-gcc option to accept ANSI C... none needed
checking for library containing strerror... none required
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking for style of include used by make... GNU
checking dependency style of x86_64-linux-gnu-gcc... gcc3
checking for x86_64-linux-gnu-ar... ar
checking for x86_64-linux-gnu-ranlib... ranlib
checking for x86_64-linux-gnu-gcc... (cached) x86_64-linux-gnu-gcc
checking whether we are using the GNU C compiler... (cached) yes
checking whether x86_64-linux-gnu-gcc accepts -g... (cached) yes
checking for x86_64-linux-gnu-gcc option to accept ANSI C... (cached) none needed
checking how to run the C preprocessor... x86_64-linux-gnu-gcc -E
checking for egrep... grep -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking minix/config.h usability... no
checking minix/config.h presence... no
checking for minix/config.h... no
checking whether it is safe to define __EXTENSIONS__... yes
checking for a sed that does not truncate output... /home/sergy/wrt350N/staging_dir/host/bin/sed
checking for fgrep... grep -F
checking for ld used by x86_64-linux-gnu-gcc... ld
checking if the linker (ld) is GNU ld... yes
checking for BSD- or MS-compatible name lister (nm)... nm
checking the name lister (nm) interface... BSD nm
checking whether ln -s works... yes
checking the maximum length of command line arguments... 3458764513820540925
checking whether the shell understands some XSI constructs... yes
checking whether the shell understands "+="... yes
checking for ld option to reload object files... -r
checking how to recognize dependent libraries... pass_all
checking for x86_64-linux-gnu-ar... (cached) ar
checking for x86_64-linux-gnu-strip... no
checking for strip... strip
checking for x86_64-linux-gnu-ranlib... (cached) ranlib
checking command to parse nm output from x86_64-linux-gnu-gcc object... ok
checking for dlfcn.h... yes
checking for objdir... .libs
checking if x86_64-linux-gnu-gcc supports -fno-rtti -fno-exceptions... no
checking for x86_64-linux-gnu-gcc option to produce PIC... -fPIC -DPIC
checking if x86_64-linux-gnu-gcc PIC flag -fPIC -DPIC works... yes
checking if x86_64-linux-gnu-gcc static flag -static works... yes
checking if x86_64-linux-gnu-gcc supports -c -o file.o... yes
checking if x86_64-linux-gnu-gcc supports -c -o file.o... (cached) yes
checking whether the x86_64-linux-gnu-gcc linker (ld -m elf_x86_64) supports shared libraries... yes
checking dynamic linker characteristics... GNU/Linux ld.so
checking how to hardcode library paths into programs... immediate
checking whether stripping libraries is possible... yes
checking if libtool supports shared libraries... yes
checking whether to build shared libraries... no
checking whether to build static libraries... yes
Setting warning flags = -W -Wall -Wstrict-prototypes -Wmissing-prototypes
checking whether to enable maintainer-specific portions of Makefiles... no
checking whether to install libbfd... no
checking whether NLS is requested... no
checking whether NLS is requested... no
checking for msgfmt... /usr/bin/msgfmt
checking for gmsgfmt... /usr/bin/msgfmt
checking for xgettext... /usr/bin/xgettext
checking for msgmerge... /usr/bin/msgmerge
checking for a BSD-compatible install... /usr/bin/install -c
checking for long long... yes
checking size of long long... 8
checking for void *... yes
checking size of void *... 8
checking for long... yes
checking size of long... 8
checking alloca.h usability... yes
checking alloca.h presence... yes
checking for alloca.h... yes
checking stddef.h usability... yes
checking stddef.h presence... yes
checking for stddef.h... yes
checking for string.h... (cached) yes
checking for strings.h... (cached) yes
checking for stdlib.h... (cached) yes
checking time.h usability... yes
checking time.h presence... yes
checking for time.h... yes
checking for unistd.h... (cached) yes
checking fcntl.h usability... yes
checking fcntl.h presence... yes
checking for fcntl.h... yes
checking sys/file.h usability... yes
checking sys/file.h presence... yes
checking for sys/file.h... yes
checking sys/time.h usability... yes
checking sys/time.h presence... yes
checking for sys/time.h... yes
looking for a compliant stdint.h in stdint.h, checking for uintmax_t... yes
checking for uintptr_t... yes
checking for int_least32_t... yes
checking for int_fast32_t... yes
checking for uint64_t... yes
checking what to include in bfd_stdint.h... stdint.h (already complete)
checking whether time.h and sys/time.h may both be included... yes
checking for dirent.h that defines DIR... yes
checking for library containing opendir... none required
checking whether string.h and strings.h may both be included... yes
checking for fcntl... yes
checking for getpagesize... yes
checking for setitimer... yes
checking for sysconf... yes
checking for fdopen... yes
checking for getuid... yes
checking for getgid... yes
checking for strtoull... yes
checking whether basename is declared... yes
checking whether ftello is declared... yes
checking whether ftello64 is declared... yes
checking whether fseeko is declared... yes
checking whether fseeko64 is declared... yes
checking whether ffs is declared... yes
checking whether free is declared... yes
checking whether getenv is declared... yes
checking whether malloc is declared... yes
checking whether realloc is declared... yes
checking whether stpcpy is declared... yes
checking whether strstr is declared... yes
checking whether snprintf is declared... yes
checking whether vsnprintf is declared... yes
checking for library containing zlibVersion... -lz
checking zlib.h usability... yes
checking zlib.h presence... yes
checking for zlib.h... yes

*** BFD does not support target orion-openwrt-linux-uclibcgnueabi.
*** Look in bfd/config.bfd for supported targets.
make[5]: *** [configure-bfd] Error 1
make[5]: Leaving directory `/home/sergy/wrt350N/build_dir/toolchain-orion_v5t_gcc-4.3.3+cs_uClibc-0.9.30.1_eabi/binutils-2.19.1'
make[4]: *** [all] Error 2
make[4]: Leaving directory `/home/sergy/wrt350N/build_dir/toolchain-orion_v5t_gcc-4.3.3+cs_uClibc-0.9.30.1_eabi/binutils-2.19.1'
make[3]: *** [/home/sergy/wrt350N/build_dir/toolchain-orion_v5t_gcc-4.3.3+cs_uClibc-0.9.30.1_eabi/binutils-2.19.1/.built] Error 2
make[3]: Leaving directory `/home/sergy/wrt350N/toolchain/binutils'
make[2]: *** [toolchain/binutils/compile] Error 2
make[2]: Leaving directory `/home/sergy/wrt350N'
make[1]: *** [/home/sergy/wrt350N/staging_dir/toolchain-orion_v5t_gcc-4.3.3+cs_uClibc-0.9.30.1_eabi/stamp/.toolchain_install] Error 2
make[1]: Leaving directory `/home/sergy/wrt350N'
make: *** [world] Erreur 2

Just tried your little howto : it works just fine on Backfire (10.03, r24233) !
Thanks a lot for this compilation, it saved me a lot of time I guess smile

I just wished this sdhc driver was ported to kernel 2.6 ... 'cuz the generic mmc driver is just way too slow !

Thank you ektat, works perfectly for me on WRT54GL v1.1 !

(Last edited by jce on 1 Jan 2011, 21:07)

EXCELENT write up.  clear and concise.

you should add this to the wiki because most of what is there on mmc and sdcard and sdhc drivers is woefully out dated.

Hi, i'm new in OpenWrt and linux compilation.

Can someone publish this image ? I use Linksys 54GL v1.1 with working (1G) sdhc but I want to install OpenVpn.

Thank you.

You can always build it by yourself. It's easy!

Finally I make it but I got some problems:

1. I don't get the same results (I post results).
2. I lost the http service, so I can't change the PPPoE connection parameters. How Can this be done manually ? How I add the http service ?

Thank's for any help.

BusyBox v1.15.3 (2011-01-19 13:00:16 COT) built-in shell (ash)
Enter 'help' for a list of built-in commands.

  _______                     ________        __
 |       |.-----.-----.-----.|  |  |  |.----.|  |_
 |   -   ||  _  |  -__|     ||  |  |  ||   _||   _|
 |_______||   __|_____|__|__||________||__|  |____|
          |__| W I R E L E S S   F R E E D O M
 Backfire (10.03, r25045) --------------------------
  * 1/3 shot Kahlua    In a shot glass, layer Kahlua
  * 1/3 shot Bailey's  on the bottom, then Bailey's,
  * 1/3 shot Vodka     then Vodka.
 ---------------------------------------------------
root@OpenWrt:/# mount
rootfs on / type rootfs (rw)
/dev/root on /rom type squashfs (ro)
none on /dev type devfs (rw)
none on /proc type proc (rw)
tmpfs on /tmp type tmpfs (rw,nosuid,nodev)
devpts on /dev/pts type devpts (rw)
/dev/mtdblock/4 on /tmp/overlay type jffs2 (rw)
/dev/sdcard/part1 on /overlay type ext2 (rw,noatime)
mini_fo:/overlay on / type mini_fo (rw)
root@OpenWrt:/# df -h
Filesystem                Size      Used Available Use% Mounted on
/dev/root                 1.6M      1.6M         0 100% /rom
tmpfs                     7.0M     40.0K      7.0M   1% /tmp
/dev/mtdblock/4           1.6M    324.0K      1.2M  20% /tmp/overlay
/dev/sdcard/part1       956.7M      1.2M    906.9M   0% /overlay
mini_fo:/overlay          1.6M      1.6M         0 100% /

edit...

I finally resolve the network parametes copying the file '/etc/config/network' with a '/etc/init.d/network restart'. But if I make a 'restart' I lost '/etc/config/network' changes and need to edit every time. Does somebody knows how to make it keep changes between 'reboot's'?

With the httpd problem I figure that I must include 'uhttpd' service with some other Lilo packages, but for some reason the compiled image dont get this package. I resolved this installing the package with 'opkg'. I then start the service with '/etc/init.d/uhttpd start' and i get...

root@OpenWrt:/etc/init.d# ./uhttpd start
WARNING: the specified certificate and key files do not exist and the px5g generator is not available, skipping SSL setup.

How resolve this ?

Well that it not all...

When trying to access 'http://192.168.1.1' the web page says:

/usr/lib/lua/luci/dispatcher.lua:247: No valid theme found
stack traceback:
    [C]: in function 'assert'
    /usr/lib/lua/luci/dispatcher.lua:247: in function 'dispatch'
    /usr/lib/lua/luci/dispatcher.lua:146: in function </usr/lib/lua/luci/dispatcher.lua:145>

how can resolve this ?


Thanks!!!

(Last edited by davigre on 22 Jan 2011, 00:13)

I too lose my access to LuCI upon moving into the sdcard /overlay.

I also get some seemingly path-related errors from opkg whenever i try to add or remove a package.

Collected errors:
 * pkg_get_installed_files: Failed to open //usr/lib/opkg/info/libpthread.list: No such file or directory.
 * pkg_get_installed_files: Failed to open //usr/lib/opkg/info/libblkid.list: No such file or directory.
 * pkg_get_installed_files: Failed to open //usr/lib/opkg/info/libuuid.list: No such file or directory.
 * pkg_get_installed_files: Failed to open //usr/lib/opkg/info/librt.list: No such file or directory.
 * pkg_get_installed_files: Failed to open //usr/lib/opkg/info/libncurses.list: No such file or directory.
 * pkg_get_installed_files: Failed to open //usr/lib/opkg/info/e2fsprogs.list: No such file or directory.
 * pkg_get_installed_files: Failed to open //usr/lib/opkg/info/zlib.list: No such file or directory.
 * pkg_get_installed_files: Failed to open //usr/lib/opkg/info/fdisk.list: No such file or directory.
 * pkg_get_installed_files: Failed to open //usr/lib/opkg/info/libext2fs.list: No such file or directory.
 * pkg_get_installed_files: Failed to open //usr/lib/opkg/info/libpopt.list: No such file or directory.
 * pkg_get_installed_files: Failed to open //usr/lib/opkg/info/libopenssl.list: No such file or directory.

Thank you!
I don't know how could I've done without your howto. I tried to boot from SD with kernel 2.6 but mmc_over_gpio gave me a lot of incomprehensible errors (to me! ;P)
I have just another wish. I want to add to the fstab config the option to automount a swap partition from the same sdcard. I formatted it with "mkswap /dev/sdcard/part2" and works with "swapon /dev/sdcard/part2" but not with fstab. Here my /etc/config/fstab

config global automount
        option from_fstab 1
        option anon_mount 1

config global autoswap
        option from_fstab 1
        option anon_swap 1

config mount
        option target   /overlay
        option device   /dev/sdcard/part1
        option fstype   ext2
        option options  rw,noatime
        option enabled  1
        option enabled_fsck 0
        option is_rootfs 1

config swap
        option device   /dev/sdcard/part2
        option enabled  1

Hi everyone

i have tried about 4 sucessful compilations but i cant put overlay to my SD card even using the same revision as ektat (r23346) i use another config for the gpio pins and  i changed it where is needed, but nothing works

i have a little question about the files that we need to be created, these files are the same that ones on the build? because, i passed that step and i see that files... i think this files created don`t afecct the image build.... can some one explain what i must do with these files?


sorry for my english it's a little rusty ^^

thanks in advance

Hello ektat,

first of all, many thanks for your Howto!
After adapting the GPIO config to my setup it worked perfectly, almost :-)
My problem now is the reset of the configuration where i get stucked.
When resetting, the jffs partition gets cleared and mounted than in addition. My problem is identifiying how this works in OpenWRT.

I guess it is the part in /lib/firstboot but I could not get really how it works.
I would like to change the code in order to check wether it has to reset at bootup and if yes formatting the sdcard and clear the reset flag and reboot.
To achive formatting I just added e2fsprog to the image, so this should be possible, but I need to complety remove the jffs parts when resetting but I'm affraid to mess up everything.

Maybe somebody could already help by giving some hints to my question below.
What is beeing checked to idendtify the system has to be reset? nvram variable ?

Thanks in advanced!
BR
albundy

to avoid a bad build and bricking the thing, could i ask about 1 point  I dont quite understand these 2 lines from section 1 of the initial post to do with building an image.


-1-" Next make a "files" directory at the root of your tree and put these files inside :"    I assume this mean in the root of the entire build setup?  ie /home/userdir/backfire/files.. from reading the docs i think these files will be incorporated in the build?

(Last edited by hca on 13 Jul 2011, 18:00)

Congrats on Ektat for this excellent tutorial..
i have been struggling for 2 days with no success, until this very moment...!

i really cant tell what went wrong or how i managed to successfully build my trx file, but ill provide some information in case anyone wants to sum this topic up...

-I used the imagebuilder of 10.03.1-rc6
-put all the files that ektat describes on his first post
-changed on files/etc/init.d/fstab START=20 to START=40 (so that sdhc gets to run before fstab)
-did not changed the +x flag on files/etc/init.d/fstab prior building, but did in on first reboot instead
-make with

make image PACKAGES="nano kmod-fs-ext3 kmod-fs-ext2 block-extroot block-mount block-hotplug hotplug2 kmod-broadcom-sdhc" FILES=files/

also, i had a copy of overlay on my sdcard as described on http://wiki.openwrt.org/doc/howto/extroot prior flashing

best of luck to everyone who reads this....

EDIT:
if you want luci, just add it to the PACKAGES list on the code above

(Last edited by espressionist on 29 Nov 2011, 22:37)

Help me please, i have been struggling for 1 week and still no solution. I have WRT54GS v1.0 with di=5,do=3,clc=4,cs=7 - gpiomask=0x00b8, tryed with  10.03.1 and 10.03.1-rc6 brcm-2.4 Image Builders. I have no serial interface witch pc. On first boot sdcard is not mount:
root@OpenWrt:/# df -h
Filesystem                Size      Used Available Use% Mounted on
/dev/root                 1.6M      1.6M         0 100% /rom
tmpfs                    14.9M     52.0K     14.9M   0% /tmp
root                      1.6M      1.6M         0 100% /tmp/root
mini_fo:/tmp/root         1.6M      1.6M         0 100% /tmp/root
/dev/mtdblock/4           5.5M    648.0K      4.9M  12% /overlay
mini_fo:/overlay          1.6M      1.6M         0 100% /
=============
root@OpenWrt:/# mount
rootfs on / type rootfs (rw)
/dev/root on /rom type squashfs (ro)
none on /dev type devfs (rw)
none on /proc type proc (rw)
tmpfs on /tmp type tmpfs (rw,nosuid,nodev)
devpts on /dev/pts type devpts (rw)
root on /tmp/root type tmpfs (rw)
mini_fo:/tmp/root on /tmp/root type mini_fo (rw)
/dev/mtdblock/4 on /overlay type jffs2 (rw)
mini_fo:/overlay on / type mini_fo (rw)
==================
part of dmesg:
p_conntrack version 2.1 (5953 buckets, 5953 max) - 352 bytes per conntrack
[ERR] sdhc: Request: protocol error - cmd=read rc=02                   (! If i chmod -x files/etc/init.d/fstab before imagebuilder- here is no error, insmod successfully but card still not mounting !)
end_request: I/O error, dev fe:01 (sdcard), sector 2
EXT2-fs: unable to read superblock
jffs2_scan_eraseblock(): End of filesystem marker found at 0x0
jffs2_build_filesystem(): unlocking the mtd device... done.
jffs2_build_filesystem(): erasing all blocks after the end marker... done.
mini_fo: using base directory: /
mini_fo: using storage directory: /overlay
=====
Even if i run manually /etc/init.d/sdcard start script (successfully, status work) and mount /dev/sdcard/part1 /mnt/ - return without error, but nothing happened - sdcard still not mounted.
On all next boots with inserted sdcard my device wrt54gs give no answer on ping and i can not slogin (power led blinking). Without card boots with mounted jffs2 sad((
Anybody know, how to solve this problem with extroot on wrt54gs??? Thanx for your answers

The discussion might have continued from here.