Dual-boot Android (internal storage )- Ubuntu (external SD)

Asked by Giorgio Pintaudi

Hello
I am trying to boot an Ubuntu kernel located in the SD card connected to a Toshiba AC100.
These are the specs:
Model Name: TOSHIBA AC100-10D
Kernel Version: 3.1.10.6.2
Ubuntu Distro: trusty-preinstalled-desktop-armhf+ac100 http://cdimage.ubuntu.com/lubuntu/daily-preinstalled/pending/

I have follow thoroughly the guide to install android 4.4.2 CyanogenMod 11.0 at this link https://code.google.com/p/cm-paz00/wiki/InstallGuide and all went well. I can use android flawlessly.

I have extracted the trusty-preinstalled-desktop-armhf+ac100.tar.gz in the 7th partition as suggested in that guide and I have created a boot directory in the sd card. In this directory there are the zImage, the initrd.gz (compressed by me with gz) and the boot.src script. The script has been produced in this way:

This is the boot.cmd file:

echo === boot.scr: Loading Lubuntu 14.04 from SD partition 1 ===
mmc dev 1
setenv bootargs 'mem=512M@0 tegrapart=recovery:300:a00:800,boot:d00:1000:800,mbr:1d00:200:800 console=tty0 root=/dev/mmcblk0p7 rootfstype=ext4 quiet splash'
fatload mmc 1:1 0x10008000 /boot/zImage
fatload mmc 1:1 0x12000000 /boot/initrd.gz
bootz 0x10008000 0x12000000

This is the command I used to create the boot.scr script:

mkimage -A arm -O linux -T script -C none -a 0 -e 0 -n "ubootscript" -d boot.cmd boot.scr

When I try to boot the Ubuntu kernel from u-boot menu (boot from sd card) I always get the same error:

reading /boot/zImage
3472448 bytes read in 189 ms (17.5 MiB/s)
reading /boot/initrd.gz
2103024 bytes read in 117 ms (17.1 MiB/s)
Kernel image @ 0x1000000 [ 0x000000 - 0x34fc40 ]
Wrong Ramdisk Image Format
Ramdisk image is corrupt or invalid

This is the bootimg.cfg file that came along with the kernel image:

bootsize = 0x800000
pagesize = 0x800
kerneladdr = 0x10008000
ramdiskaddr = 0x12000000
secondaddr = 0x10f00000
tagsaddr = 0x10000100
name = Ubuntu Boot Img
cmdline = mem=512M@0 tegrapart=recovery:300:a00:800,boot:d00:1000:800,mbr:1d00:200:800 console=tty0 root=/dev/mmcblk0p7 quiet splash

Question information

Language:
English Edit question
Status:
Solved
For:
AC100_enablement Edit question
Assignee:
No assignee Edit question
Solved by:
Giorgio Pintaudi
Solved:
Last query:
Last reply:
Revision history for this message
Marc Dietrich (marvin24) said :
#1

Our uboot version requires an initrd with a uboot header. You need to run
mkimage -A arm -O linux -T ramdisk -C gzip -n "initramfs" -d initrd.img initrd.img.uimg and load initrd.img.uimg instead.

Revision history for this message
Giorgio Pintaudi (laststardust) said :
#2

With your command the kernel starts smoothly but there is some other little things to be fixed.
This is the situation:

if I boot with the sd card inserted the kernel loads without prompting for the u-boot window.
Then it detects the tarball on the sd card and try to install it on the /dev/mmcblk0p12 partition.
I would even let it install the tar.gz archive, if that partition would exist. The fact is that I am using the partition table given in the guide I linked above. In this partition table Ubuntu can be installed on the 7th partition /dev/mmcblk0p7 and I already uncompressed the tar.gz archive in that.

If I boot without the sd card inserted and I plug it in durind the u-boot prompt window and select "boot from sd card" the kernel loads but then a blank screen appears and that's all.

What can I do to make the kernel use the /dev/mmcblk0p7 for mounting the filesystem?
I though the boot.src file I compiled would have been suitable for that...

Revision history for this message
Giorgio Pintaudi (laststardust) said :
#3

I let the tarball installer install the rootfs in the /dev/mmcblk0p12 partition and the installation didn't display any error, but at the reboot the situation is the same as the previous message.

Revision history for this message
Andrey Danin (danindrey) said :
#4

There is a problem in sos-uboot with partitioning on 8 GB models: u-boot installer doesn't remove old partition scheme (bug is fixed but new version is not released yet). To avoid the issue - erase first 7 megabytes of internal storage before placing GPT partition scheme.

Note that removing tegrapart cmdline parameter is not enough because kernel can support nvtegra (it will use old partition scheme).

When you boot with inserted sd card u-boot can find boot script on the sd card. In this case boot script from internal storage will be ignored.

Revision history for this message
Andrey Danin (danindrey) said :
#5

Newer version of sos-uboot exists, but it was not tested a lot:
https://dl.dropboxusercontent.com/u/40761340/Test/sos-uboot-r5-2013-11-10.bin

Revision history for this message
Giorgio Pintaudi (laststardust) said :
#6

I used the sos-uboot you linked and repartitioned again the AC100 successfully. Also Android installation went fine.
But when I try to boot from sd card the ubuntu kernel it fails to find the rootfs in partition /dev/mmcblk0p7 and complains that it can find the tarball archive.
This is the boot.cmd I am using to compile boot.src located in the sd card

echo "=== boot.scr: Loading Lubuntu 14.04 from SD partition 1 ==="
mmc dev 1
setenv bootargs 'mem=512M@0M console=tty0 root=/dev/mmcblk0p7 rootfstype=ext4 splash'
fatload mmc 1:1 0x10008000 /boot/zImage
fatload mmc 1:1 0x12000000 /boot/initrd.gz
bootz 0x10008000 0x12000000

PS
in order to "merge" the two boot.src menus (the one on the sd card and the one in internal memory) I used this boot.src, but it seems that this change is being ignored and the usual 5 buttons menu is displayed:

echo "=== boot.scr: Loading Lubuntu 14.04 from SD partition 1 ==="
setenv bootmenu_5 'Boot UBUNTU=setenv bootargs "mem=512M@0M console=tty0 root=/dev/mmcblk0p7 rootfstype=ext4 splash";\
mmc dev 1;\
fatload mmc 1:1 0x10008000 /boot/zImage;\
fatload mmc 1:1 0x12000000 /boot/initrd.gz;\
bootz 0x10008000 0x12000000';

Revision history for this message
Giorgio Pintaudi (laststardust) said :
#7

I'd like to point out that my device is the 16GB one

Revision history for this message
Andrey Danin (danindrey) said :
#8

Root parameter points to internal mmc even when you load kernel from sd card.
It's better to use UIDs to point root partition.

Revision history for this message
Giorgio Pintaudi (laststardust) said :
#9

If I boot from the Ubuntu kernel located in the sdcard, I get this:

Error: No tarball found
Spawning a shell within the initramfs
BusyBox v1.21.1 (Ubuntu 1:1.21.0-1ubuntu1) built-in shell (ash)
Enter 'help' for a list of built-in commands
(initramfs) ls /dev/mmcblk*
/dev/mmcblk1p1 /dev/mmcblk0p6 /dev/mmcblk0p12 /dev/mmcblk0boot0
/dev/mmcblk1 /dev/mmcblk0p5 /dev/mmcblk0p11 /dev/mmcblk0
/dev/mmcblk0p9 /dev/mmcblk0p4 /dev/mmcblk0p10
/dev/mmcblk0p8 /dev/mmcblk0p3 /dev/mmcblk0p1
/dev/mmcblk0p7 /dev/mmcblk0p2 /dev/mmcblk0boot1
(initramfs) mount /dev/mmcblk0p7 /tmp
mount: mounting /dev/mmcblk0p7 on /tmp failed: Invalid argument
(initramfs) blkid
/dev/mmcblk1p1: LABEL="SD32GB" UUID="xxx" TYPE="vfat"
/dev/mmcblk0p3 UUID="xxx" TYPE="ext2"

It seems the kernel finds someway the old partition table ...

Revision history for this message
Giorgio Pintaudi (laststardust) said :
#10

This is part of the dmesg output. I hope it will help you understand ...

[ 3.392377] sdhci: Secure Digital Host Controller Interface driver
[ 3.404571] sdhci: Copyright(c) Pierre Ossman
[ 3.418016] sdhci-pltfm: SDHCI platform and OF driver helper
[ 3.431983] mmc0: Invalid maximum block size, assuming 512 bytes
[ 3.444106] Registered led device: mmc0::
[ 3.450549] mmc0: SDHCI controller on sdhci-tegra.3 [sdhci-tegra.3] using ADMA
[ 3.464137] Failed gpio lp0 enable for irq=365, error=-22
[ 3.481084] sdhci-tegra sdhci-tegra.0: SD card wake-up event registrationfailed with eroor: -22
[ 3.499988] sdhci-tegra sdhci-tegra.0: vddio_sdmmc regulator not found: -19.Assuming vddio_sdmmc is not required.
[ 3.519626] sdhci-tegra sdhci-tegra.0: vddio_sd_slot regulator not found: -19. Assuming vddio_sd_slot is not required.
[ 3.534685] mmc1: Invalid maximum block size, assuming 512 bytes
[ 3.537739] mmc1: no vmmc regulator found
[ 3.540857] Registered led device: mmc1::
[ 3.547288] mmc1: SDHCI controller on sdhci-tegra.0 [sdhci-tegra.0] using ADMA
[ 3.550677] Registered led device: wifi-led
[ 3.582399] nvec nvec.2: ec firmware version 01.20.00 / f9
[ 3.588279] mmc0: new high speed MMC card at address 0001
[ 3.592197] mmcblk0: mmc0:0001 SEM16G 14.8 GiB
[ 3.597377] mmcblk0boot0: mmc0:0001 SEM16G partition 1 1.00 MiB
[ 3.602536] mmcblk0boot1: mmc0:0001 SEM16G partition 2 1.00 MiB
[ 3.626685] usb 1-1: device descriptor read/64, error -71
[ 3.644598] nvec nvec.2: added 6 NVEC subdevices
[ 3.647538] nvtegrapart: hidden_parts =
[ 3.651811] nvtegrapart: #1 [PT ] start=2048 size=1024
[ 3.656082] nvtegrapart: #2 [EBT ] start=3072 size=4096
[ 3.660457] nvtegrapart: #3 [SOS ] start=7168 size=10240
[ 3.664907] nvtegrapart: #4 [LNX ] start=17408 size=16384
[ 3.669275] nvtegrapart: #5 [MBR ] start=33792 size=2048
[ 3.673811] nvtegrapart: #6 [APP ] start=35840 size=614400
[ 3.678447] nvtegrapart: #7 [CAC ] start=650240 size=819200
[ 3.682984] nvtegrapart: #8 [MSC ] start=1469440 size=4096
[ 3.687527] nvtegrapart: #9 [EM1 ] start=1473536 size=1024
[ 3.692418] nvtegrapart: #10 [UDA ] start=1474560 size=2529280
[ 3.697050] nvtegrapart: #11 [EM2 ] start=4003840 size=1024
[ 3.702029] nvtegrapart: #12 [UDB ] start=4004864 size=58512384
[ 3.702224]
[ 3.706762] mmcblk0: p1 p2 p3 p4 p5 p6 p7 p8 p9 p10 p11 p12
[ 3.789921] input: nvec keyboard as /devices/virtual/input/input0
[ 3.794374] mmcblk0: p12 size 58512384 extends beyond EOD, truncated
[ 3.878784] tegrapart_partition: state->bdev->bd_disk->disk_name = mmcblk0boot1
[ 3.893749] mmcblk0boot1: unknown partition table
[ 3.908016] usb 1-1: new high speed USB device number 3 using tegra-ehci
[ 3.923063] tegrapart_partition: state->bdev->bd_disk->disk_name = mmcblk0boot0
[ 3.938030] mmcblk0boot0: unknown partition table
[ 4.029926] mmc1: new high speed SDHC card at address aaaa
[ 4.042035] mmcblk1: mmc1:aaaa SU32G 29.7 GiB
[ 4.059272] tegrapart_partition: state->bdev->bd_disk->disk_name = mmcblk1
[ 4.070248] mmcblk1: p1

Revision history for this message
Andrey Danin (danindrey) said :
#11

> [ 3.702029] nvtegrapart: #12 [UDB ] start=4004864 size=58512384
> [ 3.702224]
> [ 3.706762] mmcblk0: p1 p2 p3 p4 p5 p6 p7 p8 p9 p10 p11 p12
Kernel finds old partition table. If you used version with "fix" then probably fix doesn't work on 16GB model (I don't have such model for tests).

To fix the issue you need to erase first 10MB of internal storage (mmvblk0) and apply GPT partition scheme again. Of course you need to reinstall android after that.

Also you can try easy fix (but there is a chance to broke GPT and go to previous case):
dd id=/dev/zero of=/dev/mmcblk0 bs=2048 count=1 seek=512
This command will erase old PT (it is for storage with boot partition size 1MB).

Revision history for this message
Giorgio Pintaudi (laststardust) said :
#12

The easy fix worked as a charm.
Thanks to all for the hints. I managed to install Ubuntu 14.04 alongside Android 4.4.2.
This guide proved useful too: http://ac100.wikispaces.com/uboot+installation even though I had to change it a lot.
Good job AC100 team