Flashing WCE7 from USB on CCWi-i.MX53 JSK, uBoot - usb

I have tried over at the digi forum, but I'm thinking that here is where all the clever people are :-)
I’m working on a CCWi-i.MX53 JSK. What I’m trying to figure out is - as you might have guessed - to flash a WCE image from an USB stick.
Based on
http://www.digi.com/support/kbase/kbaseresultdetl?id=3305
and
http://www.digi.com/support/forum/40385/mx53-jsk-with-windowc-how-boot-new-wce-from-microsd-using-uboot
my best guess is to either just
dboot wce usb 0:1 fat wce-CCXMX53
or setting the U-Boot command like
setenv bootcmd dboot wce usb 0:1 fat wce-CCXMX53
saveenv
reboot
None of the methods works for me. I’m getting:
Unknown command 'usb' - try 'help'
command usb reset failed
I’m using a freshly formatted FAT32 USB stick with only the wce-CCXMX53 file on it, in either of the J10 USB plugs.
Any help will be greatly appreciated. Thanks in advance!
Sidenote: dboot usage:
CCWMX53 # ? dboot
dboot - Digi modules boot commands
Usage:
dboot <os> [source] [extra-args...]
Description: Boots <os> via <source>
Arguments:
- os: a partition name or one of the reserved names:
linux|android|wce|netos|eboot
- [source]: tftp (default)|flash|nfs|usb|mmc|hsmmc|sata|ram
- [extra-args]: extra arguments depending on 'source'
source=tftp|nfs -> [filename]
- filename: file to transfer (required if using a partition name)
source=usb|mmc|hsmmc|sata -> [device:part filesystem] [filename]
- device:part: number of device and partition
- filesystem: fat|vfat|ext2|ext3
- filename: file to transfer
source=ram -> [image_address] [initrd_address] [initrd_max_size]
- image_address: address of image in RAM (default: linuxloadaddr, netosloadaddr, etc)
- initrd_address: address of initrd image (default: loadaddr_initrd)
- initrd_max_size: max. allowed ramdisk size (in kB) to pass to the kernel (default: kernel default)
If <os> is 'wce' the following bootargs are possible:
cleanhive

I am sorry I don't know dboot/wce. From my bootloader experience, you may play with the following command to read file from your USB stick to memory (without actually booting - losing control):
# fatload usb 1:1 (loadAddress) (bootfilename) # load your file to memory
# md (loadAddress) #dump memory content, which you can compare with your USB file
Booting process primarily comprises step1- reading an executable (OS) file from media(mmc/usb) to memory; step2- prepare environment(registers, parameter data in certain memory location, even rootfs in ramdisk...); step3- jump to the entry of executable file in step1.

Related

How can I map an address range to the ram with Qemu?

I'm trying to run an elf image for an embedded system in Qemu. I read that we can pass elf binaries to Qemu with -kernel option and it configures itself to run the code from the entry address specified in the elf header.
Qemu only allows max 256MB of ram for the specific machine type that I'm trying to emulate. But the entry address in the elf file is out of the range of address space of 256MB ram. So when I connect with gdb and read ram contents starting from the entry address, all I get is 0s.
So my question is, is there any option in the qemu to map a specific address space to the available RAM?
I ran objcopy and got a binary file but its size too large to fit into the ram of qemu(max 256MB).
No. You need to build your binary for the machine type you ask QEMU to use -- the binary and the machine must agree about where RAM and other devices are in the address map. So either pick the right machine type for the binary, or else build the binary for the machine type you want to use. You cannot run an arbitrary binary on any machine type you like.
Regarding -kernel, if you are not trying to load a Linux kernel, you may not want to use that option (though it will work for an ELF file). See this question for a summary of the ways you can ask QEMU to load guest code.

How to boot the Linux kernel with initrd or initramfs with gem5?

With QEMU, I can use either use -initrd '${images_dir}/rootfs.cpio for the initrd, or pass the initramfs image directly to -kernel Image.
But if I try the initramfs image with gem5 fs.py --kernel Image it fails with:
fatal: Could not load kernel file
with the exact same initramfs kernel image that QEMU was able to consume.
And I don't see an analogue to -initrd.
The only method that I got to work was to pass an ext2 disk image to --disk-image with the raw vmlinux.
https://www.mail-archive.com/gem5-users#gem5.org/msg15198.html
initrd appears unimplemented on arm and x86 at least, since gem5 must know how to load it and inform the kernel about it's location, and grepping initrdonly shows some ARM hits under:
src/arch/arm/linux/atag.hh
but they are commented out.
Communicating the initrd to the kernel now appears to be simply doable via the DTB chosen node linux,initrd-start and linux,initrd-end properties, so it might be very easy to implement: https://www.kernel.org/doc/Documentation/devicetree/bindings/chosen.txt (and gem5's existing DTB auto generation) + reusing the infrastructure to load arbitrary bytes to a memory location: How to preload memory with given raw bytes in gem5 from the command line in addition to the main ELF executable?
Initramfs doesn't work because gem5 can only boot from vmlinux which is the raw ELF file, and the initramfs images only gets attached by the kernel build to a more final image type like Image or bzImage which QEMU can use to boot, see also: https://unix.stackexchange.com/questions/5518/what-is-the-difference-between-the-following-kernel-makefile-terms-vmlinux-vml/482978#482978
Edit: the following is not needed anymore after the patch mentioned at: How to attach multiple disk images in a simulation with gem5 fs.py? To do this test, I also had to pass a dummy disk image as of gem5 7fa4c946386e7207ad5859e8ade0bbfc14000d91 since the scripts don't handle a missing --disk-image well, you can just dump some random 512 bytes and use them:
dd if=/dev/zero of=dummy.iso bs=512 count=1

Req. Ovftool command to overwrite memory size and CPU count described in ova file during deployment of VM

I have a OVA file(MyOvafile.ova) which contain MemorySize=16GB and CPU count=4.
I have deployed the Ovftool on VMware ESXi server.
I am using the following command to deploy the VM:
/vmfs/volumes/DataStore1/vmware-ovftool/ovftool --memorySize:15360 --name=Test_VM -dm=thin -ds=DataStore1 /vmfs/volumes/DataStore1/OVA_V5.1_BSI-8/MyOvafile.ova
Now the problem i am facing:
As i am giving MemorySize of 15360MB but after deployment VM has the same values as defined in ova file (MyOvafile.ova i.e 16GB)
My Question:
How can i change the value of MemorySize and CPU count through ovftool command?
Apparently, this seems a bug in OVFTOOL (and documentation as well).
CPU and memory cannot be overridden by OVFTOOL's corresponding parameters.
However, there is hack by modifying it in VMX file of VM (and then using reconfigure command).
1) Get VMXfile Location (ending with .vmx) :
vim-cmd vmsvc/getallvms
Vmid Name File Guest OS Version Annotation
72 Test_vm [datastore2] VM_name/VM_name.vmx rhel6_64Guest vmx-08
2) Modify vmx file (for example, using awk) for changing 'vCPUS=REQ_CPUs' entry.
3) Reconfigure .vmx file
vim-cmd vmsvc/reload <VM_ID>
Issue reported in VMware community: https://communities.vmware.com/message/2698710#2698710

Accessing USB drive form WinPE prompt

I am trying to install Windows 8 on virtual box using a bootable WinPE DVD. The image file (.wim) is on the USB stick.
But when I boot from DVD, I cannot find the USB drive.
I need to execute the command
d:\imagex.exe /apply e:\imageC_20150528.wim 1 c:\
where D - dvd drive and say E - usb drive
But I cannot locate the USB drive from the command prompt.
When I use winPE I use DiskPart to determine the drive letter of the USB drive.
-Diskpart
-list volume
This should display all available drives
If the USB drive was inserted before you booted the system into PE, then the USB drive should already be mounted and have a drive letter. If it doesn't then it is likely the drive isn't supported (you might want to change your boot-image/disk to include additional drivers/tools to get access to your usb controller and connected device).
If your USB drive was inserted after you booted the system into PE (and your hardware is supported in PE) then I usually can access the disk in the following manner (worked even in XP PE):
go to commandline and start diskpart (following commands are in diskpart):
issue command: rescan enter
This 'Locates new disks that might have been added to the computer.'
Depending on diskpart version (and/or it's automount setting) this can be enough to automatically mount the file system for a new basic volume when it adds the drive to the system and assigns a drive letter to the volume.
When it doesn't, follow the following 2 steps:
command: list disk enter
to see a list of disks and some info (to check the drive was found)
command: list volume enter
lists volumes on all disks (to find volume number of the USB drive)
command: select volume=# enter (where #= volume number)
to select the specified volume and shift the focus to it
command: assign enter
to assign the next free letter to the current focused volume
OR: assign letter=# enter (where #= driveletter of choice)
This method usually works for me on most hardware.
See also: Diskpart commandline options on MS Technet
Really - you should be using a fairly current version of winPE - 5.1 is what I'm using - which is the version that parallels windows 8.1. I'm switching over to winPE 10 (they changed the numbering to be consistent with Windows)
The reason I bring this us is because you're using imagex - and dism.exe has largely replaced imagex.exe in more current versions of winPE.
If you're just doing this at the command prompt in a generic winPE, you can use mountvol.exe (with no parameters) to discover the drive letters that are available. Everything shifts around drive-letter-wise when you're in winPE. So it might not be e: any more.
Also, dism and/or imagex would be on the x: drive - which is the virtual drive that the winPE creates when it boots.

Initrd, Ramdisk, Initramfs, uclinux

I am working on uclinux porting on coldfire board M5272C3. Right now I have kernel running from RAM with romfs as my rootfile system.
I am not clear about few terms what they mean and when to use them....
Please explain me in a simplest possible manner:
Q1: What is initrd? Why we need that?
Q2: What is ramdisk? Why and where we need this?
Q3: what is initramfs? Why and where we use this?
Q4: What is ramfs? Why and where we use this?
Also please refer document/reference book for in depth knowledge of these terms....
Thanks
Phogat
A ramdisk merely refers to an in-memory disk image. It is implemented using the ramfs VFS driver in the kernel. The contents of the ramdisk would be wiped on the next reboot or power-cycle.
I'll give you details about initrd and initramfs next.
In simple terms, both initrd and initramfs refers to an early stage userspace root filesystem (aka rootfs) that will let you run a very minimal filesystem in memory.
The documentation present at Documentation/filesystems/ramfs-rootfs-initramfs.txt part of the linux kernel source tree, which would also give you a length description of what these are.
What is initrd ?
One common case where there is the need for such an early-stage filesystem is to load driver modules for hard disk controllers. If the drivers were present on the hard drive, it becomes a chicken-and-egg problem. Having these drivers as part of this early-stage rootfs helps the kernel load the drivers for any detected hard disk controllers, before it can mount the actual root filesystem from the hard drive. Another solution to this problem would be to have all the driver modules built into the kernel, but you're going to increase the size of the kernel binary this way. This kind of filesystem image is commonly referred to as initrd. It is implemented using either ramfs or tmpfs. It is emulated using a loopback block device.
The bootloader loads the kernel image into a memory address, the initrd image into another memory address, and tells the kernel where to find the initrd, passes the boot arguments to the kernel, and passes control to the kernel to let it continue the boot process.
So how is it different from initramfs then ?
initramfs is an even earlier stage filesystem compared to initrd which is built into the kernel (controlled by the kernel config of course).
As far as I know, both initrd and initramfs are controlled by this single kernel config, but it could have been changed in the recent kernels.
config BLK_DEV_INITRD
I'm not going deep into how to build your own initramfs, but I can tell you it just uses cpio format to store the files and can be configured using usr/Kconfig while building the kernel. Even if you do not specify your own initramfs image, but have turned on support for initramfs, kernel automatically embeds a very simple initramfs containing /dev/console, /root and some other files/directories.
In addition there is also a newer tmpfs filesystem which is commonly used to implement in-memory filesystems. In fact newer kernels implement initrd using tmpfs instead of ramfs.
UPDATE:
Just happened to stumble upon a similar question
This might also be useful