Build your own OpenWRT Image

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
12 messages Options
Reply | Threaded
Open this post in threaded view
|

Build your own OpenWRT Image

MAHDTech

WARNING: if you brick it, its your fault!

I was able to boot a vanilla OpenWRT image (Cavium supplied) on the Shield, booting from the SD Card.

This means you can play around and not touch the on-board MMC.

I am just now trying to make a persistent storage (so I can install packages) and then you can do what you want.

It's a small step for us to fully customise the device.

Just a teaser for now (as I'm off to bed, 2am here) and more to come tomorrow!

Here are some initial notes which I will update later.

-----------------------------------------------------------------------------------------------------------------------------------

Boot your own OpenWRT image from SD Card

Tools Required

        If using Windows

                • Mini Tool Partition Wizard
                • Paragon ExtFS
       
        If using Linux
       
                • nothing

        1. Create the required partitions on SD Card

        Partition 1
                • FS Type: FAT32
                • Usage: Kernel
                • Notes: U-Boot needs to read it from FAT32
       
        Partition 2
                • FS Type: Ext3
                • Usage: OpenWRT Root File System
                • Notes: Writable
       
        2. Copy the required files onto the right partitions

        Partition 1
                • Copy the Initial RAM FS to the FAT32 Parition and name it vmlinux
       
        Partition 2
                • Extract the contents of the Root FS to the Ext partition
       
        3. Insert the SD card into the shield and boot it

        4. Break at Stage2 of the boot loader and type the following

        # See if the SD card is visible as 2
       
                mmc list
               
                        Octeon MMC/SD0: 1
                        Octeon MMC/SD2: 2
       
        # Select the SD Card
       
                mmc dev 2
               
                        mmc2(part 0) is current device
                       
        # View the partitions on the device
       
                mmc part
               
                        Partition Map for MMC device 2  --   Partition Type: DOS
                       
                        Part    Start Sector    Num Sectors     UUID            Type
                          1     2048            2097152         56022b01-01     0b
                          2     2101248         28598272        56022b01-02     07
       
        # Make sure uboot can see the files on the FAT32 partition
       
                fatls mmc 2
               
                         system volume information/
                         93922696   vmlinux
                       
                        1 file(s), 1 dir(s)
               
        # Configure the bootloader to point to the SD Card partition and use the file named vmlinux (temporary)
       
                fatload mmc 2 $(loadaddr) vmlinux
               
                        reading vmlinux
                        93922696 bytes read in 10032 ms (8.9 MiB/s)
                       
        # Boot the image, specify 2 CPUs and 1GB of RAM
       
                bootoctlinux $(loadaddr) coremask=0x3  mem=1024M
               
                        argv[2]: coremask=0x3
                        argv[3]: mem=1024M
                        Allocating memory for ELF segment: addr: 0xffffffff80100000 (adjusted to: 0x100000), size 0x5a7af80
                        ## Loading big-endian Linux kernel with entry point: 0xffffffff806b8f60 ...
                        Bootloader: Done loading app on coremask: 0x3
                        Starting cores:
                         0x3
                        [    0.000000] Linux version 3.10.20 (abhijit@abhijit-ThinkPad-T420) (gcc version 4.7.0 (Cavium Inc. Version: SDK_3_1_0_p2 build 34) ) #6 SMP Mon Nov 2 14:59:32 PST 2015
                        [    0.000000] CVMSEG size: 2 cache lines (256 bytes)
                        [    0.000000] Cavium Inc. SDK-3.1
                        [    0.000000] bootconsole [early0] enabled
                        [    0.000000] CPU revision is: 000d9602 (Cavium Octeon III)
                        [    0.000000] FPU revision is: 00739600
               
Reply | Threaded
Open this post in threaded view
|

Re: Build your own OpenWRT Image

MAHDTech

Short Term Roadmap

Let's make a plan!

1. Create an image to be written to SD Card for testing

2. Test, Test, Test without affecting the EMMC, i.e. a reboot will take the device back to normal.

3. Document everything

Longer Term Roadmap

* Create an image for EMMC once stable enough to replace ITUS image
* Automatic Builds and testing CI
* try and separate configuration files from base to easy to move to new base images
* Update base OS whenever Cavium releases a new version
* Might look at getting a Turris image as it will be better supported by a team of devs working on the project.
* Look at alternatives like NanoBSD as OS as an option

Questions

1. When creating an image I will have to use fixed partitions (unless someone knows how to autoresize?) so what size SD Card should I make it for?

* 4GB
* 8GB
* 16GB

2. Do you want plain Vanilla images with no packages, which you can then add what you want or a default base for a start? or should it include packages by default.

IPS = Suricata or Snort (my personal preference is Suri so I will be using that)
VPN = OpenVPN
FW = IPTables
AV = ClamAV

3. I will be using GitLab (better than GitHub or BitBucket imo) to host all scripts, package files etc, this will be publically read only, and people can send merge requests for patches. Anyone have issues with this approach?
Reply | Threaded
Open this post in threaded view
|

Re: Build your own OpenWRT Image

user8446
Administrator
This post was updated on .
Hi,

Here are my personal thoughts:

1. 4GB should be fine as that's what's on the box now
2. We should stick with Snort as a base package. Itus dropped Suri because they we're only getting ~50mbps using both cores and getting double that with Snort on 1 core. We would also loose over a year of modifications and bugfixes and the custom LuCI interface for it. Suri also isn't in the official OpenWRT repo and Snort is.
3. GitLab is fine

Basically, the updated OS from Cavium with the work and hotfixes already done and still being worked on by the community would bring the box to a whole new level.
Running the latest OpenWrt stable release
Reply | Threaded
Open this post in threaded view
|

Re: Build your own OpenWRT Image

ericsante
In reply to this post by MAHDTech
I'm willing to contribute on this.  Let me know how I can help.
Reply | Threaded
Open this post in threaded view
|

Re: Build your own OpenWRT Image

hans2
This post was updated on .
I will help too


I've setup GITHUB organization (https://github.com/orgs/ItusShield/)  for Shield yesterday but it needs existing accounts to be added.
Let me know if you want to be one of the developers. If so, send me your github account name.

Question: Github allows to setup several repositories - should we use that (ex: hotfix/fw_upgrade vs firmware development) or not?

No more: Shield Pro v1, Chaos Calmer, FW 1.51 SP1
Reply | Threaded
Open this post in threaded view
|

Re: Build your own OpenWRT Image

ericsante
@digitalroadies on GitHub.  do you have OpenWRT installed yet?  I'm gonna try and get it running tonight.
Reply | Threaded
Open this post in threaded view
|

Re: Build your own OpenWRT Image

Roadrunnere42
count me in

Roadrunneruk on Github
Reply | Threaded
Open this post in threaded view
|

Re: Build your own OpenWRT Image

hans2
I've sent invites to you all. Please accept.

No more: Shield Pro v1, Chaos Calmer, FW 1.51 SP1
Reply | Threaded
Open this post in threaded view
|

Re: Build your own OpenWRT Image

ericsante
In reply to this post by MAHDTech
Did you use ER, ERLITE or Generic kernel?
Reply | Threaded
Open this post in threaded view
|

Re: Build your own OpenWRT Image

Gnomad
This post was updated on .
In reply to this post by hans2
Hi Hans, appreciate an add, got a patch for Shield-Master to allow user selectable themes.
Cheers, Gnomad
OpenWrt SNAPSHOT, r10391-3d8d528939
Reply | Threaded
Open this post in threaded view
|

Re: Build your own OpenWRT Image

hans2
Hi GNomad,

i've added you to Github, please accept invite
No more: Shield Pro v1, Chaos Calmer, FW 1.51 SP1
Reply | Threaded
Open this post in threaded view
|

Re: Build your own OpenWRT Image

duanev
In reply to this post by MAHDTech
SDK + Toolchain recently updated here https://downloads.openwrt.org/snapshots/trunk/octeon/generic