tomeshnet / meshstream

Live video stream with a distributed file system over a physical mesh network
GNU General Public License v3.0
23 stars 4 forks source link

Compiling LibreRouter os #6

Open darkdrgn2k opened 6 years ago

darkdrgn2k commented 6 years ago

To compile the os currently follow these steps

wget http://blog.altermundi.net/media/uploads/lime-sdk-LR.tar.bz
mkdir -p  /home/nicolas/OS_projects/lime-sdk-LR
cd /home/nicolas/OS_projects
wget http://blog.altermundi.net/media/uploads/lime-sdk-LR.tar.bz
tar xvf lime-sdk-LR.tar.bz
cd lime-sdk-LR
./cooker --update-communities --update-feeds
./cooker -b ar71xx/generic
./cooker -c ar71xx/generic --flavor=lime_default --profile=librerouter-v1
darkdrgn2k commented 6 years ago

After building the image(openwrt-lime-default-ar71xx-generic-librerouter-v1-squashfs-sysupgrade.bin) I tried flashing it with LUCI and got the following error

The uploaded image file does not contain a supported format. Make sure that you choose the generic image format for your platform.

Trying to do the same via sysupgrade gave me a similar error

Passing the force argument wrote the image but the device would no longer boot.

Attaching a serial connection i saw this:


U-Boot 1.1.4 (Apr 19 2014 - 00:17:22)

ap135 - Scorpion 1.0DRAM:
sri
Scorpion 1.0
ath_ddr_initial_config(200): (32bit) ddr2 init
tap = 0x00000003
Tap (low, high) = (0x5, 0x1e)
Tap values = (0x11, 0x11, 0x11, 0x11)
128 MB
Top of RAM usable for U-Boot at: 88000000
Reserving 207k for U-Boot at: 87fcc000
Reserving 192k for malloc() at: 87f9c000
Reserving 44 Bytes for Board Info at: 87f9bfd4
Reserving 36 Bytes for Global Data at: 87f9bfb0
Reserving 128k for boot params() at: 87f7bfb0
Stack Pointer at: 87f7bf98
Now running in RAM - U-Boot at: 87fcc000
Flash Manuf Id 0xef, DeviceId0 0x40, DeviceId1 0x18
flash size 16MB, sector count = 256
Flash: 16 MB
*** Warning *** : PCIe WLAN Module not found !!!
In:    serial
Out:   serial
Err:   serial
Net:   ath_gmac_enet_initialize...
athrs_sgmii_res_cal: cal value = 0x1
Fetching MAC Address from 0x87feea5c
Fetching MAC Address from 0x87feea5c
ath_gmac_enet_initialize: reset mask:c02200
Scorpion  ----> S17 PHY *
Vlan config...
s17 phy0 register value 0x00004140
TEST: FINAL REG VAL after TX Calibration - 0x4a000000
TEST: FINAL XMII VAL after RX Calibration - 0x4a000000
TEST: FINAL ETH_CFG VAL after RX Calibration - 0x00000001
athrs17_reg_init: complete
: cfg1 0x80000000 cfg2 0x7335
eth0: 00:03:7f:11:2e:d8
eth0 up
athrs17_reg_init_wan done
SGMII in forced mode
athr_gmac_sgmii_setup SGMII done
: cfg1 0x800c0000 cfg2 0x7214
eth1: 00:03:7f:11:2e:d9
eth1 up
eth0, eth1
Setting 0x18116290 to 0x50a0214f
Hit any key to stop autoboot:  0
## Booting image at 9fe80000 ...
   Image Name:   MIPS LEDE Linux-4.4.74
   Created:      2017-07-26  22:37:05 UTC
   Image Type:   MIPS Linux Kernel Image (lzma compressed)
   Data Size:    1329392 Bytes =  1.3 MB
   Load Address: 80060000
   Entry Point:  80060000
   Verifying Checksum at 0x9fe80040 ...OK
   Uncompressing Kernel Image ... OK
No initrd
## Transferring control to Linux (at address 80060000) ...
## Giving linux memsize in bytes, 134217728

Starting kernel ...

[    0.000000] Linux version 4.4.74 (root@debian) (gcc version 6.3.0 (LEDE GCC 6.3.0 r4619-d72371e) ) #0 Wed Jul 26 22:37:05 2017
[    0.000000] bootconsole [early0] enabled
[    0.000000] CPU0 revision is: 00019750 (MIPS 74Kc)
[    0.000000] SoC: Qualcomm Atheros QCA9558 ver 1 rev 0
[    0.000000] Determined physical RAM map:
[    0.000000]  memory: 08000000 @ 00000000 (usable)
[    0.000000] User-defined physical RAM map:
[    0.000000]  memory: 10000000 @ 00000000 (usable)
[    0.000000] Initrd not found or empty - disabling initrd
[    0.000000] No valid device tree found, continuing without
[    0.000000] Zone ranges:
[    0.000000]   Normal   [mem 0x0000000000000000-0x000000000fffffff]
[    0.000000] Movable zone start for each node
[    0.000000] Early memory node ranges
[    0.000000]   node   0: [mem 0x0000000000000000-0x000000000fffffff]
[    0.000000] Initmem setup node 0 [mem 0x0000000000000000-0x000000000fffffff]
[    0.000000] Primary instruction cache 64kB, VIPT, 4-way, linesize 32 bytes.
[    0.000000] Primary data cache 32kB, 4-way, VIPT, cache aliases, linesize 32 bytes
[    0.000000] Built 1 zonelists in Zone order, mobility grouping on.  Total pages: 65024
[    0.000000] Kernel command line:  board=HP5801 mtdparts=spi0.0:192k(u-boot)ro,64k(u-boot-env)ro,64k(config),14528k(rootfs),1472k(kernel),64k(art),16000k@0x50000(firmware) console=ttyS0,115200 mem=256M rootfstype=squashfs,jffs2 noinitrd
[    0.000000] PID hash table entries: 1024 (order: 0, 4096 bytes)
[    0.000000] Dentry cache hash table entries: 32768 (order: 5, 131072 bytes)
[    0.000000] Inode-cache hash table entries: 16384 (order: 4, 65536 bytes)
[    0.000000] Writing ErrCtl register=00000000
[    0.000000] Readback ErrCtl register=00000000
[    0.000000] Memory: 255088K/262144K available (2973K kernel code, 151K rwdata, 756K rodata, 272K init, 200K bss, 7056K reserved, 0K cma-reserved)
[    0.000000] SLUB: HWalign=32, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
[    0.000000] NR_IRQS:51
[    0.000000] Clocks: CPU:720.000MHz, DDR:600.000MHz, AHB:200.000MHz, Ref:40.000MHz
[    0.000000] clocksource: MIPS: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 5309056796 ns
[    0.000007] sched_clock: 32 bits at 360MHz, resolution 2ns, wraps every 5965232126ns
[    0.008274] Calibrating delay loop... 358.80 BogoMIPS (lpj=1794048)
[    0.071185] pid_max: default: 32768 minimum: 301
[    0.076192] Mount-cache hash table entries: 1024 (order: 0, 4096 bytes)
[    0.083238] Mountpoint-cache hash table entries: 1024 (order: 0, 4096 bytes)
[    0.092742] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 19112604462750000 ns
[    0.103249] futex hash table entries: 256 (order: -1, 3072 bytes)
[    0.110286] NET: Registered protocol family 16
[    0.116206] MIPS: machine is OEM Duo Band Wireless EVAL Board
[    0.122714] ar724x-pci ar724x-pci.0: PCIe link is down
[    0.128218] registering PCI controller with io_map_base unset
[    0.134440] registering PCI controller with io_map_base unset
[    0.587443] PCI host bridge to bus 0000:00
[    0.591845] pci_bus 0000:00: root bus resource [mem 0x10000000-0x11ffffff]
[    0.599155] pci_bus 0000:00: root bus resource [io  0x0000]
[    0.605087] pci_bus 0000:00: root bus resource [??? 0x00000000 flags 0x0]
[    0.612309] pci_bus 0000:00: No busn resource found for root bus, will use [bus 00-ff]
[    0.620856] PCI host bridge to bus 0000:01
[    0.625214] pci_bus 0000:01: root bus resource [mem 0x12000000-0x13ffffff]
[    0.632547] pci_bus 0000:01: root bus resource [io  0x0001]
[    0.638476] pci_bus 0000:01: root bus resource [??? 0x00000000 flags 0x0]
[    0.645699] pci_bus 0000:01: No busn resource found for root bus, will use [bus 01-ff]
[    0.654561] pci 0000:01:00.0: BAR 0: assigned [mem 0x12000000-0x1201ffff 64bit]
[    0.662378] pci 0000:01:00.0: BAR 6: assigned [mem 0x12020000-0x1202ffff pref]
[    0.670066] pci 0000:01:00.0: using irq 41 for pin 1
[    0.675991] clocksource: Switched to clocksource MIPS
[    0.682390] NET: Registered protocol family 2
[    0.687707] TCP established hash table entries: 2048 (order: 1, 8192 bytes)
[    0.695149] TCP bind hash table entries: 2048 (order: 1, 8192 bytes)
[    0.701963] TCP: Hash tables configured (established 2048 bind 2048)
[    0.708796] UDP hash table entries: 256 (order: 0, 4096 bytes)
[    0.715015] UDP-Lite hash table entries: 256 (order: 0, 4096 bytes)
[    0.721922] NET: Registered protocol family 1
[    0.730005] Crashlog allocated RAM at address 0x3f00000
[    0.746302] squashfs: version 4.0 (2009/01/31) Phillip Lougher
[    0.752518] jffs2: version 2.2 (NAND) (SUMMARY) (LZMA) (RTIME) (CMODE_PRIORITY) (c) 2001-2006 Red Hat, Inc.
[    0.764954] io scheduler noop registered
[    0.769167] io scheduler deadline registered (default)
[    0.774863] Serial: 8250/16550 driver, 1 ports, IRQ sharing disabled
[    0.781984] console [ttyS0] disabled
[    0.805849] serial8250.0: ttyS0 at MMIO 0x18020000 (irq = 11, base_baud = 2500000) is a 16550A
[    0.815032] console [ttyS0] enabled
[    0.815032] console [ttyS0] enabled
[    0.822450] bootconsole [early0] disabled
[    0.822450] bootconsole [early0] disabled
[    0.833405] m25p80 spi0.0: found w25q128, expected m25p80
[    0.838940] m25p80 spi0.0: w25q128 (16384 Kbytes)
[    0.843738] 7 cmdlinepart partitions found on MTD device spi0.0
[    0.849752] Creating 7 MTD partitions on "spi0.0":
[    0.854610] 0x000000000000-0x000000030000 : "u-boot"
[    0.861389] 0x000000030000-0x000000040000 : "u-boot-env"
[    0.868064] 0x000000040000-0x000000050000 : "config"
[    0.874330] 0x000000050000-0x000000e80000 : "rootfs"
[    0.880629] mtd: device 3 (rootfs) set to be root filesystem
[    0.886463] mtdsplit: no squashfs found in "rootfs"
[    0.891423] 0x000000e80000-0x000000ff0000 : "kernel"
[    0.897709] 0x000000ff0000-0x000001000000 : "art"
[    0.903734] 0x000000050000-0x000000ff0000 : "firmware"
[    0.922105] switch0: Atheros AR8327 rev. 4 switch registered on ag71xx-mdio.0
[    1.544301] libphy: ag71xx_mdio: probed
[    2.137499] ag71xx ag71xx.0: connected to PHY at ag71xx-mdio.0:00 [uid=004dd034, driver=Atheros AR8216/AR8236/AR8316]
[    2.148841] eth0: Atheros AG71xx at 0xb9000000, irq 4, mode:RGMII
[    2.737619] eth1: Atheros AG71xx at 0xba000000, irq 5, mode:SGMII
[    2.745456] NET: Registered protocol family 10
[    2.752998] NET: Registered protocol family 17
[    2.757617] bridge: automatic filtering via arp/ip/ip6tables has been deprecated. Update your scripts to load br_netfilter if you need this.
[    2.770531] 8021q: 802.1Q VLAN Support v1.8
[    2.863356] jffs2: notice: (1) jffs2_build_xattr_subsystem: complete building xattr subsystem, 0 of xdatum (0 unchecked, 0 orphan) and 0 of xref (0 dead, 0 orphan) found.
[    2.878943] VFS: Mounted root (jffs2 filesystem) readonly on device 31:3.
[    2.886780] Freeing unused kernel memory: 272K (8042c000 - 80470000)
[    2.893276] Kernel panic - not syncing: No working init found.  Try passing init= option to kernel. See Linux Documentation/init.txt for guidance.
[    2.907395] Rebooting in 1 seconds..▒
benhylau commented 6 years ago

Posting @darkdrgn2k's built artifacts here for reference:

-rw-r--r-- 1 root root    5209 Jul  3 13:22 openwrt-lime-default-ar71xx-generic-device-librerouter-v1.manifest
-rw-r--r-- 1 root root 4915204 Jul  3 13:22 openwrt-lime-default-ar71xx-generic-librerouter-v1-squashfs-sysupgrade.bin
-rw-r--r-- 1 root root 3801088 Jul  3 13:22 openwrt-lime-default-ar71xx-generic-root.squashfs
-rw-r--r-- 1 root root 1415759 Jul  3 13:22 openwrt-lime-default-ar71xx-generic-uImage-lzma.bin
-rwxr-xr-x 1 root root 4631084 Jul  3 13:22 openwrt-lime-default-ar71xx-generic-vmlinux.bin
-rwxr-xr-x 1 root root 4636208 Jul  3 13:22 openwrt-lime-default-ar71xx-generic-vmlinux.elf
-rw-r--r-- 1 root root 1441792 Jul  3 13:22 openwrt-lime-default-ar71xx-generic-vmlinux.lzma
-rwxr-xr-x 1 root root 1487352 Jul  3 13:22 openwrt-lime-default-ar71xx-generic-vmlinux-lzma.elf
-rw-r--r-- 1 user user    5227 Mar 15 21:49 openwrt-quintanalibre.org.ar-librerouter-ar71xx-generic-device-librerouter-v1.manifest
-rw-r--r-- 1 user user 5177348 Mar 15 21:49 openwrt-quintanalibre.org.ar-librerouter-ar71xx-generic-librerouter-v1-squashfs-sysupgrade.bin
-rw-r--r-- 1 user user 4063232 Mar 15 21:49 openwrt-quintanalibre.org.ar-librerouter-ar71xx-generic-root.squashfs
-rw-r--r-- 1 user user 1415759 Mar 15 21:48 openwrt-quintanalibre.org.ar-librerouter-ar71xx-generic-uImage-lzma.bin
-rwxr-xr-x 1 user user 4631084 Mar 15 21:48 openwrt-quintanalibre.org.ar-librerouter-ar71xx-generic-vmlinux.bin
-rwxr-xr-x 1 user user 4636208 Mar 15 21:48 openwrt-quintanalibre.org.ar-librerouter-ar71xx-generic-vmlinux.elf
-rw-r--r-- 1 user user 1441792 Mar 15 21:48 openwrt-quintanalibre.org.ar-librerouter-ar71xx-generic-vmlinux.lzma
-rwxr-xr-x 1 user user 1487352 Mar 15 21:48 openwrt-quintanalibre.org.ar-librerouter-ar71xx-generic-vmlinux-lzma.elf
-rw-r--r-- 1 user user    2100 Jul  3 13:22 sha256sums
darkdrgn2k commented 6 years ago

To boot an LibreMesh image correctly you need to change a U-Boot parameter.

To get into U-Boot connect a serial console

Header J4 1 - VCC (optional) 2 - RX (TX on your dongle) 3 - TX (RX on your dongle) 4 - Ground

Baud 115200

Press any key when prompted to at the beginning of the boot (or just press a key repeatedly) You will see the U-Boot prompt ath>

Run the following to set the parameters needed to boot

setenv bootargs "board=LIBREROUTERV1 console=ttyS0,115200"
savenev

For documentation only the ORIGINAL line was bootargs=console=ttyS0,115200 root=31:02 rootfstype=squashfs init=/sbin/init mtdparts=ath-nor0:256k(u-boot),64k(u-boot-env),6336k(rootfs),1408k(uImage),8256k(mib0),64k(ART)

Flashing from U-Boot If you need to flash your device from U-Boot.

  1. Connect a computer with a tftpd server to the device
  2. Set the computer's ip address to 192.168.1.10
  3. Connect a serial console to the device (see above)
  4. Place the Kernel and the Filesystem files from the output directory into the tftpd server
  5. Run these commands (one at a time dont copy and paste them all)
tftp 0x80060000 openwrt-lime-default-ar71xx-generic-root.squashfs
erase 0x9f050000 +0xE30000
cp.b 0x80060000 0x9f050000 $filesize

tftp 0x80060000 openwrt-lime-default-ar71xx-generic-uImage-lzma.bin
erase 0x9fE80000 +0x170000
cp.b 0x80060000 0x9fE80000 $filesize
  1. reboot but powercycling or entering reset

TFTPd Windows you can use http://tftpd32.jounin.net/