Categories
Awesome Hardware Linux

Orange Pi Zero running in QEMU

I needed a way to run an Orange Pi Zero SD-Card image of Armbian as a virtual machine. And this is actually possible with QEMU!

This is the command I used:

qemu-system-arm \
-M orangepi-pc -m 1024 -cpu cortex-a7 -dtb boot/dtb/sun8i-h3-orangepi-pc.dtb \
-kernel boot/vmlinuz-5.4.45-sunxi -initrd boot/initrd.img-5.4.45-sunxi \
-append 'earlyprintk loglevel=8 earlycon=uart8250,mmio32,0x1c28000,115200n8 console=ttyS0 root=/dev/mmcblk0p1' \
-nographic -serial stdio -monitor none \
-drive file=Armbian_20.05.3_Orangepizero_buster_current_5.4.45.img,format=raw,if=none,id=d1 \
-device sd-card,drive=d1 \
-nic user,model=allwinner-sun8i-emac,hostfwd=tcp::50022-:22

Original source: https://forum.armbian.com/topic/7547-run-armbian-into-qemu/?tab=comments#comment-86797

You need to get the contents of the /boot directory from the SD Card image so that you can start booting it. I just used scp to copy it from a running Orange Pi Zero to my main machine. The command above doesn’t actually run an Orange Pi Zero board, it runs an Orange Pi PC, though this is almost the same thing. At least the CPU is the same (note: Allwinner H2+ and H3 are binary compatible). But it has more memory!

Why run Armbian in QEMU?

I wanted to compile an application written in Rust. The problem was that installing it the official way through rustup (or more precisely rustup-init) resulted in an error:

info: installing component 'cargo'
info: Defaulting to 139.4 MiB unpack ram
thread 'main' panicked at 'RUSTUP_UNPACK_RAM must be larger than 220000000', src/dist/component/package.rs:200:13
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
thread 'main' panicked at 'No process instance', src/currentprocess.rs:126:17

The newer versions of rust required more memory than the Orange Pi Zero had! Mine had 256 MB (since I thought I’d take this as a challenge instead of going with the 512 MB version). Rustup needed at least 220 MB on its own.

Alternatively I could get some cross-compilation toolchain. But that seemed even harder; I couldn’t find anything usable.

Categories
Awesome Linux Open source PinePhone Projects

Mouse in a Pipe

Have you ever wanted to control your notebook directly from your desktop? How about controlling your phone? Wouldn’t it be better to type that chat message using a real keyboard? I wanted the same thing, so I wrote an app for that!

More precisely I created a tool that enables you to redirect mouse and keyboard events from one device to another. It’s like you reconnected your mouse and keyboard, but without the physical effort! All of this happens on a very low level (through the kernel) so this works seamlessly with any application you want to control. All you need is a Linux OS on both of the devices.

Repository: https://github.com/Dejvino/mouse-piped

One more interesting point is that the input events are pushed through a pipe, which is a generic way of transferring data among processes in Unix-based operating systems. It is up to you how you decide to transfer the data. Though most likely it will happen via SSH. You can easily generate input events on your main computer and then pipe them through SSH to your secondary computer (or a phone) and control it that way. Or you might decide to create a TCP connection and pass the data through that. That’s up to you!

And you know what else is this useful for? That’s right, you can finally play OpenTTD on a PinePhone with the full comfort of a mouse and keyboard!

Categories
Awesome Open source Programming Projects Technology

How to use an ESP8266 — a jumpstart tutorial

If you haven’t done so already, go buy yourself an ESP8266-based board. It is a powerful little microcontroller. Something like Arduino but with WiFi.

ESP8266 in the wild

What hardware to get

What software to get

  • ESP open SDK
    • Contains all the tools needed for compiling your own ESP firmware.
  • NodeMCU firmware
    • This converts the ESP to a LUA-powered computer.
  • ESPlorer
    • Very helpful serial terminal with direct ESP8266 and NodeMCU support

What to do with it all

  1. Find the pinout of your board. Get the connections ready (USB-UART + 3.3V power source + ESP8266)
    • 3.3V to VCC, GND to GND
    • RX to TX and TX to RX (ESP–UART).
    • CH_PD to VCC
    • Leave Reset floating, connect to GND to reset the chip when needed.
    • Pull the GPIO0 low for flashing.
  2. If you just want to get the ESP fired up, use the esptool.py and upload the precompiled NodeMCU bin images.
  3. If you want to play around some more, get the SDK and NodeMCU source code. Compile the former and then the latter. Flash our own bin images.
  4. Remove GPIO0 connection to leave the flashing mode.
  5. Open the ESPlorer and issue some commands to the chip!

Useful links

  • Dejvino’s NodeMCU firmware
    • Forked from the original NodeMCU firmware repository. Contains a new Sniffer module — packet sniffing functions exposed to the LUA interpreter. This allows WiFi packet sniffing using the ESP8266.
  • NodeMCU API
    • List of provided LUA functions in the NodeMCU firmware.
  • LUA language reference
    • Beware that not everything is supported in the ESP version of LUA.
Categories
Awesome Privacy Technology

Firefox Extensions

Here is a short list of Firefox extensions that I think are essential for your everyday browsing. I don’t want to persuade you into using them, this is more like a note to self for future reference.

Other nice to have extensions are these:

And it goes without saying that if there is one thing you don’t need, it is Adobe *, e.g. Flash. Just don’t download it. No one needs it. No one.

Categories
Awesome PicoPosts Projects

Playful Little Corpses Released

My very own horror game “Playful Little Corpses” is now released.

Playful Little Corpses

To find out more about it, head to the project entry page or to the main page of the game. Download it and give it a try!

Project entry page: projects.dejvino.com/w/playful-little-corpses/

Main page: hrave.mrtvolky.cz

Categories
Awesome PicoPosts Projects

Projects page is open

I’ve opened a new page dedicated to the projects I worked on. You can find links to source code of various games and utilities. Every project entry is described in short and you know whether it was just an idea I didn’t have time to finish, or a fully working product.  The list goes years back.

Link to the actual website:

projects.dejvino.com

Categories
Awesome Linux Open source Programming Projects Technology Web development

HTTP and HTTPS running on the same port

Running HTTP and HTTPS on the same port with Apache. They said it couldn’t be done. They were wrong!

https://github.com/Dejvino/https-multiplexer

I’ve modified a simple Python port forwarding utility to act as a port multiplexer that can automatically forward HTTP and HTTPS requests to the appropriate ports. If the request looks like an HTTP in plain text, it forwards it to port A. Otherwise it is assumed to be HTTPS and is forwarded to port B.

Now you can run your web applications from a single port, regardless of using HTTP or HTTPS. Hooray!

Categories
Awesome PicoPosts Projects

New Homepage

After uniting both of my personal domains (dejvino.cz and dejvino.com) to have the same content, I’ve prepared a new personal hompage.

Links:

www.dejvino.cz
www.dejvino.com

The purpose of this page is to act as a simple roadsign with directions to all of my projects and pages.
There is also a little “easter egg” floating around that page. Try to find it!

Categories
Awesome Music Technology

Floppy drive music

I knew this could be done! … Game of Thrones’ main theme played by 6 floppy drives. Enjoy.

http://www.youtube.com/watch?v=IYQWLlBz8hE&feature=youtu.be&t=7m27s

Categories
Awesome Programming Technology Web development

Peer to peer in JavaScript

I just came across PeerJS – Peer-to-peer JavaScript library. Great to see this kind of API available, hope  we will soon see some real-world applications.