Differences between revisions 9 and 10
Revision 9 as of 2018-04-04 17:36:33
Size: 7618
Comment:
Revision 10 as of 2018-04-04 19:06:40
Size: 7699
Comment:
Deletions are marked like this. Additions are marked like this.
Line 90: Line 90:
Create init patch. This patch will replace method spawn_procd function with spawn_real_init. Create init patch. This patch will replace spawn_procd function with spawn_real_init. If debian root mounted, spawn_real_init function will execute debian init, else procd.
Line 123: Line 123:

#patch preinit.c
}}}
Patching!
{{{

/!\ Under construction

DebianOn is an effort to document how to install, configure and use Debian on some specific hardware. Therefore potential buyers would know if that hardware is supported and owners would know how get the best out of that hardware.

The purpose is not to duplicate the Debian Official Documentation, but to document how to install Debian on some specific hardware.

If you need help to get Debian running on your hardware, please have a look at our user support channels where you may find specific channels (mailing list, IRC channel) dedicated to certain types of hardware.

Translation(s): none

Models covered
Xiaomi ?MiWifi mini

  • ?MiWifi !Mini, ?MediaTek MT7620A (includes wifi b/n chip) MIPS SoC 580 MHz, RAM 128MB, Wi-Fi 802.11ac (?MediaTek MT7612), Flash 16MB, 100MiB Ethernet.

Overall Status

Core Components

[ATTACH]

Boot Standard Kernel:

{X} / OpenWRT

Ethernet interface ():

{OK}

Hard drives:

USB drives ok

Extra Features

Ethernet switch ()

{OK}

WLAN interface Wi-Fi 802.11ac (?MediaTek MT7612)

/!\

WLAN interface Wi-Fi 802.11b/g (?MediaTek MT7620A)

/!\

Serial console (you have to solder it)

{OK}

LEDs

{OK}

Legend :
{OK} = OK ; {X} Unsupported(No Driver) ; /!\ = Error (Couldn't get it working); [?] Unknown, Not Test ; [-] Not-applicable
{i} = Configuration Required; X-( = Only works with a non-free driver and or firmware

Important Note

This Debian installation is based on the OpenWRT kernel and it's modified init system. You may note this article, but it uses old version of ?OpenWrt(without procd). That's the reason you need to modify init program to spawn debian init instead of procd. Install OpenWRT on your router and make sure it works before attempting to install Debian. A working and configured OpenWRT system on the internal flash also works as a backup. If the USB drive containing the rootfs breaks, you will lose your Debian server, but at least the network routing still works with OpenWRT. Remember backups.

Installation

Build a custom OpenWRT image

Get ?OpenWrt code

mkdir ~/wrt
cd ~/wrt
git clone git://github.com/openwrt/openwrt.git
git checkout tags/v17.01.4

Configure ?OpenWrt build system

make menuconfig

Set options:

/Target System->?MediaTek Ralink MIPS

/Subtarget->MT7620 based boards

/Target Profile->Xiaomi ?MiWiFi Mini

/Base system->block-mount

Enable Floating point emulation:

make kernel_menuconfig

/Kernel type->MIPS FPU Emulator

Build ?OpenWrt system

make

Tweaking init

Now we need to patch init system, so that if debian root detected, we launch debian init.

cd openwrt/build_dir/target-mipsel_24kc_musl-1.1.16/procd-2017-08-08-66be6a23/initd

Create init patch. This patch will replace spawn_procd function with spawn_real_init. If debian root mounted, spawn_real_init function will execute debian init, else procd.

cat <<EOF >> init_patch
> 53c53
> < spawn_procd(struct uloop_process *proc, int ret)
> ---
> > spawn_real_init(struct uloop_process *proc, int ret)
> 54a55,56
> >     char *deb_init_args[] = { "/sbin/init", "3", NULL};
> >     char *procd_args[] = { "/sbin/procd", NULL};
> 56d57
> < preinitchar *argv[] = { "/sbin/procd", NULL};
> 57a59
> >     int is_extroot_mounted = !stat("/etc/debian_version", &s);
> 70d71
> < preinitDEBUG(2, "Exec to real procd now\n");
> 79c80,88
> < preinitexecvp(argv[0], argv);
> ---
> > preinitif (is_extroot_mounted) {
> >         DEBUG(2, "Exec to debian init now\n");
> >         watchdog_set_magicclose(true);
> >         watchdog_set_stopped(true);
> >         execvp(deb_init_args[0], deb_init_args);
> >     } else {
> >         DEBUG(2, "Exec to openwrt procd now\n");
> >         execvp(procd_args[0], procd_args);
> >     }
> 119c128
> < preinitpreinit_proc.cb = spawn_procd;
> ---
> > preinitpreinit_proc.cb = spawn_real_init;
> EOF

Patching!

patch preinit.c init_patch

Build

Build ?OpenWrt again, with modified init. make

Flash image

Use open wrt guide.

Create debian rootfs

mkdir ~/debian_root_fs
cd ~/debian_root_fs
debootstrap --arch mipsel stretch .

Configure debian rootfs

Prepare usb media

Use gparted, create ms-dos partition table on thumb drive, and create two partitions: ext4 partition for debian rootfs, and swap. Then copy created rootfs on flash drive.

mount /dev/sd*1 /mnt
cp -r ~/debian_root_fs/* /mnt

OpenWRT extroot configuration

Set up the external root FS in OpenWRT. The configuration file /etc/config/fstab should have this kind of section:

config mount
    option target '/'
    option fstype 'ext4'
    option options 'rw,sync'
    option enabled '1'
    option enabled_fsck '0'
    option device '/dev/sda1'

WiFi

System Summary

lspci

lspci -nn

lsusb

lsusb -v | grep -E '\<(Bus|iProduct|bDeviceClass|bDeviceProtocol)' 2>/dev/null

Resources

Attachments

Some configuration files and sample outputs.

Credits



CategoryDebianOn CategoryDebianOn