somersetian
Posts: 4
Joined: Wed Jan 16, 2013 10:42 am

lesson OK01 SD card confusion

Wed Jan 16, 2013 10:53 am

I have a question about running the successfully assembled code in the first lesson of the online Cambridge University assembler course for the Raspberry Pi. I'm confused as to how to follow the instructions in the following paragraph:
"To install your operating system, first of all get a Raspberry PI SD card which has an operating system installed already. If you browse the files in the SD card, you should see one called kernel.img. Rename this file to something else, such as kernel_linux.img. Then, copy the file kernel.img that make generated onto the SD Card. You've just replaced the existing operating system with your own. To switch back, simply delete your kernel.img file, and rename the other one back to kernel.img. I find it is always helpful to keep a backup of you original Raspberry Pi operating system, in case you need it again."
The formatted card can't be ready by my windows PC and presumably I can't edit the card actually being used by the Pi? Or can I? Is the SD card just used to booth and thereafter I can replace the kernel.img file, provided I have another card to boot with later?
Thanks in advance for any replies. Its been a long, long time since I did anything like this!

User avatar
DexOS
Posts: 876
Joined: Wed May 16, 2012 6:32 pm
Contact: Website

Re: lesson OK01 SD card confusion

Wed Jan 16, 2013 2:01 pm

You can edit the SD card from windows, has it has a fat32 partition, that includes a file called kernel.img, rename this and add the one you made from the tuts to the SD card (the one called kernel.img), then place the card in the pi, then power the Pi on.

You can also format your own card, if you do not want to use a linux image SD card, if so, just ask and we can give you a how too.
Batteries not included, Some assembly required.

somersetian
Posts: 4
Joined: Wed Jan 16, 2013 10:42 am

Re: lesson OK01 SD card confusion

Wed Jan 16, 2013 2:15 pm

Hmmm, I haven't been able to read the card with my windows pc since following the original Raspberry Pi setup instructions - and I've done this with three PIs now. I wonder what I'm doing wrong. The cards can be read prior to writing the image file. I have a fourth Pi now so I'll set that one nice and slowly and try to figure out what's going wrong.

With regards to the instructions you mention, yes please!

User avatar
DexOS
Posts: 876
Joined: Wed May 16, 2012 6:32 pm
Contact: Website

Re: lesson OK01 SD card confusion

Wed Jan 16, 2013 2:41 pm

This will only work for those tuts.
First go here: https://github.com/raspberrypi/firmware ... aster/boot
Get the files
start.elf
bootcode.bin
Format your SD card to fat32 under windows, then add the two above files, plus the kernel.img you make with the tut.
Thats it, put it in the pi and power up your pi

Note: the above file can be put on the SD card like any other files under windows, just copy and past to the card.
Also you will need to add a txt file to the card (just use note pad).
Call it config.txt ,in it write
kernel_old=1

And put it on the SD card along with the other files.
This will make all the tuts work.
Hope this helps.
Batteries not included, Some assembly required.

somersetian
Posts: 4
Joined: Wed Jan 16, 2013 10:42 am

Re: lesson OK01 SD card confusion

Wed Jan 16, 2013 3:38 pm

Thanks very much for both replies. Can't wait to get home, fix this and get that LED flashing!

User avatar
DexOS
Posts: 876
Joined: Wed May 16, 2012 6:32 pm
Contact: Website

Re: lesson OK01 SD card confusion

Wed Jan 16, 2013 5:49 pm

somersetian wrote:Thanks very much for both replies. Can't wait to get home, fix this and get that LED flashing!
Your welcome, let use know if you get it working OK.
Also once you have completed Baking tuts, you may want to try my tuts
http://www.dex-os.com/DexBasic/DexBasic.htm

Its assembly coding, that uses macros to hide the low levelness of assembly.
Batteries not included, Some assembly required.

somersetian
Posts: 4
Joined: Wed Jan 16, 2013 10:42 am

Re: lesson OK01 SD card confusion

Thu Jan 17, 2013 12:29 am

No luck. I did a long format of a new SD card to FAT32 this time and then wrote the image to the SD card as per the Raspberry Pi setup instructions. I could see the files on the SD card immediately after this in Windows. Upon taking it out of the drive of the windows machine and putting it back, Windows can't recognise the file system and wants me to format it Still no LED flash. :(

User avatar
aTao
Posts: 1086
Joined: Wed Dec 12, 2012 10:41 am
Location: Howlin Eigg

Re: lesson OK01 SD card confusion

Thu Jan 17, 2013 12:54 am

somersetian wrote:No luck. I did a long format of a new SD card to FAT32 this time and then wrote the image to the SD card as per the Raspberry Pi setup instructions. I could see the files on the SD card immediately after this in Windows. Upon taking it out of the drive of the windows machine and putting it back, Windows can't recognise the file system and wants me to format it Still no LED flash. :(
When you put your kernel.img file onto the card use drag and drop in file manager, do not use the disk imager program.
Also you should "eject" the card before removing it from the windows machine, otherwise there may be some files that have not finished writing as you unplug the card.
>)))'><'(((<

Return to “Bare metal, Assembly language”