From owner-freebsd-mips@FreeBSD.ORG Thu Mar 31 21:57:49 2011 Return-Path: Delivered-To: freebsd-mips@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E8FCB106564A; Thu, 31 Mar 2011 21:57:48 +0000 (UTC) (envelope-from ray@ddteam.net) Received: from mail-fx0-f54.google.com (mail-fx0-f54.google.com [209.85.161.54]) by mx1.freebsd.org (Postfix) with ESMTP id 225288FC08; Thu, 31 Mar 2011 21:57:47 +0000 (UTC) Received: by fxm11 with SMTP id 11so2865507fxm.13 for ; Thu, 31 Mar 2011 14:57:47 -0700 (PDT) Received: by 10.223.85.195 with SMTP id p3mr395366fal.0.1301608666939; Thu, 31 Mar 2011 14:57:46 -0700 (PDT) Received: from rnote.ddteam.net (159-87-133-95.pool.ukrtel.net [95.133.87.159]) by mx.google.com with ESMTPS id j12sm573244fax.33.2011.03.31.14.57.44 (version=SSLv3 cipher=OTHER); Thu, 31 Mar 2011 14:57:45 -0700 (PDT) Date: Fri, 1 Apr 2011 00:57:33 +0300 From: Aleksandr Rybalko To: Milan Obuch Message-Id: <20110401005733.3598e82c.ray@ddteam.net> In-Reply-To: <20110331142640.07f2101b@atom.dino.sk> References: <20110331101554.68171eed@atom.dino.sk> <20110331142640.07f2101b@atom.dino.sk> X-Mailer: Sylpheed 3.1.0 (GTK+ 2.22.1; amd64-portbld-freebsd9.0) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Cc: freebsd-mips@freebsd.org Subject: [RFC] Re: TP link MR3220 status, boot from flash via u-boot question X-BeenThere: freebsd-mips@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Porting FreeBSD to MIPS List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 31 Mar 2011 21:57:49 -0000 On Thu, 31 Mar 2011 14:26:40 +0200 Milan Obuch wrote: > On Thu, 31 Mar 2011 18:39:36 +0800, Adrian Chadd > wrote: > > > Hi, > > > > I've got freebsd working on the WR-1043ND which is a tplink 11n > > router w/ uboot. I'll go find my notes and put them online, along > > with a config file and whatever else is needed. > > > > Hi, > I am watching freebsd-wifi-build on googlecode and just noticed new > config there... Is your 11n wifi already working too? I would be glad > to compare your results with mine, so we could unify our efforts. > Right now, kernel load from flash in u-boot is a show stopper for me, > so if you could address this one first, it would help me really much. Draft for wiki page 'Run from NOR flash with U-Boot' Keywords: U-Boot, embedded 1. Ask U-Boot: "what do you support to boot?" Normally, U-Boot use special image for kernel/ramfs packing. But we need to know which compression support U-Boot that fleshed to our target board. First way: use mkimage utility (/usr/ports/devel/u-boot) and make test images for all supported by mkimage compression types. mkimage -A ${TARGET} -O linux -T kernel \ -C ${COMPRESSION_TYPE} \ -a ${RAM_START_ADDRESS} \ -e ${RAM_START_ADDRESS} \ -n 'FreeBSD Kernel Image' \ -d SOME_SMALL_FILE_NAME \ test.uboot Then for each file, do transfer to board and run from image with `bootm' command. And check what U-Boot answer you, if answer like "Unimplemented compression type ?", then you know :). Second way: >From running Linux or U-Boot get first 64k block from kernel partition in flash. Break your mkimage utility: avoid exit when we do "show info" (key -i) CRC failed. And check compression type of 64k file we get from device. Or just delete U-Boot image header from file dd if=64k.file of=just_kern bs=64 skip=1 and check with file(1) utility 2. Create image 2.1. More canonical way, we have mkimage, gzip or bz2 and compiled kernel, maybe kernel.bin also. gzip --best --force vmlinux.bin for ELF kernel: mkimage -A mips -O linux -T kernel \ -C gzip \ -a ${LOAD_ADDRESS} \ -e ${START_ADDRESS} \ -n 'FreeBSD Kernel Image' \ -d kernel \ kernel.uboot LOAD_ADDRESS - in most cases this is RAM base address START_ADDRESS = LOAD_ADDRESS + ELF_HEADER_SIZE (0x1000 for ELF image) for kernel.bin: LOAD_ADDRESS = RAM_BASE_ADDRESS + 0x1000 START_ADDRESS = RAM_BASE_ADDRESS + 0x1000 Don't forget to check/change KERNLOADADDR of kernel config file. KERNLOADADDR must be equal to START_ADDRESS. 2.2. Longest way, but have smallest footprint, used only if U-Boot support LZMA. Problem 1: Current version of mkimage from ports, don't support LZMA. So we need new: http://my.ddteam.net/files/u-boot.new.tar.gz Problem 2: Devices I know support only old LZMA. I use LZMA 4.17. Then mkimage, like in 2.2., but -C lzma. 3. Now we have kernel U-Boot image, so transfer it to device and try with `bootm' command. 4. If all fine, write image to flash kernel partition. Hope this help :) > > > I'll have to commit a dirty hack to the kernel config to let users > > set the flash address to yank the ethernet MAC address from. Ew. > > > > I've got most of my patches from Luiz (loos), maybe you are in contact > already... I use already the same MAC as other firmwares do. > > Regards, > Milan > _______________________________________________ > freebsd-mips@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-mips > To unsubscribe, send any mail to > "freebsd-mips-unsubscribe@freebsd.org" Wait for comments! WBW -- Aleksandr Rybalko