Android on mini6410

Dave McLaughlin
Hi all, 

I have managed to get the DVD image of Android 2.3 to work with my mini6410
with a 4.3" display. I also have a 7" display but it is too slow on that.
The 4.3" is ideal for what I plan for it. So far I have installed the
downloaded images and now I am trying to build the OS myself so I can
remove or add as I need and learn how it all hangs together.

I have setup an Ubuntu machine with the dev system as per all the usual
instructions I found on the net and it seems to build as expected with a
few warning etc but no errors. The final image sizes are different to the
images I got on DVD but that is most likely the difference in the build
setup.

I chose the correct config file during the build.

Then I copy the image and the Linux kernel to the SD card and install it to
the NAND flash (1GB NAND with 245MB RAM) on my mini6410 and it all goes
well, until I boot that is.

With my kernal and android.ubi image, it kernel panics during the boot
sequence. This is the final part of the boot sequence.

VFP support v0.3: implementor 41 architecture 1 part 20 variant b rev 5
one_wire_status: 4
s3c-rtc s3c64xx-rtc: setting system clock to 2011-07-01 01:02:49 UTC
(1309482169)
Freeing init memory: 1396K
UBIFS: recovery needed
UBIFS: recovery completed
UBIFS: mounted UBI device 0, volume 0, name "FriendlyARM-root"
UBIFS: file system size:   1038901248 bytes (1014552 KiB, 990 MiB, 8052
LEBs)
UBIFS: journal size:       9033728 bytes (8822 KiB, 8 MiB, 71 LEBs)
UBIFS: media format:       w4/r0 (latest is w4/r0)
UBIFS: default compressor: lzo
UBIFS: reserved for root:  0 bytes (0 KiB)
one_wire_status: 4
Kernel panic - not syncing: Attempted to kill init!
[<c016a9a4>] (unwind_backtrace+0x0/0xe4) from [<c04c1828>]
(panic+0x68/0x194)
[<c04c1828>] (panic+0x68/0x194) from [<c01827e4>] (do_exit+0x68/0x664)
[<c01827e4>] (do_exit+0x68/0x664) from [<c018310c>]
(do_group_exit+0xb0/0xe4)
one_wire_status: 4
[<c018310c>] (do_group_exit+0xb0/0xe4) from [<c0183150>]
(sys_exit_group+0x10/0x18)
[<c0183150>] (sys_exit_group+0x10/0x18) from [<c0165e60>]
(ret_fast_syscall+0x0/0x30)
one_wire_status: 5
Rebooting in 5 seconds.. 

During the initial boot sequence the touch screen gets calibrated so the
kernel is partially working.

I decided to see if it was my kernel build that was the issue so I used the
one from DVD and it produced the same results so I suspect the Android
image but not 100% as last night I tried to boot the Android image from the
DVD with my kernel build and it failed too with a different error. This is
the last part of the boot debug output.

VFP support v0.3: implementor 41 architecture 1 part 20 variant b rev 5
one_wire_status: 4
s3c-rtc s3c64xx-rtc: setting system clock to 2011-07-02 00:56:21 UTC
(1309568181)
Freeing init memory: 1396K
UBIFS: recovery needed
UBIFS: recovery completed
UBIFS: mounted UBI device 0, volume 0, name "FriendlyARM-root"
UBIFS: file system size:   1038901248 bytes (1014552 KiB, 990 MiB, 8052
LEBs)
UBIFS: journal size:       9033728 bytes (8822 KiB, 8 MiB, 71 LEBs)
UBIFS: media format:       w4/r0 (latest is w4/r0)
UBIFS: default compressor: lzo
UBIFS: reserved for root:  0 bytes (0 KiB)
one_wire_status: 4
init: cannot open '/initlogo.rle'
init (1): /proc/1/oom_adj is deprecated, please use /proc/1/oom_score_adj
instead.
enabling adb
adb_open
warning: `rild' uses 32-bit capabilities (legacy support in use)

I am wondering if this is something to do with the memory size but I have
looked through the build code and can't find anything that references this.
At least not yet if there is.

I would appreciate any help anyone can offer as I am new to both Linux and
Android OS building but I have already learned a few things about the build
environment and setting it up so I am enjoying the challenge with this
board. I knew is wasn't going to be easy but I learn more when the going is
tough.

Cheers,
Dave...

Jerry Irving
I have a similar problem on a tiny6410. The system boots normally if I use
the pre-compiled images supplied on the DVD. When I compile Linux, android
and build the root file system, the system fails to boot with the following
errors:

S3C NAND Driver is using hardware ECC.
NAND device: Manufacturer ID: 0xec, Chip ID: 0xd5 (Samsung NAND 2GiB 3,3V
8-bit)
Creating 3 MTD partitions on "NAND 2GiB 3,3V 8-bit":
0x000000000000-0x000000400000 : "Bootloader"
0x000000400000-0x000000c00000 : "Kernel"
0x000000c00000-0x000080000000 : "File System"
UBI: attaching mtd2 to ubi0
UBI: physical eraseblock size:   1048576 bytes (1024 KiB)
UBI: logical eraseblock size:    1032192 bytes
UBI: smallest flash I/O unit:    8192
UBI: VID header offset:          8192 (aligned 8192)
UBI: data offset:                16384
UBI error: validate_ec_hdr: bad VID header offset 512, expected 8192
UBI error: validate_ec_hdr: bad EC header
UBI error: ubi_io_read_ec_hdr: validation failed for PEB 0
UBI error: ubi_init: cannot attach mtd2
PPP generic driver version 2.4.2


later in the boot process I get the following errors before the system
reboots:

UBIFS error (pid 845): ubifs_get_sb: cannot open "ubi0:FriendlyARM-root",
error -19
mount: mounting ubi0:FriendlyARM-root on /r failed: No such device
1Wire touchscreen OK
/init: line 103: can't open /r/dev/console: no such file
Kernel panic - not syncing: Attempted to kill init!
[<c016a9a4>] (unwind_backtrace+0x0/0xe4) from [<c0506a6c>]
(panic+0x68/0x194)
[<c0506a6c>] (panic+0x68/0x194) from [<c01827e4>] (do_exit+0x68/0x664)
[<c01827e4>] (do_exit+0x68/0x664) from [<c018310c>]
(do_group_exit+0xb0/0xe4)
[<c018310c>] (do_group_exit+0xb0/0xe4) from [<c0183150>]
(sys_exit_group+0x10/0x18)
[<c0183150>] (sys_exit_group+0x10/0x18) from [<c0165e60>]
(ret_fast_syscall+0x0/0x30)
one_wire_status: 2
Rebooting in 5 seconds..OK

After a lot of experimenting, I believe the problem is in the root file
system. (Swapping these two modules produces or eliminates the error. any
suggestions would be greatly appreciated. I am also fairly new to Linux and
Android.

Thanks,
Jerry

Dave McLaughlin
Hi Jerry,

When you run genrootfs.sh does it work correctly? I suspect that with all
the failures I have, the root filing system is incomplete.

I have noticed today after doing a clean build that there are a lot of
errors with it. Output is below

If FriendlyArm can build the system then it must be possible. Do we have to
build and do this as ROOT. I have noticed that I get a different set of
errors if I run with sudo but the final image still does not work.

Regards
Dave...


dave@robbie:~/mini6410/android/Android-2.3$ ./genrootfs.sh
Generating rootfs for Android...cp: cannot stat
`out/target/product/mini6410/root/': No such file or directory
cp: cannot stat `out/target/product/mini6410/system/*': No such file or
directory
cp: cannot stat `out/target/product/mini6410/data/*': No such file or
directory
chown: cannot access `rootfs_dir': No such file or directory
chmod: cannot access `rootfs_dir/system/etc/dhcpcd/dhcpcd-run-hooks': No
such file or directory
chown: cannot access `rootfs_dir/system/etc/dhcpcd/dhcpcd-hooks': No such
file or directory
chown: cannot access `rootfs_dir/data': No such file or directory
...done
Create device file...mkdir: cannot create directory `rootfs_dir/dev/input':
No such file or directory
mknod: `rootfs_dir/dev/tty': No such file or directory
mknod: `rootfs_dir/dev/console': No such file or directory
mknod: `rootfs_dir/dev/fb0': No such file or directory
mknod: `rootfs_dir/dev/pointercal': No such file or directory
mknod: `rootfs_dir/dev/input/event1': No such file or directory
mknod: `rootfs_dir/dev/ts-if': No such file or directory
mknod: `rootfs_dir/dev/touchscreen': No such file or directory
mknod: `rootfs_dir/dev/touchscreen-1wire': No such file or directory
mknod: `rootfs_dir/dev/s3c2410_serial3': No such file or directory
...done
Install prebuilt packages...tar: rootfs_dir/system: Cannot open: No such
file or directory
tar: Error is not recoverable: exiting now
ln: creating symbolic link `rootfs_dir/system/bin/sh': No such file or
directory
tar: rootfs_dir/system/bin: Cannot open: No such file or directory
tar: Error is not recoverable: exiting now
...done
Install kernel modules and firmware...tar: rootfs_dir/system/etc: Cannot
open: No such file or directory
tar: Error is not recoverable: exiting now
tar: rootfs_dir/system/lib: Cannot open: No such file or directory
tar: Error is not recoverable: exiting now
find: `rootfs_dir/system/lib/modules/': No such file or directory
...done
Install proprietary-open files......done
Moving packages to /mnt/apps/...
mv: cannot stat `rootfs_dir/system/app/Contacts.apk': No such file or
directory
    rootfs_dir/system/app/Contacts.apk
mv: cannot stat `rootfs_dir/system/app/ContactsProvider.apk': No such file
or directory
    rootfs_dir/system/app/ContactsProvider.apk
mv: cannot stat `rootfs_dir/system/app/DeskClock.apk': No such file or
directory
    rootfs_dir/system/app/DeskClock.apk
mv: cannot stat `rootfs_dir/system/app/DrmProvider.apk': No such file or
directory
    rootfs_dir/system/app/DrmProvider.apk
mv: cannot stat `rootfs_dir/system/app/DownloadProvider.apk': No such file
or directory
    rootfs_dir/system/app/DownloadProvider.apk
mv: cannot stat `rootfs_dir/system/app/DownloadProviderUi.apk': No such
file or directory
    rootfs_dir/system/app/DownloadProviderUi.apk
mv: cannot stat `rootfs_dir/system/app/HTMLViewer.apk': No such file or
directory
    rootfs_dir/system/app/HTMLViewer.apk
mv: cannot stat `rootfs_dir/system/app/Mms.apk': No such file or directory
    rootfs_dir/system/app/Mms.apk
mv: cannot stat `rootfs_dir/system/app/Phone.apk': No such file or
directory
    rootfs_dir/system/app/Phone.apk
mv: cannot stat `rootfs_dir/system/app/TelephonyProvider.apk': No such file
or directory
    rootfs_dir/system/app/TelephonyProvider.apk
mv: cannot stat `rootfs_dir/system/app/PicoTts.apk': No such file or
directory
    rootfs_dir/system/app/PicoTts.apk
mv: cannot stat `rootfs_dir/system/app/TtsService.apk': No such file or
directory
    rootfs_dir/system/app/TtsService.apk
mv: cannot stat `rootfs_dir/system/app/SoundRecorder.apk': No such file or
directory
    rootfs_dir/system/app/SoundRecorder.apk
mv: cannot stat `rootfs_dir/system/app/VpnServices.apk': No such file or
directory
    rootfs_dir/system/app/VpnServices.apk
mv: cannot stat `rootfs_dir/system/app/Provision.apk': No such file or
directory
    rootfs_dir/system/app/Provision.apk
mv: cannot stat `rootfs_dir/system/app/SpeechRecorder.apk': No such file or
directory
    rootfs_dir/system/app/SpeechRecorder.apk
...done

Dave McLaughlin
Hi Jerry,

I have done more digging tonight. I am convinced this is a build issue as a
number of files referenced in genrootfs.sh do not appear to exist. In
particular, I can't find anything from the vendor directory and there is
certainly no FriendlyARM in the out directory. 

I have looked through the build output and don't see any errors.

I hope I can get this to work. I am not giving up this easy!! :o)

Dave McLaughlin
Hi Jerry, update for you.

I have checked the build and everything looks OK. The issue seems to be
with genrootfs.sh as I get a lot of errors with this and the final image is
too small. I suspect files are missing from the image.

I get the missing initlogo during the boot and it drops out to a command
line. 

Something is missing from the boot. I am going to download the original
source from Google tonight and have a look at this to see what the
differences are for the build.

Dave...

Dave McLaughlin
I was following these instructions during the build.

http://www.minidevs.com/Mini6410/Android.html

There is one tar that creates a rootfs_android directory and poking around
in there today I found the missing files that genrootfs.sh was looking for.


I then checked all the files for references to rootfs_android and there are
none that use it.

I beleive these files within rootfs_android should be in rootfs_dir within
the Android-2.3 directory. 

I am busy doing a rebuilt now and will see of my suspisions are correct in
a few hours. Fingers crossed!!!!

Dave...

Daniel
There seems to be a problem with the init process:

"/init: line 103: can't open /r/dev/console: no such file"

What are your bootargs? Try "noinitrd", this worked for me (Debian) or
check how Android wants the bootargs regarding init.

Dave McLaughlin
Hi Daniel,

I think it has something to do with the rootfs_android directory not being
copied to rootfs_dir. This seems to have the missing files that it is
reporting are missing.

I am still compiling the OS (3 hours now) and once this is done I will see
if my suspisions are correct.

Dave...

Dave McLaughlin
I got it working!!!!!!!!!!!

It is indeed something to do with the rootfs_android directory.

By copying the missing files into the rootfs_dir and the building the
image, I now have a working Android 2.3 system.

I still need to figure out how to automate this and that is the next task
and I will post the code changes on my website later but I thought this
might help someone else who is having difficulty getting it to boot.

The simplest way to do this that I have found and may not be the ideal
solution, is to make a copy of the rootfs_android directory and rename this
as rootfs_dir in the Android-2.3 directory. This is where genrootfs.sh will
create the other files.

Now edit genrootfs.sh and comment out the line near the top that removes
the exiting rootfs_dir directory. This will prevent it deleting what you
just copied.

Let me know if this works for you.

I am off now to work on building a custom version without all the extra
Chinese apps and stuff I don't need.

After this I need to figure out how to add serial port access to Android.

Dave...

Piyush
For me the issue was genrootfs.sh function apkmv needs to be rectified as
below

 mvapk()

instead of 
function  mvapk()

Piyush

Dave McLaughlin
Yeah, I got it wrong. The rootfs_dir supplied is actually a prebuilt image.

I have since got it working with the same fix you found.

Dave...