Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support odroid C2 for resin build #53

Open
rbray89 opened this issue Jan 23, 2018 · 29 comments
Open

Support odroid C2 for resin build #53

rbray89 opened this issue Jan 23, 2018 · 29 comments

Comments

@rbray89
Copy link

rbray89 commented Jan 23, 2018

I've done some basic work in trying to get the odroid C2 booting resin, however I'm not terribly familiar with the resin build system. Using the master branch of resin-odroid, and simply adding the *.coffee files, I get an issue with recursive dependencies shortly after initializing tasks.

If I pull master of meta-odroid, I can get rid of the recursion error by adding
IMAGE_FSTYPES_remove_odroid-c2 = "sdcard"
to layers/meta-resin-odroid/recipes-core/images/resin-image-initramfs.bbappend, however when doing this, I will later get an issue with being unable to patch the kernel for AUFS support.

Any help or aid in getting this to build and run would be greatly appreciated.

@rbray89
Copy link
Author

rbray89 commented Jan 23, 2018

Ah, I found the issue for the AUFS support, needed to add the 4.14 key/SHA to the branch dict in layers/meta-resin/meta-resin-common/classes/kernel-resin.bbclass
Will build and update.

@rbray89
Copy link
Author

rbray89 commented Jan 23, 2018

Well the build 'passed', but did not produce a build/tmp/deploy/images/odroid-c2/resin-image-odroid-c2.resinos-img file, and the *.sdcard image would not run upon writing to an SD card. Thoughts?

@rbray89
Copy link
Author

rbray89 commented Jan 23, 2018

Ah, Also found that I had no entry in layers/meta-resin-odroid/recipes-core/images/resin-image.bbappend for the Odroid C2.

So the build is getting hung up on finding the boot.ini and the uimage dtb file. Not sure why those weren't generated yet.

@floion
Copy link
Contributor

floion commented Jan 24, 2018

Hi,
for a similar fix for the boot.ini, see #52

Maybe first wait a bit until this PR gets merged and then you can continue with your work

@rbray89
Copy link
Author

rbray89 commented Feb 5, 2018

I have the project building using the Rocko and Master branch of https://github.com/akuster/meta-odroid (I had trouble resolving issues with u-boot on Pyro due to the use of uboot provided by hardkernel uboot, and later multiple provides)

The project builds cleanly, but I don't see any network or HDMI output when launched.
@floion I assume you use the UART for bootloader insight?

@floion
Copy link
Contributor

floion commented Feb 6, 2018

Yes, you need to hook up to the serial port and check if at least u-boot is starting. Do you see anything on serial?

@rbray89
Copy link
Author

rbray89 commented Feb 11, 2018

Yeah, seeing:

--- UART initialized after reboot ---
[Reset cause: unknown]
[Image: unknown, amlogic_v1.1.3046-00db630 2015-10-28 15:24:31 xiaobo.gu@droid05]
bl30: check_permit, count is 1
bl30: check_permit: ok!
chipid: ef be ad de dLoad bl33 from SD, src: 0x00034200, des: 0x01000000, size: 0x0005ae90
 f0 ad ba ef be ad de not ES chip
[0.336415 Inits done]
secure task start!
high task start!
low task start!
NOTICE:  BL3-1: v1.0(debug):4d2e34d
NOTICE:  BL3-1: Built : 17:08:35, Oct 29 2015
INFO:    BL3-1: Initializing runtime services
INFO:    BL3-1: Preparing for EL3 exit to normal world
INFO:    BL3-1: Next image address = 0x1000000
INFO:    BL3-1: Next image spsr = 0x3c9


U-Boot 2017.09 (Feb 10 2018 - 17:37:02 -0700) odroid-c2

DRAM:  2 GiB
MMC:   mmc@72000: 0, mmc@74000: 1
Using default environment

In:    serial@4c0
Out:   serial@4c0
Err:   serial@4c0
Net:   eth0: ethernet@c9410000
Hit any key to stop autoboot:  0
switch to partitions #0, OK
mmc0 is current device
Scanning mmc 0:1...
Found U-Boot script /boot.scr
reading /boot.scr
664 bytes read in 3 ms (215.8 KiB/s)
## Executing script at 1f000000
reading meson-gxbb-odroidc2.dtb
22065 bytes read in 6 ms (3.5 MiB/s)
reading uimage
16648768 bytes read in 793 ms (20 MiB/s)
Bad Linux ARM64 Image magic!
SCRIPT FAILED: continuing...
reading /meson-gxbb-odroidc2.dtb
22065 bytes read in 5 ms (4.2 MiB/s)
Card did not respond to voltage select!
mmc_init: -95, time 10
MMC Device 2 not found
no mmc device at slot 2
ethernet@c9410000 Waiting for PHY auto negotiation to complete......... TIMEOUT !
Could not initialize PHY ethernet@c9410000
missing environment variable: pxeuuid
missing environment variable: bootfile
Retrieving file: pxelinux.cfg/01-00-1e-06-35-69-5c
ethernet@c9410000 Waiting for PHY auto negotiation to complete......... TIMEOUT !
Could not initialize PHY ethernet@c9410000
missing environment variable: bootfile
Retrieving file: pxelinux.cfg/00000000
ethernet@c9410000 Waiting for PHY auto negotiation to complete......... TIMEOUT !
Could not initialize PHY ethernet@c9410000
missing environment variable: bootfile
Retrieving file: pxelinux.cfg/0000000
ethernet@c9410000 Waiting for PHY auto negotiation to complete.

@rbray89
Copy link
Author

rbray89 commented Feb 11, 2018

I'm assuming at this point that my intitrd doesn't match the boot script.

@rbray89
Copy link
Author

rbray89 commented Feb 12, 2018

hmmm... tried adding -O ^64bit to the mkfs.ext4 command for the boot2 in resin os as that seemed to be an issue for some, but no go on that.

@rbray89
Copy link
Author

rbray89 commented Feb 14, 2018

hmm... tried editing the uboot bappend to use -A arm64 with it's preappend mkimage command, but that didn't seem to do anything. :/

@rbray89
Copy link
Author

rbray89 commented Feb 14, 2018

My boot.scr looks like this:

setenv console "console=ttyAML0,115200" 
setenv loadcmd "fatload" 
setenv mmcbootdev 0
setenv mmcbootpart 1
setenv mmcrootpart 2
setenv kerneladdr "0x01080000"
setenv fdtaddr 0x01000000
setenv fdtfile "meson-gxbb-odroidc2.dtb"
setenv imgbootcmd "booti" 
setenv kernelname uimage
setenv loaddtb     "${loadcmd} mmc ${mmcbootdev}:${mmcbootpart} ${fdtaddr} ${fdtfile}"
setenv loadkernel  "${loadcmd} mmc ${mmcbootdev}:${mmcbootpart} ${kerneladdr} ${kernelname}"
setenv bootargs "${console} root=/dev/mmcblk1p${mmcrootpart} rw rootwait"
run loaddtb
run loadkernel
booti 0x01080000 - 0x01000000

@rbray89
Copy link
Author

rbray89 commented Feb 14, 2018

So I think I'm starting to understand the boot process a little better... uboot loads from SD partition 0 the device tree and kernel image. Looks like uboot can find and read both, but there must be something wrong with one/both of the images? Not sure what I need to look at from here.

@floion
Copy link
Contributor

floion commented Feb 15, 2018

Can you paste the output of

fatls mmc 0:1

and see what you have in the boot partition for starters?

@rbray89
Copy link
Author

rbray89 commented Feb 15, 2018

Everything seems to be present.

=> fatls mmc 0:1
      662   boot.scr
       79   config.json
     2075   device-type.json
       37   image-version-info
    22065   meson-gxbb-odroidc2.dtb
      231   os-release
       24   resin-image
      543   resinos.fingerprint
            splash/
            system-connections/
 11110976   uimage
            system volume information/

9 file(s), 3 dir(s)

@rbray89
Copy link
Author

rbray89 commented Feb 15, 2018

Just tried the 2018.01 uboot as well, same results.

@rbray89
Copy link
Author

rbray89 commented Feb 15, 2018

Hmmm... looks like booti simply may not be supported. Manually running:

setenv kernel  "fatload mmc 0:1 0x1080000 uImage"
setenv dtb     "fatload mmc 0:1 0x1000000 meson-gxbb-odroidc2.dtb"
setenv bootseq "bootm 0x1080000 - 0x1000000"
setenv bootcmd "${kernel}; ${dtb}; ${bootseq}"
run bootcmd

Starts to load the kernel, albeit with a kernel panic:

[    1.393721] VFS: Mounted root (ext4 filesystem) on device 179:2.
[    1.400761] devtmpfs: mounted
[    1.402758] Freeing unused kernel memory: 512K
[    1.584537] usb 1-1: new high-speed USB device number 2 using dwc2
[    1.645059] EXT4-fs (mmcblk1p2): re-mounted. Opts: (null)
1970/01/01 00:00:01 error loading layer store:error initializing graphdriver: driver not supported
[    1.664517] Kernel panic - not syncing: Attempted to kill init! exitcode=0x00000100
[    1.664517]
[    1.667987] CPU: 1 PID: 84 Comm: init Not tainted 4.14.18-odroid #1
[    1.674193] Hardware name: Hardkernel ODROID-C2 (DT)
[    1.679110] Call trace:
[    1.681533] [<ffff000008089018>] dump_backtrace+0x0/0x3f8
[    1.686874] [<ffff000008089424>] show_stack+0x14/0x20
[    1.691878] [<ffff000008739198>] dump_stack+0x98/0xb8
[    1.696879] [<ffff0000080ab6ac>] panic+0x130/0x29c
[    1.701622] [<ffff0000080af848>] complete_and_exit+0x0/0x20
[    1.707141] [<ffff0000080af8ac>] do_group_exit+0x34/0x98
[    1.712404] [<ffff0000080ba400>] get_signal+0x1d8/0x478
[    1.717578] [<ffff0000080882b8>] do_signal+0x88/0x650
[    1.722580] [<ffff000008088c80>] do_notify_resume+0xd0/0x110
[    1.728185] Exception stack(0xffff000008dbbec0 to 0xffff000008dbc000)
[    1.734569] bec0: 0000004420058110 0000000000000000 0000000000000000 0000000000000000
[    1.742331] bee0: 0000000000000000 0000000000000000 0000000000000001 0000000000000000
[    1.750094] bf00: 0000000000000062 0000ffffa80008c0 000000000063bb08 00000000003d0f00
[    1.757856] bf20: 0000ffffaf4c0090 00000000008f8fd8 0000000000000027 0000000000000000
[    1.765619] bf40: 0000ffffb04bf458 0000000000000000 00000000008f8000 0000000000429340
[    1.773381] bf60: 000000000044b3b0 0000ffffb04bf44e 0000ffffb04bf44f 00000000008f7000
[    1.781143] bf80: 000000000093e000 000000000063a260 0000000000770508 ffffffffffffffa0
[    1.788906] bfa0: 000000442005a1a0 0000ffffaf4bf800 0000000000422ebc 0000ffffaf4bf620
[    1.794314] hub 1-1:1.0: USB hub found
[    1.794593] hub 1-1:1.0: 4 ports detected
[    1.804345] bfc0: 000000000044c27c 00000000a0000000 0000004420058110 00000000ffffffff
[    1.812107] bfe0: 0000000000000000 0000000000000000 0000000000000000 0000000000000000
[    1.819870] [<ffff0000080836c0>] work_pending+0x8/0x10
[    1.824960] SMP: stopping secondary CPUs
[    1.828840] Kernel Offset: disabled
[    1.832290] CPU features: 0x002004
[    1.835652] Memory Limit: none
[    1.838675] ---[ end Kernel panic - not syncing: Attempted to kill init! exitcode=0x00000100
[    1.838675]

Looks like I may need to add Overlay support to the kernel.

@floion
Copy link
Contributor

floion commented Feb 15, 2018

From the above it looks like manual doing the booti command works. So you need to change bootscr accordingly.
For the second error, to fix it, you should re-build with the following changes:
1 - change the meta-resin submodule to master and git pull it so you have the latest master
2 - change https://github.com/resin-os/resin-odroid/blob/master/layers/meta-resin-odroid/conf/samples/local.conf.sample#L6 to say

BALENA_STORAGE_odroid-xu4 = "overlay2"

instead. By doing that, your C2 will use aufs as a balena storage driver. If you want to have it using overlayfs, also add a line there like this (your Odroid C2 needs a kernel version 4.x):

BALENA_STORAGE_odroid-c2 = "overlay2"

@rbray89
Copy link
Author

rbray89 commented Feb 16, 2018

looks like there may be more issues with meta-resin:


| DEBUG: Executing shell function do_compile
| Error response from daemon: No such image: docker-disk-27704:latest
| Sending build context to Docker daemon 324.2 MB
|
| Step 1/5 : FROM docker:17.03-dind
|  ---> 3f40a275afb0
| Step 2/5 : RUN apk add --update bash util-linux shadow && rm -rf /var/cache/apk/*
|  ---> Using cache
|  ---> 5fc7799df395
| Step 3/5 : ADD entry.sh /entry.sh
|  ---> Using cache
|  ---> 06e8bff62e03
| Step 4/5 : RUN chmod a+x /entry.sh
|  ---> Using cache
|  ---> befd4355a5cb
| Step 5/5 : CMD /entry.sh
|  ---> Using cache
|  ---> e42b4f5088f2
| Successfully built e42b4f5088f2
| [INFO] Creating and setting 1000:1000.
| Creating mailbox file: No such file or directory
| Starting docker daemon with overlay2 storage driver.
| Waiting for docker to become ready..
| Command "daemon" is deprecated, and will be removed in Docker 1.16. Please run `dockerd` directly.
| Docker started.
| Stopping docker...
| /entry.sh: line 46:    11 Terminated              docker daemon -g $DATA_VOLUME/docker -s "$BALENA_STORAGE"
| WARNING: exit code 143 from a shell command.

@floion
Copy link
Contributor

floion commented Feb 16, 2018

Is this from a new build or from the existing one you had started before?

@rbray89
Copy link
Author

rbray89 commented Feb 16, 2018

This is a completely new build. Rolling back to 585641b seems to let it build again, so I don't think it is environment.

@rbray89
Copy link
Author

rbray89 commented Feb 17, 2018

Do you know of any way to add aditional logging to the balena runtime? Looks like there are many places that could return the runtime error in the balena subsystem.

@rbray89
Copy link
Author

rbray89 commented Feb 18, 2018

Just tried the 997c0cad2ab514ad0934d03a202df8b14d9d2708 version of meta-resin and that was able to compile, but didn't get past the overlay error.

@floion
Copy link
Contributor

floion commented Feb 18, 2018

Can you paste the entire diff you use? I want to give it a go on my side too

@rbray89
Copy link
Author

rbray89 commented Feb 19, 2018

https://github.com/rbray89/resin-odroid

Note that I'm getting the kernel panic runtime error, not the build error.

@rbray89
Copy link
Author

rbray89 commented Feb 19, 2018

If I move meta-resin to the one mainline resin-odroid uses, I get an odd error in linux-stable:

| DEBUG: Executing shell function do_compile
| NOTE: make -j 16 HOSTCC=gcc  HOSTCPP=gcc  -E Image CC=aarch64-poky-linux-gcc   -fuse-ld=bfd  --sysroot=/mnt/data/ryan/odroid-resin/build/tmp/work/odroid_c2-poky-linux/linux-stable/4.14.19+gitAUTOINC+1722fe3727-r0/recipe-sysroot LD=aarch64-poky-linux-ld.bfd    --sysroot=/mnt/data/ryan/odroid-resin/build/tmp/work/odroid_c2-poky-linux/linux-stable/4.14.19+gitAUTOINC+1722fe3727-r0/recipe-sysroot
| ERROR: oe_runmake failed
| /mnt/data/ryan/odroid-resin/build/tmp/work-shared/odroid-c2/kernel-source/scripts/gcc-version.sh: line 26: aarch64-poky-linux-gcc: command not found
| /mnt/data/ryan/odroid-resin/build/tmp/work-shared/odroid-c2/kernel-source/scripts/gcc-version.sh: line 27: aarch64-poky-linux-gcc: command not found
| make[2]: aarch64-poky-linux-gcc: Command not found
| make[2]: aarch64-poky-linux-gcc: Command not found

@rbray89
Copy link
Author

rbray89 commented Feb 20, 2018

Hmmm... seems that moving back to the version of meta-resin I was previously on isn't working. Not sure what changed, but it just can't seem to find the cross compiler now.

@rbray89
Copy link
Author

rbray89 commented Feb 22, 2018

Fixed the gcc issue... but the overlay runtime issue shows up on meta-resin @585641b, while I still seem to get the docker error on master of meta-resin. Still trying other versions of meta-resin.

@floion
Copy link
Contributor

floion commented Feb 22, 2018

Let me try it on my side too when I have some time and will get back to you

@rbray89
Copy link
Author

rbray89 commented Mar 21, 2018

No useful update. Still panicking at the same spot with the latest build. I double-checked the kernel config, CONFIG_OVERLAY_FS=y is set.
Is there a way to boot to shell and bypass the docker startup?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants