[Differential] [Request, 597 lines] D5187: U-Boot loader (ubldr) support for MIPS

Sgalabov_gmail.com (Stanislav Galabov) phabric-noreply at FreeBSD.org
Thu Feb 4 10:36:47 UTC 2016


Sgalabov_gmail.com created this revision.
Sgalabov_gmail.com added reviewers: MIPS, loader, adrian, imp, ray.
Sgalabov_gmail.com added a subscriber: freebsd-mips-list.
Sgalabov_gmail.com set the repository for this revision to rS FreeBSD src repository.
Sgalabov_gmail.com added a project: MIPS.

REVISION SUMMARY
  This revision implements ubldr support for MIPS.
  A lot of it just mimics the ARM support for ubldr, basically the biggest change is in the start.S file.
  
  Apart from that, several Makefiles in sys/boot were not including the bsd.stand.mk, which prevented proper build for MIPS targets (due to some things compiled as PIC and others - as non-PIC). These Makefiles now include bsd.stand.mk and things build fine for MIPS (everything is build as non-PIC).
  
  I've used the head version of U-Boot and modified it to support the FreeBSD API for MIPS architectures. I've submitted the patch to U-Boot as well. In case it doesn't go through for some reason, I am also putting a copy of the patch here:
  https://www.dropbox.com/s/dmgz9idpj4beqpr/0001-Add-FreeBSD-API-support-for-MIPS-platforms.patch?dl=0

TEST PLAN
  I've tested this with the following setup:
  
  - QEMU with its 'mips' target in little endian mode
  - u-boot compiled for quemu-mips (little endian)
  - ubldr compiled for mipsel
  - a kernel quickly put together for the qemu-mips target that only supports basic UART (so we can see the bootlog).
  
  Output of the whole thing booting can be seen below:
  
  > qemu-system-mipsel -M mips -bios u-boot.bin -nographic -net nic,macaddr=00:16:3e:00:00:01 -net tap -hda hda.img -cpu 24Kc
  
  W: /etc/qemu-ifup: no bridge for guest interface found
  Could not open option rom 'vgabios-cirrus.bin': No such file or directory
  
  U-Boot 2016.03-rc1-dirty (Feb 04 2016 - 11:41:10 +0200)
  
  Board: Qemu -M mips CPU: 24Kc proc_id=0x19300
  DRAM:  128 MiB
  Using default environment
  
  In:    serial
  Out:   serial
  Err:   serial
  Net:   NE2000
  IDE:   Bus 0: OK Bus 1: OK
  
    Device 0: Model: QEMU HARDDISK  Firm: 2.0.0  Ser#: QM00001 
              Type: Hard Disk
              Capacity: 50.0 MB = 0.0 GB (102400 x 512)
    Device 1: not available
    Device 2: not available
    Device 3: not available
  
  Hit any key to stop autoboot:  0 
  qemu-mipsel # tftp; bootelf
  Using NE2000 device
  TFTP from server 192.168.78.1; our IP address is 192.168.78.10
  Filename 'demo'.
  Load address: 0x80500000
  Loading: #################
  
    	 5.6 MiB/s
  
  done
  Bytes transferred = 244995 (3bd03 hex)
  
  Starting application at 0x80800080 ...
  --------------------------------------
  
  Consoles: U-Boot console  
  Compatible U-Boot API signature found @87f6e0a8
  
  FreeBSD/mipsel U-Boot loader, Revision 1.2
  (root at stassi-bsd9, Wed Feb  3 17:44:10 EET 2016)
  
  DRAM: 128MB
  Number of U-Boot devices: 2
  U-Boot env: loaderdev not set, will probe all devices.
  Found U-Boot device: disk
  
    Probing all disk devices...
    Checking unit=0 slice=<auto> partition=<auto>... good.
  
  Booting from disk0s1:
  /
  /boot/kernel/kernel data=0x3ebaa8+0x27ff8 syms=[0x4+0x43a90+0x4+0x5e7cf]
  Hit [Enter] to boot immediately, or any other key for command prompt.
  Booting [/boot/kernel/kernel]...               
  Kernel entry at 0x80100100...
  Kernel args: (null)
  U-Boot args (from -2141491201 args):
  Environment:
  	???m??
  disk0s1:
  
  entry: mips_init()
  Cache info:
  
    picache_stride    = 4096
    picache_loopcount = 0
    pdcache_stride    = 1024
    pdcache_loopcount = 2
  
  cpu0: MIPS Technologies processor v0.147
  
    MMU: Standard TLB, 16 entries (4K 16K 64K 256K 1M 16M 64M 256M pg sizes)
    L1 i-cache: 2 ways of 64 sets, 16 bytes per line
    L1 d-cache: 2 ways of 64 sets, 16 bytes per line
    L2 cache: disabled
    Config1=0x9e190c8e<WatchRegs,MIPS16,EJTAG>
    Config2=0x80000000
  
  Physical memory chunk(s):
  0x514000 - 0x1ffffff, 28229632 bytes (6892 pages)
  Maxmem is 0x2000000
  KDB: debugger backends: ddb
  KDB: current backend: ddb
  Copyright (c) 1992-2016 The FreeBSD Project.
  Copyright (c) 1979, 1980, 1983, 1986, 1988, 1989, 1991, 1992, 1993, 1994
  	The Regents of the University of California. All rights reserved.
  FreeBSD is a registered trademark of The FreeBSD Foundation.
  FreeBSD 11.0-CURRENT #0 733656d(local/sgalabov_mtk)-dirty: Wed Feb  3 19:56:05 EET 2016
  
    root at stassi-bsd9:/usr/obj/mips.mipsel/src/sgalabov/sys/QEMU-MIPS mips
  
  gcc version 4.2.1 20070831 patched [FreeBSD]
  Preloaded elf kernel "kernel" at 0x8050dfe0.
  real memory  = 33554432 (32768K bytes)
  Physical memory chunk(s):
  0x005a8000 - 0x01f47fff, 26869760 bytes (6560 pages)
  avail memory = 26456064 (25MB)
  ULE: setup cpu 0
  random: entropy device external interface
  null: <full device, null device, zero device>
  mem: <memory>
  nfslock: pseudo-device
  nexus0: <MIPS32 root nexus>
  random: harvesting attach, 8 bytes (4 bits) from nexus0
  clock0: <Generic MIPS32 ticker> on nexus0
  Timecounter "MIPS32" frequency 50000000 Hz quality 800
  Event timer "MIPS32" frequency 50000000 Hz quality 800
  random: harvesting attach, 8 bytes (4 bits) from clock0
  obio0 at mem 0x10000000-0x1fffffff on nexus0
  uart0: <16550 or compatible> on obio0
  uart0: console (-1,n,8,1)
  uart0: fast interrupt
  uart0: PPS capture mode 2 (DCD)
  random: harvesting attach, 8 bytes (4 bits) from uart0
  random: harvesting attach, 8 bytes (4 bits) from obio0
  Device configuration finished.
  Timecounters tick every 10.000 msec
  tcp_init: net.inet.tcp.tcbhashsize auto tuned to 512
  lo0: bpf attached
  Trying to mount root from ufs:ada0 []...
  mountroot: waiting for device ada0...
  Mounting from ufs:ada0 failed with error 19.
  
  Loader variables:
  <snip>

REPOSITORY
  rS FreeBSD src repository

REVISION DETAIL
  https://reviews.freebsd.org/D5187

AFFECTED FILES
  sys/boot/Makefile.mips
  sys/boot/common/Makefile.inc
  sys/boot/common/self_reloc.c
  sys/boot/fdt/Makefile
  sys/boot/ficl/Makefile
  sys/boot/mips/Makefile
  sys/boot/mips/uboot/Makefile
  sys/boot/mips/uboot/conf.c
  sys/boot/mips/uboot/help.uboot
  sys/boot/mips/uboot/ldscript.mips
  sys/boot/mips/uboot/loader.conf
  sys/boot/mips/uboot/start.S
  sys/boot/mips/uboot/version
  sys/boot/uboot/fdt/Makefile
  sys/boot/uboot/lib/Makefile
  sys/boot/uboot/lib/elf_freebsd.c
  sys/boot/uboot/lib/glue.c

EMAIL PREFERENCES
  https://reviews.freebsd.org/settings/panel/emailpreferences/

To: Sgalabov_gmail.com, MIPS, loader, adrian, imp, ray
Cc: freebsd-mips-list
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D5187.13000.patch
Type: text/x-patch
Size: 21683 bytes
Desc: not available
URL: <http://lists.freebsd.org/pipermail/freebsd-mips/attachments/20160204/a22295c2/attachment.bin>


More information about the freebsd-mips mailing list