Kimax U35wf - vanaware/openwrt GitHub Wiki

#The goal is create a firmware to install LEDE to Blueendless Kimax U35WF device.

####References:

Step into source folder

cd ~/openwrt    
mkdir -p logs    

Step into git branch

git checkout lede-17.01.04-u35wf   

Update Files

git pull  
./scripts/feeds update -a    
./scripts/feeds install -a    

Change config file

#wget https://downloads.lede-project.org/releases/17.01.4/targets/ramips/mt7620/config.seed  -O .config   
cp lede-17.01.4-ramips-mt7620-u35wf.diffconfig .config        
make defconfig    
make oldconfig    
make menuconfig    

Compile it

# make dirclean # deletes contents of the directories /bin and /build_dir and additionally /staging_dir and /toolchain and /logs. 
make download  
rm logs/build.log     
FORCE_UNSAFE_CONFIGURE=1 ionice -c 3 nice -n 19 make -j 5 V=s 2>&1 | tee logs/build.log | grep -i -E "^make.*(error|[12345]...Entering dir)"    
ls ~/openwrt/bin/targets/ramips/mt7620 -la

Save config and results for later use f2fs filesystem

cp .config lede-17.01.4-ramips-mt7620-u35wf.config  
scripts/diffconfig.sh > lede-17.01.4-ramips-mt7620-u35wf.diffconfig    
mv bin/targets/ramips/mt7620/*.manifest lede-17.01.4-ramips-mt7620-u35wf.manifest    
cp ~/openwrt/bin/targets/ramips/mt7620/lede-17.01.4-ramips-mt7620-u35wf-squashfs-sysupgrade.bin lede-17.01.4-ramips-mt7620-u35wf-sysupgrade.bin  
cp ~/openwrt/bin/targets/ramips/mt7620/lede-17.01.4-ramips-mt7620-u35wf-squashfs-factory.bin lede-17.01.4-ramips-mt7620-u35wf-factory.bin   
cp ~/openwrt/bin/targets/ramips/mt7620/lede-17.01.4-ramips-mt7620-device-u35wf-rootfs.tar.gz lede-17.01.4-ramips-mt7620-u35wf-rootfs.tar.gz   

Transfer files to upgrade openwrt

Do a backup of you config and data before

sudo scp /var/lib/lxc/openwrt/rootfs/root/openwrt/bin/targets/ramips/mt7620/lede-17.01.4-ramips-mt7620-u35wf-squashfs-sysupgrade.bin [email protected]:/tmp/sysupgrade.bin
scp ~/openwrt/lede-17.01.4-ramips-mt7620-u35wf-sysupgrade.bin [email protected]:/tmp/sysupgrade.bin
ssh [email protected]
ls /tmp
sysupgrade -d 5 -v -n /tmp/sysupgrade.bin 

Prepare Disk

ssh [email protected]

fdisk /dev/sda <<EOF
o
n
p
1

+4096M
n
p
2

+128M
n
p
3


t
2
82
w
q
EOF

sudo mkfs.ext4 -L ext4 /dev/sda1
sudo mkswap -L swap /dev/sda2
sudo mkfs.btrfs -f -d dup -m dup -L btrfs /dev/sda3
sudo mkdir -p /mnt/data/
sudo mount -t btrfs /dev/sda3 /mnt/data/
sudo btrfs subvolume create /mnt/data/data
sudo umount /mnt/data

Enter into openwrt and force extroot with ext4 filesystem

mkdir /overlay-boot
uci set fstab.@global[0].delay_root='20'
uci set fstab.@global[0].anon_swap='0'
uci set fstab.@global[0].anon_mount='0'
uci set fstab.@global[0].auto_swap='0'
uci set fstab.@global[0].auto_mount='0'
uci set fstab.@global[0].check_fs='0'
# Make swap
uci get fstab.diskswap && uci delete fstab.diskswap
uci set fstab.diskswap=swap
uci set fstab.diskswap.device="/dev/sda2"
uci set fstab.diskswap.enabled='1'
# Make jffs2 boot acessible
uci get fstab.jffs2 && uci delete fstab.jffs2
uci set fstab.jffs2=mount
uci set fstab.jffs2.target='/overlay-boot'
uci set fstab.jffs2.fstype='jffs2'
uci set fstab.jffs2.device='/dev/mtdblock6'
uci set fstab.jffs2.options='rw,sync'
uci set fstab.jffs2.enabled='1'
# Make btrfs data
uci get fstab.data && uci delete fstab.data
uci set fstab.data=mount
uci set fstab.data.target='/mnt/data'
uci set fstab.data.fstype='btrfs'
uci set fstab.data.device="/dev/sda3"
uci set fstab.data.options='subvol=/data,noatime,nodiratime,noacl,space_cache,degraded,discard'
uci set fstab.data.enabled='1'
# Make ext4 rootfs
uci get fstab.ext4 && uci delete fstab.ext4
uci set fstab.ext4=mount
uci set fstab.ext4.target='/'
uci set fstab.ext4.fstype='ext4'
uci set fstab.ext4.device="/dev/sda1"
uci set fstab.ext4.options='rw,noatime,nodiratime,noacl,data=ordered,errors=continue,discard
uci set fstab.ext4.enabled='1'
uci commit fstab

mkdir -p /tmp/extroot/
mount -t ext4 /dev/sda1 /tmp/extroot
mkdir -p /tmp/introot
mount --bind / /tmp/introot
tar -C /tmp/introot -cvf - . | tar -C /tmp/extroot -xf -
umount /tmp/introot
umount /tmp/extroot

sync
reboot

Using rootfs.tar.gz

sudo mount -t f2fs /dev/sdh2 /mnt/usb
#sudo mount -t ext4 /dev/sdh3 /mnt/usb
sudo rm -fr /mnt/usb/*
sudo tar -xvf ~/openwrt/lede-17.01.4-ramips-mt7620-u35wf-rootfs.tar.gz -C /mnt/usb/    
sudo umount /mnt/usb