#57792 - 11/01/2002 03:37
Hijack self-flashing kernel image hack suggestion
|
old hand
Registered: 30/04/2001
Posts: 745
Loc: In The Village or sometimes: A...
|
I've just been playing with v116.
Now that kernel ftp support is on place I was wondering if this suggestion for a potentially useful Hijack request might be useful to others.
I suggest that we add a special device either to the kernel or [more simply] just have a special device name reserved within the ftp process in the Hijack kernel that allows us to upload .zimage files to the empeg via ftp.
This special device name is used by the hijack kernel to upload the zimage files containing the kernel image to be flashed.
The zimage file being ftp'ed is then 'received' by the kernel and buffered [in memory as the disks are probably mounted ro] .
Once the zimage file is all received its then checked for validity [doing some basic checks on the .zimage file - I am not sure what if any checks are done other than its a empeg kernel image].
Once the file is verified as all ok, the kernel then opens /dev/flash [and whatever devices] and does whatever Tony Fabris's upload program does to erase and reprogram the kernel flash area - but this is done on the empeg, by the kernel itself. So it becomes a self-flashing system.
[then of coruse it reboots itself].
This would mean that we could upload future upgrades to the kernel ala Hijack by simply ftp'ing the zimage file to /dev/kernel_flash or whatever its called.
I would rather that the kernel do this as its available 'in the box' once you have a Hijack kernel later than v117 or whatever implements this feature.
For major upgrades that changes files on the Empeg then the emplode upgrade process would still be used, but for the kernel changes in between these releases being able to ftp the files would mean we can install hijack kernel updates in empegs even if they are in the home docking stations etc.
I've seen other embedded devices offer similar capabilities and the usual caveats apply - like if you lose power half way through - but the same caveats apply now via the serial updates.
In my experience provided the flash routines are pretty failsafe theres not much that can go wrong.
Any comments?
|
Top
|
|
|
|
#57793 - 11/01/2002 07:14
Re: Hijack self-flashing kernel image hack suggestion
[Re: number6]
|
member
Registered: 06/12/2000
Posts: 192
Loc: Bucks UK
|
I agree with the idea, I would like to loose the serial connection for most purposes. However, this would probably only be useful for the Hijack uploads themselves as the full .upgrade file does more than just reflash.
It would be a nice feature but it is down to Mr Lords Copious Free Time.
_________________________
MK2 smoked 32Gb S/n 090000949
MK2a Blue 20GB racked and out of sync
|
Top
|
|
|
|
#57794 - 11/01/2002 08:06
Re: Hijack self-flashing kernel image hack suggestion
[Re: number6]
|
pooh-bah
Registered: 13/09/1999
Posts: 2401
Loc: Croatia
|
I second this!
_________________________
Dragi "Bonzi" Raos
Q#5196
MkII #080000376, 18GB green
MkIIa #040103247, 60GB blue
|
Top
|
|
|
|
#57795 - 11/01/2002 11:13
Re: Hijack self-flashing kernel image hack suggestion
[Re: number6]
|
carpal tunnel
Registered: 20/12/1999
Posts: 31600
Loc: Seattle, WA
|
The ability to install upgrades over USB and Ethernet using the upload-then-self-flash method is something that the empeg guys have been planning on implementing natively for a while now.
The HSX-109 already does this quite well, it can even go out and grab the latest version from the web via broadband ethernet link.
Dunno when we'll see it happen on the car player, but the fact that it works on the HSX is promising.
|
Top
|
|
|
|
#57796 - 12/01/2002 23:09
Flashing kernels over ethernet(!)
[Re: number6]
|
carpal tunnel
Registered: 29/08/2000
Posts: 14496
Loc: Canada
|
>I suggest that we add a special device either to the kernel
>or [more simply] just have a special device name
>reserved within the ftp process in the Hijack kernel that
>allows us to upload .zimage files to the empeg via ftp.
Well.. this turns out to be extremely easy.. since the Empeg boys have already done it for us (Thanks, Hugo!).
Flashing A Kernel via Ethernet:
(1) Prepare the player: this needs to be done just once:
-- install the developer software image
-- install a Hijack kernel (v119+ recommended) the "hard way", and reboot.
-- login over the serial port (hit 'q').
-- type this command:rw && mknod /dev/flash_kernel b 60 8 && ro && sync && exit
(2) Once you have done the prep work (once ever per Empeg unit.. dunno if upgrades will wipe it out or not), you can flash new (Hijack!) kernels at will using FTP:
-- ftp empeg
-- put zImage /dev/kernel_flash
-- quit
(3) wait 10 seconds (the flash write may happen asynchronously).
(4) reboot the empeg from the Hijack menu, or by cycling the power.
Cheers
-ml
|
Top
|
|
|
|
#57797 - 12/01/2002 23:25
Re: Flashing kernels over ethernet(!)
[Re: mlord]
|
carpal tunnel
Registered: 29/08/2000
Posts: 14496
Loc: Canada
|
On further experimentation, this seems to have a success rate of about one in two or one in three.. not sure why. But worst case, one might have to reflash the kernel via the serial link.
You can verify a freshly programmed kernel by reading back from /dev/flash_kernel over FTP.. the file you read back will be larger than the original kernel zImage, so only compare the bytes up to the size of your zImage file.
-ml
|
Top
|
|
|
|
#57798 - 13/01/2002 00:18
Re: Flashing kernels over ethernet(!)
[Re: mlord]
|
carpal tunnel
Registered: 29/08/2000
Posts: 14496
Loc: Canada
|
Okay, after playing with it some more, it appears to be just a "sync()" issue. I've added a "sys_sync()" invocation to Hijack v120, which will get done after each FTP session finished (after you QUIT from FTP). But even without it, things are reliable enough so long as one does a readback after writing to flash.
For my own use, I have a shell script that ftp's a kernel to the empeg, reads it back again, and compares the readback to the original. Works great! Much faster than the slow serial downloads..
|
Top
|
|
|
|
#57799 - 13/01/2002 00:20
Re: Flashing kernels over ethernet(!)
[Re: mlord]
|
carpal tunnel
Registered: 29/08/2000
Posts: 14496
Loc: Canada
|
FTP burn & verify shell script (UNIX) attached.
-ml
Attachments
56556-empflash.sh (101 downloads)
|
Top
|
|
|
|
#57800 - 13/01/2002 05:05
Re: Flashing kernels over ethernet(!)
[Re: mlord]
|
stranger
Registered: 23/12/2001
Posts: 67
Loc: UK
|
Step 2 has a typo, should be /dev/flash_kernel
_________________________
Vince, UK
RioCar 20GB + 20GB, tuner & stalk, 5 x Audio Receivers
|
Top
|
|
|
|
#57801 - 13/01/2002 16:55
Re: Flashing kernels over ethernet(!)
[Re: mlord]
|
carpal tunnel
Registered: 27/06/1999
Posts: 7058
Loc: Pittsburgh, PA
|
Mark, mind if I throw this stuff on the developer info section on riocar.org?
|
Top
|
|
|
|
#57802 - 13/01/2002 21:30
Re: Flashing kernels over ethernet(!)
[Re: tonyc]
|
carpal tunnel
Registered: 29/08/2000
Posts: 14496
Loc: Canada
|
Go for, if you haven't already.
Especially the shell script.. that's how I download new kernels for testing nowadays.. MUCH faster than serial.
-ml
|
Top
|
|
|
|
#57803 - 16/01/2002 11:31
Re: Flashing kernels over ethernet(!)
[Re: mlord]
|
carpal tunnel
Registered: 19/05/1999
Posts: 3457
Loc: Palo Alto, CA
|
We should probably put the correct device nodes on the player in the first place... I'll make a note for the next release...
Hugo
|
Top
|
|
|
|
#57804 - 16/01/2002 13:01
Re: Flashing kernels over ethernet(!)
[Re: altman]
|
carpal tunnel
Registered: 29/08/2000
Posts: 14496
Loc: Canada
|
Yeah.
For now, hijack just creates a device node under /proc/ so that everyone has access to it without fiddling.
/proc/empeg_kernel
Cheers
-ml
|
Top
|
|
|
|
#57805 - 18/01/2002 02:49
Re: Flashing kernels over ethernet(!)
[Re: tonyc]
|
member
Registered: 06/12/2000
Posts: 192
Loc: Bucks UK
|
Hi Tony,
FYI.
When you put this on RioCar.org you put the typo in step 2 aswell.
_________________________
MK2 smoked 32Gb S/n 090000949
MK2a Blue 20GB racked and out of sync
|
Top
|
|
|
|
#57806 - 18/01/2002 02:56
Re: Flashing kernels over ethernet(!)
[Re: vince]
|
member
Registered: 06/12/2000
Posts: 192
Loc: Bucks UK
|
I have tried this using cuteFTP Pro 2...No luck.
If I CWD to /dev, I do not see the flash_kernel folder to put the zImage file into.
Any suggestions?
_________________________
MK2 smoked 32Gb S/n 090000949
MK2a Blue 20GB racked and out of sync
|
Top
|
|
|
|
#57807 - 18/01/2002 03:59
Re: Flashing kernels over ethernet(!)
[Re: Dava]
|
carpal tunnel
Registered: 08/06/1999
Posts: 7868
|
This has since been changed to /proc/empeg_kernel. The dev entry had to be manually created to be able to flash it.
|
Top
|
|
|
|
#57808 - 18/01/2002 04:17
Re: Flashing kernels over ethernet(!)
[Re: drakino]
|
member
Registered: 06/12/2000
Posts: 192
Loc: Bucks UK
|
Huh ???
I don't seem to have a /proc/empeg_kernel either.
In /proc I have load of directories from 1 to 7 , 25-39 and bus,fs,ide,scsi etc.....
_________________________
MK2 smoked 32Gb S/n 090000949
MK2a Blue 20GB racked and out of sync
|
Top
|
|
|
|
#57809 - 18/01/2002 06:18
Re: Flashing kernels over ethernet(!)
[Re: mlord]
|
enthusiast
Registered: 05/09/2000
Posts: 210
Loc: Ipswich, MA
|
This never seems to work for me, is it perhaps an ascii vs binary problem?
_________________________
___
John Turner
"It's easier to ask for forgiveness than to ask for permission"
|
Top
|
|
|
|
#57810 - 18/01/2002 07:41
Re: Flashing kernels over ethernet(!)
[Re: jwtadmin]
|
carpal tunnel
Registered: 29/08/2000
Posts: 14496
Loc: Canada
|
Assuming you have a very recent Hijack kernel installed, you should be able to flash the next (newer) ones using:
ftp myempeg
binary
put v135.hijack...zImage /proc/empeg_kernel
If this fails, then try pausing your music player while flashing (hit pause on the remote first). Replace the "v135.hijack...zImage" with the actual filename of the Hijack kernel.
If you can burn a kernel over the serial link, then the above will also work. Unless you're using one of those windows ftp clients that crashes hijack (bug I just fixed in v135, so okay after that..).
Cheers
|
Top
|
|
|
|
#57811 - 18/01/2002 07:45
Re: Flashing kernels over ethernet(!)
[Re: Dava]
|
carpal tunnel
Registered: 29/08/2000
Posts: 14496
Loc: Canada
|
If you don't see /proc/empeg_kernel on your player (not your host), then it's because (1) you don't have Hijack installed yet, or (2) your version of Hijack is too old, or (3) you're going blind from too much personal self-adoration.
-ml
|
Top
|
|
|
|
#57812 - 18/01/2002 07:47
Re: Flashing kernels over ethernet(!)
[Re: mlord]
|
enthusiast
Registered: 05/09/2000
Posts: 210
Loc: Ipswich, MA
|
Hey that works now!!!
Thanks!
_________________________
___
John Turner
"It's easier to ask for forgiveness than to ask for permission"
|
Top
|
|
|
|
#57813 - 18/01/2002 07:56
Re: Flashing kernels over ethernet(!)
[Re: mlord]
|
member
Registered: 06/12/2000
Posts: 192
Loc: Bucks UK
|
Oooo, ya cheeky monkey(3).
Well I CAN see it when connected serially, not through cuteFTP though..
Why would that be?
_________________________
MK2 smoked 32Gb S/n 090000949
MK2a Blue 20GB racked and out of sync
|
Top
|
|
|
|
#57814 - 18/01/2002 08:03
Re: Flashing kernels over ethernet(!)
[Re: Dava]
|
carpal tunnel
Registered: 29/08/2000
Posts: 14496
Loc: Canada
|
>Well I CAN see it when connected serially, not through cuteFTP though
Well, /proc/empeg_kernel is configured as a "block device", which perhaps your "view" options in CuteFTP are set to ignore ("hide system files" or some such thing..).
-ml
|
Top
|
|
|
|
#57815 - 18/01/2002 08:45
Re: Flashing kernels over ethernet(!)
[Re: mlord]
|
member
Registered: 06/12/2000
Posts: 192
Loc: Bucks UK
|
Hmm I thought that...checked.... it says show hidden/system files?????
So I downloaded SmartFTP (seems good and is freeware) same thing, no /proc/empeg_kernel. Checked the view settings, same thing. All looks OK but can't see it.
Should a block device show up as a folder or file?
Oh, and another thing, sorry but initial.C still does not work for me in the latest build.
Thanks,
Mr Whinging Git (UK)
_________________________
MK2 smoked 32Gb S/n 090000949
MK2a Blue 20GB racked and out of sync
|
Top
|
|
|
|
#57816 - 18/01/2002 10:57
Re: Flashing kernels over ethernet(!)
[Re: Dava]
|
carpal tunnel
Registered: 29/08/2000
Posts: 14496
Loc: Canada
|
Devices should show up as "files".
Getting your GUI to work properly is your problem.
Cheers
|
Top
|
|
|
|
#57817 - 18/01/2002 12:17
Re: Flashing kernels over ethernet(!)
[Re: Dava]
|
old hand
Registered: 30/07/2000
Posts: 879
Loc: Germany (Ruhrgebiet)
|
Hi.
Might be a completely stupid question, but as /proc/empeg_kernel shows up in SmartFTP on my empeg with the latest hijack kernel: Did you reboot the player after flashing the new kernel?
cu,
sven
_________________________
proud owner of MkII 40GB & MkIIa 60GB both lit by God and HiJacked by Lord
|
Top
|
|
|
|
#57818 - 18/01/2002 15:41
Re: Flashing kernels over ethernet(!)
[Re: Dava]
|
carpal tunnel
Registered: 29/08/2000
Posts: 14496
Loc: Canada
|
>Oh, and another thing, sorry but initial.C still
>does not work for me in the latest build.
Okay try initial.H and initial.C in v136.
In particular, I've noticed the player seems to toss the first few IR codes after startup, even when they come from the RIO remote directly.
So.. just prefix your initial sequence(s) with ffffff.L,ffffff.L and then they should work fine (they did for me).
initial.C=ffffff.L,ffffff.L,20bf1c,...
Does anyone else use this feature? It's causing me a ton of grief and I'd like to remove it..
Cheers
-ml
|
Top
|
|
|
|
#57819 - 21/01/2002 02:59
Re: Flashing kernels over ethernet(!)
[Re: mlord]
|
member
Registered: 06/12/2000
Posts: 192
Loc: Bucks UK
|
Hi Mark,
Perfect, all of my problems are solved. I can now see /proc/empeg_kernel, I can replace it and it flashes.
With v136 initial.C and initial.H both work perfectly (maybe you could leave them in now?)
I am sorry they were causing you a headache. I promise not to bother you for another 3 revisions of Hijack (propably 12 hours or so.)
Keep up the good work.
_________________________
MK2 smoked 32Gb S/n 090000949
MK2a Blue 20GB racked and out of sync
|
Top
|
|
|
|
#57820 - 10/02/2002 09:04
Re: Flashing kernels over ethernet(!)
[Re: mlord]
|
journeyman
Registered: 26/12/2001
Posts: 87
Loc: SF Bay Area
|
This may be a dumb question but, can this be used for the .upgrade files too?
Uploading hijack is not that slow, but upgrading the main kernel is very slow.
_________________________
MkIIa [blue]BLUE[/blue]
|
Top
|
|
|
|
#57821 - 10/02/2002 09:08
Re: Flashing kernels over ethernet(!)
[Re: jloew]
|
carpal tunnel
Registered: 10/06/1999
Posts: 5916
Loc: Wivenhoe, Essex, UK
|
It cannot currently be done for .upgrade files, the only way of applying them is via the serial port. In theory code could be added to the kernel to enable .upgrade files to be applied via Ethernet as well, but I doubt if that is likely to ever happen.
_________________________
Remind me to change my signature to something more interesting someday
|
Top
|
|
|
|
#57822 - 10/02/2002 09:49
Re: Flashing kernels over ethernet(!)
[Re: andy]
|
carpal tunnel
Registered: 20/12/1999
Posts: 31600
Loc: Seattle, WA
|
I think it would be a neat feature to add to hijack. Temporarily unpack the upgrade file to empeg/var, replace the player partition, then remove the temp file from var.
The only tricky part is that hijack would be unable to flash itself out of existence to replace the kernel contained in the upgrade file. This would actually be OK if you made sure the .upgrade file and the currently-installed hijack were compatible.
|
Top
|
|
|
|
#57823 - 10/02/2002 10:28
Re: Flashing kernels over ethernet(!)
[Re: tfabris]
|
carpal tunnel
Registered: 29/08/2000
Posts: 14496
Loc: Canada
|
Actually, the kernel currnntly DOES flash itself "out of existance" with the existing mechanism.. the flash copy can be replaced while running with no issues.
An ethernet upgrader is not so much a Hijack project, as a project for the platform from which it will be run (Linux, Windows, Java). The bits and pieces needed to support it are already mostly in place in Hijack (or perhaps ALL of them are in place).
(1) overwrite a filesystem with a new image: just FTP to /dev/hd*
(2) upgrade kernel: already there
(3) reboot: already there
I'm not that familiar with the other steps.. what else is there?
Cheers
|
Top
|
|
|
|
|
|