Installing Debian on Omega2+ board
I've managed to install Debian environment over OpenWRT, using chroot.
Omega2+ board can be used as a MIPS-based Linux workstation, for generic development tasks. To get access to a console port, you can use any USB-to-serial adapter.
From a user point of view, an OpenWRT environment is quite different from Linux. But it's possible to build a Debian-based environment, located on microSD card and used via chroot.
- No modification to OpenWRT system is required
- All additional files placed on SD card
- Full traditional Linux environment is provided
The following instructions assume you use Ubuntu on your host machine.
Step 1. Download a minimal root filesystem: http://ftp.vak.ru/pub/unix/debian-stretch-mini.tgz
Step 2. Prepare SD card. Create an empty Linux partition on SD card:
sudo umount /dev/mmcblk0p1 sudo sfdisk /dev/mmcblk0 << EOF /dev/mmcblk0p2 : size=512M, type=82 /dev/mmcblk0p1 : type=83, bootable EOF sudo mke2fs /dev/mmcblk0p1 sudo mkswap /dev/mmcblk0p2
Unpack the downloaded package into the SD card:
sudo mount /dev/mmcblk0p1 /mnt sudo tar xvzf debian-stretch-mini.tgz -C /mnt sudo umount /mnt
Unmount the SD card from the host computer and insert it into your Omega2+ board.
Step 3. Connect the console port. Use Expansion Dock or any USB-to-serial adapter like FT232, CP2102 or CH340. Connect signals GND, TXD and RXD of the adapter to pins GND, P9, and P8. Attach USB adapter to the host compoter and start
minicomor any other terminal application, and configure the connection at 115200 baud rate. Press "Reset" button - you should see the boot protocol, and finally a shell prompt.
Step 4. Configure a Wi-Fi or Ethernet network, as described in the manual (https://docs.onion.io/omega2-docs/first-time-setup-command-line.html#connect-to-the-omegas-command-line). Install a few filesystem utilities:
wifisetup [...] opkg update opkg install swap-utils block-mount e2fsprogs
Step 5. Start the Debian environment. We use chroot utility to point the root filesystem to the SD card. Actually, when Wi-Fi or Ethernet interface had started, you don't need USB console anymore, you can log in via ssh (don't forget to set a password on root first).
swapon /dev/mmcblk0p2 mount --bind /dev /tmp/run/mountd/mmcblk0p1/dev mount --bind /proc /tmp/run/mountd/mmcblk0p1/proc mount --bind /sys /tmp/run/mountd/mmcblk0p1/sys chroot /tmp/run/mountd/mmcblk0p1 /bin/bash
At this point you should get a shell prompt from Debian environment. It first run, it makes sense to install some useful packages:
apt-get update apt-get install locales bison byacc flex libelf-dev libfuse-dev \ build-essential make autoconf automake libtool gdb fuse man-db \ groff less ed bmake git byacc flex exuberant-ctags libfuse-dev \ bmake git byacc flex exuberant-ctags libfuse-dev dialog \ openssh-client subversion le vim gettext iputils-ping locate procps
Now you have a full scale Debian Linux. You can download, compile and run any Linux software.
To free the SD card before removing it, you need exit from the Debian shell and run::
umount /tmp/run/mountd/mmcblk0p1/dev umount /tmp/run/mountd/mmcblk0p1/proc umount /tmp/run/mountd/mmcblk0p1/sys umount /tmp/run/mountd/mmcblk0p1 swapoff /dev/mmcblk0p2
interesting project. congratulations !
@Douglas-Kryder Thank you! With Debian installed, Omega2 is no more limited in software resources. Essentially it becomes a rival to 'big brothers' like Raspberry Pi or Intel Edison.
needed the below to work on my USB drive:-
Oops, that's my fault: forgot to initialize swap partition. I'll update the intructions. Thank you, Chris.
This is quite an interesting project, thanks for posting.. How could we run a script or binary within the Debian shell automatically from boot?
Or a crontab? I have installed crontab but we are only running a shell here, so it misses out the init.d from a proper boot.
Do u have a tutorial video ? I'm newbie with omega
It is amazing. Thanks a lot :)
@Serge-V How I can use gpio from debian chroot?
Not a bad thing to know but a debian user you can't use kernel related packages and/or dependencies as you're not changing the kernel.
Will the device still retain wireless capabilities?? What are the cons to adding Debian as the root os? Can you create a system to do options like cmake? Will it draw more power??
@Brandt-Martin I see the wifi ability piece now
is there a good way to automate the process so debian boots up immediately?
I had a script that handled the mounting and the chrooting but the chrooting didnt take until after a login.
I had this run at rc.local
/bin/mount --bind /dev /tmp/run/mountd/mmcblk0p1/dev
/bin/mount --bind /proc /tmp/run/mountd/mmcblk0p1/proc
/bin/mount --bind /sys /tmp/run/mountd/mmcblk0p1/sys
/usr/sbin/chroot /tmp/run/mountd/mmcblk0p1 /bin/bash
Do you think this would work in an Omega 2+ which firmware was updated to LEDE 17.01.4?
Is there any reason u-boot couldn't be configured to pass root=/dev/mmcblk0p1 to the kernel and driectly boot a Debian system? Or maybe someone has already done such?