Using the SDcard for storing kernels

AmigaOne X5000 platform specific issues related to Linux only.

Using the SDcard for storing kernels

Postby marcus » Thu Apr 13, 2017 6:39 pm

Hi all.

As mentioned in another thread, U-boot can not access Linux kernels stored on a hard drive that is partitioned using an AmigaOS partition table.

This is just like it was with CFE on the X1000. So on that system you would typically store the kernels on the CompactFlash card, which was FAT formatted.

So I was thinking to myself "Well, the X5000 does not have a CompactFlash card, but it does have an SDcard which is used for storing the bootloader, so why not use that to store the kernels on?".

It turns out that the SDcard does not have a partition table at all, but fortunately the first 4K are not used, so there is plently of room to add an msdos partition table. Upon inspecting the contents of the SDcard in my X5000, I found the following:

Code: Select all
--------------------------------------------------------------
| offset              | size   | contents                    |
--------------------------------------------------------------
| 00000000 - 00000fff | 4K     | zeroes                      |
| 00001000 - 04bfffff | 76M    | uboot                       |
| 04c00000 - ee7fffff | 3740M  | junk (repeating 1K pattern) |
| ee800000 - eeafffff | 3M     | zeroes                      |
--------------------------------------------------------------


So there is a big chunk of junk to cut out a partition from.

Here is how to do it:

  • Boot into Linux (using USB)
  • Backup U-Boot:
    Code: Select all
    sudo dd if=/dev/mmcblk0 bs=1M count=128 of=/tmp/uboot.bin
  • Start gparted
  • select /dev/mmcblk0
  • Pick Device / Create Partition Table...
  • select "msdos" and click Apply
  • Pick Partition / New
  • Set the settings as follows:
    • Free space preceding (MiB): 512
    • New size (MiB): Decrease until "Free space following (MiB):" is also 512
    • Align to: MiB
    • Create as: Primary Partition
    • File Systen: ext4
    • Label: SDCARD
  • Click Add.
  • Right click on the new partition, and pick Format to / ext4.
  • Then pick Edit / Apply all operations.
  • Acknowledge the warning, and wait for the operation to finish.
  • Quit gparted.
  • Restore U-Boot, while keeping the partition table:
    Code: Select all
    sudo dd if=/tmp/uboot.bin of=/dev/mmcblk0 bs=4096 skip=1 seek=1
Et voila, you now have a partition on the SDcard which can be mounted read/write from Linux, and which can be read from U-Boot (try "ext4ls mmc 0:1").
marcus
 
Posts: 53
Joined: Wed Nov 07, 2012 9:07 pm

Re: Using the SDcard for storing kernels

Postby xeno74 » Thu Apr 13, 2017 10:05 pm

@marcus

Fantastic idea! Well done! Interesting!
http://www.amigalinux.org
http://www.supertuxkart-amiga.de

Running Linux on AmigaONEs can require some tinkering.
User avatar
xeno74
 
Posts: 2939
Joined: Fri Mar 23, 2012 8:58 am

Re: Using the SDcard for storing kernels

Postby aperezbios » Fri Apr 14, 2017 5:21 pm

marcus wrote:Hi all.

As mentioned in another thread, U-boot can not access Linux kernels stored on a hard drive that is partitioned using an AmigaOS partition table.

This is just like it was with CFE on the X1000. So on that system you would typically store the kernels on the CompactFlash card, which was FAT formatted.

So I was thinking to myself "Well, the X5000 does not have a CompactFlash card, but it does have an SDcard which is used for storing the bootloader, so why not use that to store the kernels on?".


:) I've been doing this for 2+ years. Honestly, this is where kickstart modules should be loaded from.

marcus wrote:It turns out that the SDcard does not have a partition table at all, but fortunately the first 4K are not used, so there is plently of room to add an msdos partition table.


It's almost as if they designed it to work this way (they did)

marcus wrote: Upon inspecting the contents of the SDcard in my X5000, I found the following:

Code: Select all
--------------------------------------------------------------
| offset              | size   | contents                    |
--------------------------------------------------------------
| 00000000 - 00000fff | 4K     | zeroes                      |
| 00001000 - 04bfffff | 76M    | uboot                       |
| 04c00000 - ee7fffff | 3740M  | junk (repeating 1K pattern) |
| ee800000 - eeafffff | 3M     | zeroes                      |
--------------------------------------------------------------


So there is a big chunk of junk to cut out a partition from.

Here is how to do it:

  • Boot into Linux (using USB)
  • Backup U-Boot:
    Code: Select all
    sudo dd if=/dev/mmcblk0 bs=1M count=128 of=/tmp/uboot.bin
  • Start gparted
  • select /dev/mmcblk0
  • Pick Device / Create Partition Table...
  • select "msdos" and click Apply
  • Pick Partition / New
  • Set the settings as follows:
    • Free space preceding (MiB): 512
    • New size (MiB): Decrease until "Free space following (MiB):" is also 512
    • Align to: MiB
    • Create as: Primary Partition
    • File Systen: ext4
    • Label: SDCARD
  • Click Add.
  • Right click on the new partition, and pick Format to / ext4.
  • Then pick Edit / Apply all operations.
  • Acknowledge the warning, and wait for the operation to finish.
  • Quit gparted.
  • Restore U-Boot, while keeping the partition table:
    Code: Select all
    sudo dd if=/tmp/uboot.bin of=/dev/mmcblk0 bs=4096 skip=1 seek=1
Et voila, you now have a partition on the SDcard which can be mounted read/write from Linux, and which can be read from U-Boot (try "ext4ls mmc 0:1").
aperezbios
 
Posts: 32
Joined: Mon Jan 13, 2014 8:02 pm

Re: Using the SDcard for storing kernels

Postby marcus » Sat Apr 15, 2017 10:55 am

aperezbios wrote:It's almost as if they designed it to work this way (they did)

Yes, it seems pretty common. Cavium ThunderX does the same thing.
marcus
 
Posts: 53
Joined: Wed Nov 07, 2012 9:07 pm


Return to Platform: AmigaOne X5000 - Linux Only

Who is online

Users browsing this forum: No registered users and 2 guests