Wednesday 28 February 2018

Tinkering OpenWRT (3) : Setting up OpenWRT on a Raspberry Pi

Step 1: Use an SD Card Reader to load up a MicroSD card.

Step 2: I'm using Raspberry Pi B+, that's an RPi 1.
So from:
     https://wiki.openwrt.org/toh/raspberry_pi_foundation/raspberry_pi
download:
     Raspberry Pi 1: http://downloads.openwrt.org/chaos_calmer/15.05.1/brcm2708/bcm2708/

Step 3:
Use etcher to make an bootable SD card.

Step 4: insert the bootable SD card to RPi.


ref:
https://www.raspberrypi.org/documentation/installation/installing-images/      !!!!!
https://etcher.io/                                                                                                   !!!!!

http://www.ct-networks.io/community/tutorials/openwrt-installing-firmware-on-raspberry-pi.html   !!
https://devzone.nordicsemi.com/b/blog/posts/trying-openwrt-chaos-calmer-1505-rc1-on-raspberry-
https://computers.tutsplus.com/articles/installing-openwrt-on-a-raspberry-pi-as-a-new-home-firewall--mac-55984
https://www.qualityology.com/tech/how-to-install-openwrt-on-raspberry-pi/
https://tecadmin.net/format-usb-in-linux/

Friday 16 February 2018

Tinkering OpenWRT (2) : Installing Softwares (eg. Python)

For example, I want to install Python.

Do this first!!!!
opkg update

Now we can install Python related packages:

opkg install libffi
opkg install python-mini
opkg install python
opkg install python-openssl



ref:
http://www.rendoumi.com/openwrtan-zhuang-python-pip/
http://blog.csdn.net/frankechen/article/details/78660437
http://www.cnblogs.com/xianfangloveyangmei/p/4091882.html

Tinkering OpenWRT (1) : Getting Started

I don't have an actual board in my hand yet but I just couldn't wait to start play around with OpenWRT! So no bullshit here is how I got started in VirtualBox.

Step 1: Get it
Option 1 :
http://downloads.openwrt.org/backfire/10.03.1/x86_generic/openwrt-x86-generic-combined-ext2.vdi
As can be seen, the file is already a .vdi so it can be used directly.

Option 2 :
http://downloads.openwrt.org/backfire/10.03.1/x86_generic/openwrt-x86-generic-combined-ext2.img.gz
If you want to go with this option, you need to convert the image file to vdi file:

VBoxManager convertfromraw --format VDI openwrt-18.06.0-x86-generic-combined-ext4.img.gz openwrt-1806-x86.vdi

##################################################################

Troubleshooting:

Problem (1)
Command 'VBoxManager' not found, did you mean:

  command 'VBoxManage' from deb virtualbox


Try: sudo apt install <deb name>

Solution:
$ which VBoxManage
/usr/bin/VBoxManage

and then
/usr/bin/VBoxManage convertfromraw --format VDI openwrt-18.06.0-x86-generic-combined-ext4.img.gz openwrt-1806-x86.vdi


Problem (2)
$ /usr/bin/VBoxManage convertfromraw --format VDI openwrt-18.06.0-x86-generic-combined-ext4.img.gz openwrt-1806-x86.vdi
Converting from raw image file="openwrt-18.06.0-x86-generic-combined-ext4.img.gz" to file="openwrt-1806-x86.vdi"...
Creating dynamic image with size 7896443 bytes (8MB)...
VBoxManage: error: VD: The given disk size 7896443 is not aligned on a sector boundary (512 bytes)
VBoxManage: error: Error code VERR_VD_INVALID_SIZE at /home/vbox/vbox-5.2.16/src/VBox/Storage/VD.cpp(6219) in function int VDCreateBase(PVDISK, const char*, const char*, uint64_t, unsigned int, const char*, PCVDGEOMETRY, PCVDGEOMETRY, PCRTUUID, unsigned int, PVDINTERFACE, PVDINTERFACE)

VBoxManage: error: Cannot create the disk image "openwrt-1806-x86.vdi": VERR_VD_INVALID_SIZE


Solution:
$ dd if=openwrt-18.06.0-x86-generic-combined-ext4.img.gz of=openwrt.img bs=128000 conv=sync
61+1 records in
62+0 records out

7936000 bytes (7.9 MB, 7.6 MiB) copied, 0.138767 s, 57.2 MB/s


$ /usr/bin/VBoxManage convertfromraw --format VDI openwrt.img openwrt-1806-x86.vdi
Converting from raw image file="openwrt.img" to file="openwrt-1806-x86.vdi"...

Creating dynamic image with size 7936000 bytes (8MB)...

##################################################################

Step 2: Vbox configuration
Settings are as shown in following pictures. Some of the areas are grey because my openwrt is running.

settings 0:

Settings 1: You must choose IDE controller. It won't boot if you go with SATA.

Settings 2: We need at least two NIC.


Settings 3:

Step 3: Run!
 Press ENTER here!


Voila!!


ref:
http://www.cnblogs.com/hdk1993/p/4769141.html
http://blog.tshine.me/virtualbox%E5%AE%89%E8%A3%85openwrt.html
https://vsxen.github.io/2017/05/15/openwrt-install-virtualbox/
http://blog.csdn.net/js93105/article/details/44704283
https://openwrt.org/docs/guide-user/virtualization/virtualbox-vm





Thursday 8 February 2018

Git delete tag locally and remotely


To delete a local tag:
git tag -d tag-name

To delete a remote tag:
git tag -d tag-name                                    // first: delete it locally
git push origin :refs/tags/tag-name         // then push the empty tag to origin

ref:
http://www.manikrathee.com/how-to-delete-a-tag-in-git.html

Friday 2 February 2018

Building esp-open-sdk


Following the instructions in
                 https://github.com/pfalcon/esp-open-sdk

until make. You might meet errors because of missing tools.

These are the things I did:

sudo apt-get install autoconf
sudo apt-get install gperf
sudo apt-get install bison
sudo apt-get install flex
sudo apt-get install texinfo
sudo apt-get install help2man
sudo apt-get install gawk
sudo apt-get install libncurses5-dev

Hope it helps you.

ref:
https://github.com/pfalcon/esp-open-sdk
https://github.com/crosstool-ng/crosstool-ng/issues/329
https://www.crifan.com/files/doc/docbook/crosstool_ng/release/htmls/crosstool_ng_common_errors.html#missing_gperf
https://www.howtoinstall.co/en/ubuntu/trusty/help2man
https://askubuntu.com/questions/710379/do-i-need-to-install-awk-or-is-it-inbuilt-in-ubuntu
https://www.crifan.com/ubuntu_crosstool_ng_configure_error_could_not_find_curses_header_required_for_the_kconfig_frontends/