Welcome! Log In Create A New Profile

Advanced

How to convert zImage to Image for GoFLEX Home

Posted by habibie 
How to convert zImage to Image for GoFLEX Home
April 24, 2018 12:29PM
Bodhi,

Looks like ARCH Linux ARM (ALARM) has this ArchLinuxARM-armv5-latest.tar.gz and this ArchLinuxARM-kirkwood-latest.tar.gz. I am not sure what are differences between the two. I use the later one and that gives me problems, i.e. no SSH, can't detect SATA HDD, etc. Its /boot directory also contains no kirkwood-goflexhome.dtb file. OTOH, the former (ArchLinuxARM-armv5-latest.tar.gz) does contain the dtbs/kirkwood-goflexhome.dtb file with zImage (no uImage) file in its /boot directory. At any rate, I tried to boot my GoFLEX Home with the former. In that, I have to generate the uImage file from the available zImage as shown below. However, my GoFLEX Home just boots with a solid red LED. Perhaps, I did something incorrect in uImage generation. Can you please help?
mkimage -A arm -O linux -T kernel -C none -a 0x00008000 -e 0x00008000 -n "Arch Linux ARM" -d zImage uImage

I don't have a serial console setup, but just netconsole which is shown below.
U-Boot 2017.07-tld-1 (Sep 05 2017 - 00:21:31 -0700)
Seagate GoFlex Home
gcc (Debian 6.3.0-18) 6.3.0 20170516
GNU ld (GNU Binutils for Debian) 2.28
Hit any key to stop autoboot:  0 
starting USB...
USB0:   USB EHCI 1.00
scanning bus 0 for devices... 2 USB Device(s) found
       scanning usb for storage devices... 
Use USB retry period from the environment: 15 second(s)
1 Storage Device(s) found

Reset IDE: ide_preinit failed
Unknown command 'mmc' - try 'help'

Partition Map for USB device 0  --   Partition Type: DOS

Part    Start Sector    Num Sectors     UUID            Type
  1     2048            7890944         04dd5721-01     83 Boot

## Unknown partition table type 0

## Unknown partition table type 0

## Unknown partition table type 0

## Unknown partition table type 0

## Unknown partition table type 0

## Unknown partition table type 0
loading envs from usb 0 ...
82 bytes read in 384 ms (0 Bytes/s)

no IDE devices available
Unknown command 'mmc' - try 'help'
importing envs ...
running scan_disk ...
Scan device usb
device usb 0:1
1 bytes read in 416 ms (0 Bytes/s)
Found bootable drive on usb 0
loading uImage ...
4143952 bytes read in 617 ms (6.4 MiB/s)
loading uInitrd ...
** File not found /boot/uInitrd **
loading DTB /boot/dtbs/kirkwood-goflexhome.dtb ...
10271 bytes read in 2922 ms (2.9 KiB/s)
## Booting kernel from Legacy Image at 00800000 ...
   Image Name:   Arch Linux ARM
   Created:      2018-04-24  17:03:36 UTC
   Image Type:   ARM Linux Kernel Image (uncompressed)
   Data Size:    4143888 Bytes = 4 MiB
   Load Address: 00008000
   Entry Point:  00008000
   Verifying Checksum ... OK
## Flattened Device Tree blob at 01c00000
   Booting using the fdt blob at 0x1c00000


Starting kernel ...

Below is the output from printenv.
U-Boot 2017.07-tld-1 (Sep 05 2017 - 00:21:31 -0700)
Seagate GoFlex Home
gcc (Debian 6.3.0-18) 6.3.0 20170516
GNU ld (GNU Binutils for Debian) 2.28
Hit any key to stop autoboot:  3 
 0 
GoFlexHome> printenv
printenv
arcNumber=3338
bootcmd=run bootcmd_uenv; run scan_disk; run set_bootargs; run bootcmd_exec
bootcmd_exec=run load_uimage; if run load_initrd; then if run load_dtb; then bootm $load_uimage_addr $load_initrd_addr $load_dtb_addr; else bootm $load_uimage_addr $load_initrd_addr; fi; else if run load_dtb; then bootm $load_uimage_addr - $load_dtb_addr; else bootm $load_uimage_addr; fi; fi
bootcmd_uenv=run uenv_load; if test $uenv_loaded -eq 1; then run uenv_import; fi
bootdelay=3
bootdev=usb
device=0:1
devices=usb ide mmc
disks=0 1 2 3
dtb_file=/boot/dts/kirkwood-goflexhome.dtb
ethact=egiga0
ethaddr=52:3b:20:9c:11:51
if_netconsole=ping $serverip
ipaddr=192.168.1.89
led_error=orange blinking
led_exit=green off
led_init=green blinking
load_dtb=echo loading DTB $dtb_file ...; load $bootdev $device $load_dtb_addr $dtb_file
load_dtb_addr=0x1c00000
load_initrd=echo loading uInitrd ...; load $bootdev $device $load_initrd_addr /boot/uInitrd
load_initrd_addr=0x1100000
load_uimage=echo loading uImage ...; load $bootdev $device $load_uimage_addr /boot/uImage
load_uimage_addr=0x800000
machid=0x831
mainlineLinux=yes
mtdids=nand0=orion_nand
mtdparts=mtdparts=orion_nand:1M(u-boot),4M(uImage),32M(rootfs),-(data)
ncip=192.168.1.87
partition=nand0,2
preboot=run if_netconsole start_netconsole
scan_disk=echo running scan_disk ...; scan_done=0; setenv scan_usb "usb start";  setenv scan_ide "ide reset";  setenv scan_mmc "mmc rescan"; for dev in $devices; do if test $scan_done -eq 0; then echo Scan device $dev; run scan_$dev; for disknum in $disks; do if test $scan_done -eq 0; then echo device $dev $disknum:1; if load $dev $disknum:1 $load_uimage_addr /boot/uImage 1; then scan_done=1; echo Found bootable drive on $dev $disknum; setenv device $disknum:1; setenv bootdev $dev; fi; fi; done; fi; done
serverip=192.168.1.87
set_bootargs=setenv bootargs console=ttyS0,115200 root=LABEL=rootfs rootdelay=10 $mtdparts $custom_params
start_netconsole=setenv ncip $serverip; setenv bootdelay 3; setenv stdin nc; setenv stdout nc; setenv stderr nc; version;
stderr=nc
stdin=nc
stdout=nc
uenv_addr=0x810000
uenv_import=echo importing envs ...; env import -t $uenv_addr $filesize
uenv_init_devices=setenv init_usb "usb start";  setenv init_ide "ide reset";  setenv init_mmc "mmc rescan"; for devtype in $devices; do run init_$devtype; done;
uenv_load=run uenv_init_devices; setenv uenv_loaded 0; for devtype in $devices;  do for disknum in 0; do run uenv_read_disk; done; done;
uenv_read=echo loading envs from $devtype $disknum ...; if load $devtype $disknum:1 $uenv_addr /boot/uEnv.txt; then setenv uenv_loaded 1; fi
uenv_read_disk=if test $devtype -eq mmc; then if $devtype part; then run uenv_read;  fi; else if $devtype part $disknum; then run uenv_read; fi;  fi
usb_ready_retry=15

Environment size: 2863/131068 bytes
GoFlexHome>

My /boot/uEnv.txt is shown below. Note, unlike debian ARM, ALARM stores its dtb files under /boot/dtbs directory.
dtb_file=/boot/dtbs/kirkwood-goflexhome.dtb
devices=usb ide
disks=0 1 2 3 4 5 6 7
Re: How to convert zImage to Image for GoFLEX Home
April 24, 2018 07:05PM
habibie,

In this run, the rootfs was not mounted successfully. Because you did not have the kernel file uInitrd in /boot:

> loading uInitrd ...
> ** File not found /boot/uInitrd **

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
Re: How to convert zImage to Image for GoFLEX Home
April 24, 2018 09:15PM
Bodhi, since the ArchLinuxARM-armv5-latest.tar.gz does not come with an initramfs-linux.img, then is it safe to say this is not possible to generate uInitrd?
Re: How to convert zImage to Image for GoFLEX Home
April 25, 2018 12:07PM
Bodhi,

I found this initramfs-util (gitHUB source) and thought it can be used to generate initramfs from a zImage file. When I gave it a try on my OpenSuSE Linux desktop computer, it gave me some error message as shown below. Can you give it a try on your Linux desktop computer to see if it will also give the same error messages?
grep: invalid UTF-8 string
-I- Extracting kernel image from zImage (start = )
dd: invalid number: ‘’

gzip: stdin: unexpected end of file
grep: invalid UTF-8 string
-I- Already uncompressed cpio.img, not decompressing
/home/local/devel/software/initramfs-utils_git/extract_initramfs.sh: line 33: 10-: syntax error: operand expected (error token is "-")
/home/local/devel/software/initramfs-utils_git/extract_initramfs.sh: line 34: ((: < 0: syntax error: operand expected (error token is "< 0")
-I- Extracting initramfs image from /tmp/kernel.img (start = , end = 10)
dd: invalid number: ‘’
Re: How to convert zImage to Image for GoFLEX Home
April 25, 2018 06:19PM
habibie,

> it safe to say this is not possible to generate
> uInitrd?

It is possible. Just copy the one you already have on other rootfs over to the rootfs you want to use. There is not much in ALARM initrd so they could be used without much problem (if at all). Debian initrd is different in that I've configured many modules in it (by kernel config).

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
Author:

Your Email:


Subject:


Spam prevention:
Please, enter the code that you see below in the input field. This is for blocking bots that try to post this form automatically. If the code is hard to read, then just try to guess it right. If you enter the wrong code, a new image is created and you get another chance to enter it right.
Message: