Browse Source

Basic u-boot info

Giulio 4 years ago
parent
commit
40bb27f6e6
1 changed files with 123 additions and 13 deletions
  1. 123 13
      Readme.md

+ 123 - 13
Readme.md

@@ -272,13 +272,14 @@ Common softwares for serial communication are `minicom` and `screen`.
 ### Partition layout
 The info learnet from `proc/mtd` are extremely useful.
 
-	* `mtd0 u-boot` is a 64K partition which contains the u-boot bootloader
-	* `mtd1 u-boot-env` is a 64K partition containing the u-boot configuration
-	* `mtd2 rootfs` is a jffs2 partition containing the actual image
-	* `mtd3 uImage` is a squashfs kernel image 
-	* `mtd4 rootfs1` is a jffs2 partition containing a secondary image, probably used for recovery
-	* `mtd5 NVRAM` is a 64K partition which contains a `tgz` for OEM system configuration files
-	* `mtd6 ART` is a 64K partition [that contains calibration data for the radio chip](https://github.com/pepe2k/ar9300_eeprom)
+
+ * `mtd0 u-boot` is a 64K partition which contains the u-boot bootloader
+ * `mtd1 u-boot-env` is a 64K partition containing the u-boot configuration
+ * `mtd2 rootfs` is a jffs2 partition containing the actual image
+ * `mtd3 uImage` is a squashfs kernel image 
+ * `mtd4 rootfs1` is a jffs2 partition containing a secondary image, probably used for recovery
+ * `mtd5 NVRAM` is a 64K partition which contains a `tgz` for OEM system configuration files
+ * `mtd6 ART` is a 64K partition [that contains calibration data for the radio chip](https://github.com/pepe2k/ar9300_eeprom)
 
 The total size is of course 8192K. The partitions are not partitions in an EXT or NTFS sense. The data is just contiguos on the flash but the bootloader and the kernel are responsible for considering the different regions separate.
 
@@ -286,15 +287,124 @@ That's the reason because `cat` works and it is so simple to work with them.
 
 Since for vanilla OpenWRT a custom partition for configuration is not needed, and two rootfs aren't useful and everything can be packed in a single partition with more space for packages and user data our target could be:
 
-	* `mtd0 u-boot` oeiginal image
-	* `mtd1 u-boot-env` some values here needs to be modified
-	* `mtd2 firmware` 8000K OpenWRT partition (`firmware` is the standard OpenWRT naming)
-	* `mtd3 ART` original image
+ * `mtd0 u-boot` oeiginal image
+ * `mtd1 u-boot-env` some values here needs to be modified
+ * `mtd2 firmware` 8000K OpenWRT partition (`firmware` is the standard OpenWRT naming)
+ * `mtd3 ART` original image
 
 
-On some other devices this is not needed because maybe the partition layotu already makes sense: ie there are no duplicate rootfs data. They are a bit easier to play with because in that case there's probably no need to manipulate the boot environment. Furthermore, building an image for flashing trough the OEM web interface might be not possible.
+On some other devices this is not needed because maybe the partition layout already makes sense: ie there's already a single partition with kernel and data. They are a bit easier to play with because in that case there's probably no need to manipulate the boot environment. Furthermore, in this case, building an image for flashing trough the OEM web interface might be not possible.
 
 ### U-Boot
 U-boot is an Open Source Bootloader mainly for embedded devices. While it is actively developed, the actual version depends on the SDK a vendor provides for its SoC.
 
-Atheros, for `ar9330` seems to have used 1.4 as base, which is almost a decade old.
+Atheros, for `ar9330` seems to have used 1.4 as base, which is almost a decade old.
+
+Here's the u-boot log from the serial interface:
+
+```
+
+U-Boot 1.1.413 (Aug 29 2012 - 10:36:47)
+
+AP121-2MB (ar9330) U-boot
+DRAM:  32 MB
+flash size 8388608, sector count = 128
+Flash:  8 MB
+In:    serial
+Out:   serial
+Err:   serial
+Net:
+eth0: c8:ee:a6:3f:62:ad
+eth0 up
+eth1: 00:0a:0b:0c:0d:0e
+eth1 up
+eth0, eth1
+Hit any key to stop autoboot:  0
+## Booting image at 9f380000 ...
+   Image Name:   Linux Kernel Image
+   Created:      2019-09-05  10:02:56 UTC
+   Image Type:   MIPS Linux Kernel Image (lzma compressed)
+   Data Size:    864262 Bytes = 844 kB
+   Load Address: 80002000
+   Entry Point:  801d0de0
+   Verifying Checksum at 0x9f380040 ...OK
+   Uncompressing Kernel Image ... OK
+No initrd
+## Transferring control to Linux (at address 801d0de0) ...
+## Giving linux memsize in bytes, 33554432
+
+Starting kernel ...
+
+Booting AR9330(Hornet)...
+init started: BusyBox v1.15.0 (2019-09-05 18:04:35 CST)
+starting pid 19, tty '': '/etc/rc.d/rcS'
+Isking Copyright 2016....
+Not support pin simple config
+Not found /etc/rc.d/rc.getethdev
+Not found /etc/rc.d/rc.fs
+load driver
+  adf loaded sucessfully
+  asf loaded sucessfully
+  ath_hal loaded sucessfully
+  ath_rate_atheros loaded sucessfully
+  ath_dev loaded sucessfully
+  umac loaded sucessfully
+2
+starting pid 301, tty '': '/bin/getty ttyS0 115200'
+
+ CPE46B mips #1 Thu Sep 5 18:02:48 CST 2019 (none)
+CPE46B login:
+```
+
+
+This confirms most of what we have got to know from the OEM firmware, 8M flash, 32M RAM, AR9330 SoC. Hornet is the codename for a [specific ALFA board](https://openwrt.org/toh/alfa_network/hornet-ub), and probably its target has been recycled for this U-Boot build.
+U-Boot has the possibility to drop the user to an interactive command prompt if a key is hit on the early boot phase:
+
+```
+U-Boot 1.1.413 (Aug 29 2012 - 10:36:47)
+
+AP121-2MB (ar9330) U-boot
+DRAM:  32 MB
+flash size 8388608, sector count = 128
+Flash:  8 MB
+In:    serial
+Out:   serial
+Err:   serial
+Net:
+eth0: c8:ee:a6:3f:62:ad
+eth0 up
+eth1: 00:0a:0b:0c:0d:0e
+eth1 up
+eth0, eth1
+Hit any key to stop autoboot:  0
+ar7240> help
+padfix  - fixed uboot bug
+?       - alias for 'help'
+bdinfo  - print Board Info structure
+boot    - boot default, i.e., run 'bootcmd'
+bootd   - boot default, i.e., run 'bootcmd'
+bootm   - boot application image from memory
+cp      - memory copy
+erase   - erase FLASH memory
+help    - print online help
+loadb   - load binary file over serial line (kermit mode)
+loads   - load S-Record file over serial line
+loady   - load binary file over serial line (ymodem mode)
+md      - memory display
+mm      - memory modify (auto-incrementing)
+mw      - memory write (fill)
+ping    - send ICMP ECHO_REQUEST to network host
+printenv- print environment variables
+progmac - Set ethernet MAC addresses
+protect - enable or disable FLASH write protection
+reset   - Perform RESET of the CPU
+run     - run commands in an environment variable
+saveenv - save environment variables to persistent storage
+setenv  - set environment variables
+tftpboot- boot image via network using TFTP protocol
+version - print monitor version
+wd      - check and set watchdog
+ar7240>
+```
+
+_Note: `ar7240>` is probably there just because someone forgot to edit the prompt to the correct chipset name. It's just a static name and it is irrelevant.