narmstrong changed the topic of #linux-amlogic to: Amlogic mainline kernel development discussion - our wiki http://linux-meson.com/ - ml linux-amlogic@lists.infradead.org - Publicly Logged on https://irclog.whitequark.org/linux-amlogic
sputnik_ has quit [Remote host closed the connection]
sputnik_ has joined #linux-amlogic
brads has joined #linux-amlogic
ldevulder_ has joined #linux-amlogic
ldevulder has quit [Ping timeout: 245 seconds]
jakogut_ has joined #linux-amlogic
jakogut has quit [Ping timeout: 245 seconds]
jakogut_ is now known as jakogut
ldevulder_ is now known as ldevulder
JerryXiao has joined #linux-amlogic
Darkmatter66 has joined #linux-amlogic
<Darkmatter66> narmstrong, Hi, is there any functionallity in u-boot to find the correct device tree to be loaded ? for example a default environment variable to identify the board, this can then be read from the boot script and used to load the correct device tree.
<Darkmatter66> narmstrong, this can be extremely usefull when publishing a distribution for multiple boards so I can make one image for all boards and the user don't have to copy the correct dtb file and name it, because all the dtbs are compiled in one directory i can have something in the boot script to load the appropriate file
<Darkmatter66> fatload mmc 0:1 ${dtb_loadaddr} dtbs/"${boxname}".dtb
<ccaione> Darkmatter66: usually the FIT image is what you are looking for
<Darkmatter66> assuming that $boxname is in the default u-boot build and is set to the name of the dtbs from mainline linux
<Darkmatter66> btw wetek used a similar mechanism in their u-boot fork and so they ditributed only one image of each distribution
<Darkmatter66> they have this in their boot script
<Darkmatter66> if test "${boxname}" = "Hub"; then fatload mmc 0:1 ${dtb_loadaddr} meson64_wetekhub.dtb; fi
<Darkmatter66> if test "${boxname}" = "Play2s"; then fatload mmc 0:1 ${dtb_loadaddr} meson64_wetekplay2s.dtb; fi
<Darkmatter66> if test "${boxname}" = "Play2"; then fatload mmc 0:1 ${dtb_loadaddr} meson64_wetekplay2.dtb; fi
<Darkmatter66> if test "${boxname}" = "PlayPlus"; then fatload mmc 0:1 ${dtb_loadaddr} meson64_wetekplayplus.dtb; fi
<ccaione> again, that's better done using a FIT image
<Darkmatter66> ccaione, what do you mean ? even if I embed multiple dtbs in one FIT image how does u-boot loads the correct one ?
<ccaione> it depends. You can read for example the hwrev or product name from efuses
<ccaione> if the info is there
<Darkmatter66> ccaione, that seems a little complicated, I think a simple default variable is much simpler and less error prone
<ccaione> how do you initialize the variable?
<Darkmatter66> ccaione, well the idea is to have it in the default set of variables of each board (in u-boot source code)
<Darkmatter66> so the default build of u-boot have the correct variable of the board
<ccaione> so, since the env is specific for each board you must have a different u-boot for each board right?
<Darkmatter66> u-boot build is board specific IIRC
<ccaione> not always. What I'm suggesting here (I have done this in the past) is that you have one single u-boot build, one single FIT image for multiple board and you can dynamically boot the correct kernel / DTB at runtime
<ccaione> but of course, you can do that with multiple u-boot builds
filt3r has joined #linux-amlogic
<narmstrong> Darkmatter66: mainline uboot has the fdt name in the default env
<Darkmatter66> ccaione, I don't think you can have single u-boot to load to multiple boards, first step when building u-boot is to choose your board config "make khadas-vim_defconfig" so the build is done for your board and include the board's fdt
<ccaione> Darkmatter66: you can do that if your board are close enough each other to have a DTB supporting the common hw
<Darkmatter66> narmstrong, aha what's the variable name ? i haven't played with mainline u-boot yet just vendor u-boot.
<ccaione> `CONFIG_DEFAULT_DEVICE_TREE`
<Darkmatter66> ccaione, that's in the config, you can't read that in boot time, this is only used when compiling
<narmstrong> fdtfile
<narmstrong> "fdtfile=amlogic/" CONFIG_DEFAULT_DEVICE_TREE ".dtb\0"
<Darkmatter66> narmstrong, nice
<Darkmatter66> narmstrong, one more thing, is there a default config in u-boot for gxbb-p201 and gxbb-p200 ?
<narmstrong> Nop
<Darkmatter66> narmstrong, so how can i build it for my board ? it uses the p201 reference board? can I boot something like odroid c2 uboot on it
<narmstrong> Nop you will need the p200 or p201 fip, and for uboot for p200 you can use the same board code
<narmstrong> For p201 which is p200 with 10/100 Ethernet you need a new board directory
<narmstrong> For the fip is the README for p212 on the repo to use and use the commands on the Nanopi k2 to build the binary
<Darkmatter66> I don't want to burn the u-boot image permanently for now since i'm just testing, I want to chainload it from vendor u-boot, I don't need Fip binaries for that do I?
<Darkmatter66> what do you mean use README from p212 and the same commands ! isn't p212 gxl and p201 gxb ? how can I used the same commands.
<Darkmatter66> narmstrong, I think nanopi-k2 and odroid-c2 are closer to my board than p212 don't you think ?
sputnik_ has quit [Ping timeout: 255 seconds]
<narmstrong> No need for fip if you want to chainload
<narmstrong> I only told p212 for the amlogic uboot source, not the mainline source !
<narmstrong> example of chainload from ethernet `setenv autoload no;dhcp;setenv serverip 10.1.2.12;tftpboot 0x1000000 amlogic/u-boot.bin;go 0x1000000`
<Darkmatter66> narmstrong, yes I tried it and it works, the only problem is that i can't get network to work.
<narmstrong> yes because you have 10/100 ethernet
<narmstrong> and the odroid-c2/nanopi k2 board conf setups gigabit ethernet
<Darkmatter66> narmstrong, yes I'm aware of the problem, so all I need is a device tree from mainline linux and a board config ?
<narmstrong> nop, simply change PHY_INTERFACE_MODE_RGMII to PHY_INTERFACE_MODE_RMII into board/amlogic/odroid-c2/odroid-c2.c
<narmstrong> to be clean you will need to create a new board/amlogic/p201/p201.c with this changed
<narmstrong> in an hopefully not to far future, this will use device tree, but for now it's in C...
<Darkmatter66> narmstrong, so how come the nanopi-k2 doesn't have a .C file ?
<narmstrong> because it uses the odroid-c2 file
<narmstrong> the content will be the same
<Darkmatter66> narmstrong, got it
<narmstrong> the nanopi k2 defconfig will use the odroid-c2 board config
<narmstrong> jerome made a clean separation between the board, the defconfig, the config and the arch/arm code
<narmstrong> we can pick different config & file depending on the board
<Darkmatter66> narmstrong, is there a plan to add these reference boards
<Darkmatter66> narmstrong, since they are all over the place
<narmstrong> no for GXBB, but you can add them
<narmstrong> I'll apply the patches with pleasure !
<Darkmatter66> narmstrong, ok I will try
lissyx has joined #linux-amlogic
<lissyx> hey hello
<lissyx> I'm in the process of upgrading some lepotato running armbian stretch
<lissyx> they are not rebooting :/
<lissyx> kernel was 4.14.52, upgraded to 4.14.98
<ndufresne> do you have serial adapter ?
<lissyx> Unpacking linux-stretch-root-next-lepotato (5.73) over (5.38) ...
<lissyx> not with me
<ndufresne> makes it harder to debug, do you see something coming out on HDMI ?
<lissyx> I was hoping there would be a known issue that I could quickly fix before going back home
<ndufresne> (I think on really recent u-boot it prints something)
<lissyx> I tried HDMI, screen does not even turn on
<lissyx> sd gets mounted fine on my laptop
<lissyx> reproduced on a second board after upgrade as well
<ndufresne> is there a FAT partittion on it ?
<lissyx> swapped sd before upgradng the second, so it's not a hw issue
<ndufresne> did you properly installed the u-boot on that SD ?
<lissyx> I only see one ext4
<lissyx> it was installed six months ago
<lissyx> dumping armbian image on it, booting
<ndufresne> can you confirm which download link ? maybe I can help by just flashing an SD card and trying it
<lissyx> sorry, but a six months old download, I lost the link
<lissyx> according to apt upgrade logs, it was armbian 5.38 back then
<lissyx> Unpacking linux-u-boot-lepotato-next (5.75) over (5.55) ...
<lissyx> 5.55 maybe?
<lissyx> yeah, connecting on other, that are still running older, it's uboot package 5.55
<lissyx> ii linux-u-boot-lepotato-next 5.55 arm64 Uboot loader 2018.05
<lissyx> was there any change related to that?
<lissyx> I remember there was this weird issue with MAC changing on each boot and it was related to something to fix in uboot?
vagrantc has joined #linux-amlogic
* ndufresne lost track, so you want to upgrade your le-potato with a six month old image ?
<lissyx> no
<lissyx> it was running for six months
<lissyx> I perform an apt update && apt upgrade
<lissyx> does not boot anymore
<ndufresne> ah
<ndufresne> so it likely broken the kernel
<lissyx> 4.14.98 ?
<lissyx> known issues?
<ndufresne> I don't know, I usually build my own base on a mixture of upcoming features
<lissyx> ok
<lissyx> well, time's up
<lissyx> looks like I will debug that at home
<lissyx> with serial console
<ndufresne> yeah, it's will be faster then doing the guessing work
<lissyx> yeah, but it means reduced cluster capacity for at best two day s:/
<ndufresne> if you care about what's on your board, make sure to keep SD card snapshots around
<lissyx> I don't care
<lissyx> it's easy to reinstall
<ndufresne> I'm curious, what does a potato do in a cluster ?
<lissyx> ndufresne, really have to catch my train now
<lissyx> ndufresne, I'll show you later
lissyx has quit [Quit: Leaving]
<ndufresne> no worries, go, see you
Darkmatter66 has quit [Remote host closed the connection]
Darkmatter66 has joined #linux-amlogic
lissyx has joined #linux-amlogic
<lissyx> ndufresne, so, I'm using them to run ARM64 tests for deepspeech
<Darkmatter66> narmstrong, so I added the board/amlogic/p201 directory with the appropriate files and now i have network working
<lissyx> ndufresne, hm funny, I'm wondering if I'm hitting this: https://github.com/armbian/build/issues/1103
<ndufresne> lissyx, that's a nice setup
<Darkmatter66> narmstrong, now I'm trying to test vout but when i enable CONFIG_VIDEO_MESON i u-boot crashes
<lissyx> ndufresne, thanks
<lissyx> well, not exactly this, but something similar
<lissyx> since I'm booting from SD and not eMMC (no eMMC)
<Darkmatter66> narmstrong, https://pastebin.com/4VzhNLji
<lissyx> allow me a dumb question, since I'm chceking packages on one of the other boards
<lissyx> so I have linux-{image,dtb}-meson64 and linux-u-boot-lepotato-next
<lissyx> wondering if the '-next' for u-boot should imply linux-{image,dtb}-next-meson64
<narmstrong> Darkmatter66: you will need some DT fixups specific to u-boot, look the changes I made for GXL
nsaenz has joined #linux-amlogic
<narmstrong> Darkmatter66: look at all the arch/arm/dts/meson-gxbb-odroidc2-u-boot.dtsi I added, add the same for board you add
<narmstrong> this will be appeneded to the DT by the build system
nsaenz has quit [Read error: Connection reset by peer]
<Darkmatter66> narmstrong, what about the hdmi-supply changes ? do I need those as well?
nsaenz has joined #linux-amlogic
nsaenz has quit [Remote host closed the connection]
nsaenz has joined #linux-amlogic
<narmstrong> Yep for p200/p201
nsaenz has quit [Ping timeout: 246 seconds]
<lissyx> ndufresne, which timezone are you? any hope you might still be available when I can plug a serial console ?
Darkmatter66_ has joined #linux-amlogic
Darkmatter66 has quit [Ping timeout: 250 seconds]
nsaenz has joined #linux-amlogic
lissyx has quit [Ping timeout: 252 seconds]
nsaenz has quit [Ping timeout: 246 seconds]
lissyx has joined #linux-amlogic
<lissyx> ndufresne, ok, I'm seeing some missing file /boot/boot.env at boot time
<lissyx> ndufresne, and then I get a shell on the serial console
<ndufresne> boot.env is written when you do saveenv
<lissyx> and no eth
<ndufresne> but for distro, default env "should" work
<lissyx> that's weird
<ndufresne> lissyx, for network, try "setenv autoload off; dhcp"
<lissyx> $ uname -a
<lissyx> Linux ds-lepotato-6 4.14.52-meson64 #6 SMP PREEMPT Thu Jun 28 11:17:29 UTC 2018 aarch64 GNU/Linux
<ndufresne> oh, kernel boots
<lissyx> but only 4.14.98 in /boot
<ndufresne> and network no longer work ?
<lissyx> ndufresne, I don't see any ethX interface
<lissyx> well if kernel is mismatching it's not good
<ndufresne> when eth get loaded, you should get a line with "meson8b-dwmac c9410000.ethernet eth0: Link is Up - 100Mbps/Full - flow control rx/tx"
<ndufresne> lissyx, I'd say let's start by the very basic, what do you get printed in the early of the boot on line "Machine model: "
<ndufresne> the string is from the device tree, so we can make sure it loads the right one
<lissyx> let me get it
<lissyx> grmbl
<lissyx> somehow vim and tty did not make friends
<ndufresne> there is trick
<ndufresne> so first I use picocom, because it does not have any UI around it
<ndufresne> which often conflicts
<ndufresne> and then you can use stty to set the number of columns and row, which is the bit missing for vi to work
<lissyx> wait I tried to reboot
<ndufresne> (or any terminal ui)
<lissyx> it's not booting anymore
<lissyx> it's trying to boot from ethernet
<ndufresne> how long did that SD card have ben in production ?
<lissyx> complained the ramdisk is corrupted
<lissyx> six months
<ndufresne> I used to have a SD card workflow, and doing compilation on the board to avoid cross-compilation, and SD card would dies every 3 months
<ndufresne> now I use nfsroot, it has other problems, but not as bad
<ndufresne> tftp/nfsroot
<lissyx> it's unlikely to be the problem
<lissyx> it's more likely the attepted ramdisk update that failed prior reboot did screw up the ramdisk
<lissyx> luckily I have a second sd that has the same bug :)
<ndufresne> the u-boot I'm running is "U-Boot 2019.01-02494-g30681b07a5-dirty (Jan 27 2019 - 17:06:02 -0500) Libre Computer Board AML-S905X-CC" (quite scary that it's dirty ;-P)
<lissyx> boots perfectly as well
<lissyx> and no eth
<lissyx> [ 0.000000] Machine model: Libre Technology CC
<ndufresne> I got "Machine model: Libre Computer Board AML-S905X-CC"
<lissyx> hm
<ndufresne> mainline 5.0 rcsomething
<lissyx> yeah
<lissyx> well
<lissyx> obviously there's something wrong with kernel/dtb
<lissyx> its also showing 4.14.52
<lissyx> instead of 4.14.98
<ndufresne> on mainline, for that speific board, it should pick meson-gxl-s905x-libretech-cc.dtb , but also it should match the built kernel
<ndufresne> (at least be newer or equal)
<ndufresne> ok, so it moved from the "Libre Technology CC" to "Libre Computer Board AML-S905X-CC" relatively recently, see commit b7eb0e26cc4a212fde09144cd49d4103170d2b9e
<ndufresne> August 2018
<lissyx> ok
<lissyx> copied boot/ from the second sd to the first one, it's booting again
<ndufresne> and that made it for 4.19-rc4
<ndufresne> so if you are trying to boot 4.14, this string makes sense
<ndufresne> lissyx, btw, to answer you question before you left, I'm in TZ EST
<ndufresne> and I'm using a proxy, so I'm always connected
<lissyx> so same as me
<lissyx> ok
<lissyx> I even forced a mkimage, it is still booting 4.14.52 instead of the 4.14.98 in /boot/
<ndufresne> what does the u-boot script do ?
<ndufresne> do you have a boot.scr file on the SD ?
<ndufresne> or uEnv.txt, or extlinux/
<lissyx> hm
<lissyx> there's a boot.scr
<lissyx> but the start is weird
<lissyx> oh hitt
<lissyx> ndufresne, /boot/uImage is not a symlinl
<lissyx> that's where the 4.14.52 is coming from
<lissyx> hm
<lissyx> uboot searches for uImage
<ndufresne> hmm, not what I would call a proper distro boot
<lissyx> yeah
<lissyx> not sure what's going on
<lissyx> mkimage does not produce a new one
<lissyx> not sure if I use it correctly
<ndufresne> basically it tries uImage and fallback to zImage, so you might just need to fix symlinks
<lissyx> that feels weird that armbian has broken setup
<lissyx> ndufresne, okay to symlink zImage to vmlinuz ?
<ndufresne> we never know what these vmlinuz really are, but best is to try ;-P
<lissyx> sync; reboot;
<lissyx> shitt
<lissyx> ndufresne, do I need to redo mkimage after symlinking zImage to vmlinuz?
<lissyx> it's refusing to boot because "no /boot/uImage"
jelly is now known as jellytoo
<ndufresne> lissyx, ok, so I guess instead of symlink, you should do redo mkimage, overwriting uImage
sputnik_ has joined #linux-amlogic
<lissyx> ndufresne, I've been trying but it's not helping
<ndufresne> but it also means you can't have multiple kernels ready to boot at the same time
<lissyx> symlinking uImage to vmlinuz kinda works
<lissyx> now it complains is missing dtb
<lissyx> it looks like the path are different
jellytoo is now known as jelly
<lissyx> ** File not found boot/dtb/meson-gxl-s905x-libretech-cc.dtb **
<lissyx> what I have is boot/dtb/amlogic/meson-gxl-s905x-libretech-cc.dtb
<ndufresne> and it probably tried boot/dtb/amlogic/ before
<ndufresne> something is not right with the boot.scr, the code is suppose to try and fallback ...
<ndufresne> haha
<ndufresne> try touch boot/.next
<ndufresne> I think I figure-out what the code is doing
jelly is now known as jellytoo
jellytoo is now known as jelly
<lissyx> try touch and then do what?
<ndufresne> reboot, the behaviour of boot.scr changes base on the presence of a .next file
<ndufresne> see "if test -e mmc 0:1 boot/.next; "
<ndufresne> and if this file is present, it will try boot/dtb/amlogic/m...
<lissyx> okay it's a mess
<lissyx> Wrong Image Format for bootm command
<lissyx> ERROR: can't get kernel image!
<lissyx> ndufresne, okay, let's try something, how can I re-generate the uImage ?
<lissyx> sudo mkimage -C none -A arm -T script -d /boot/boot.cmd /boot/boot.scr
<lissyx> I tried that but it's not updating /boot/uImage
<ndufresne> that command simply compile boot.cmd into boot.scr
<ndufresne> something like mkimage -A arm64 -O linux -C none -T kernel -a 0x01080000 -e 0x01080000 -d path/to/kernel/arch/arm64/boot/Image uImage
<ndufresne> but that's for when you do that from the kernel tree
<lissyx> hm
<ndufresne> you could also edit boot.cmd, change bootm -> bootz
<ndufresne> or booti
<ndufresne> and recompile the boot.scr
<lissyx> unknown command bootz
<ndufresne> hmm, ok, with arm64, we don't often compile decompressor loader, so what bootz does is decompress the kernel before booting it, using the bootload decompressor
<ndufresne> that being said, I don't know what type of kernel images you have
<lissyx> manually
<lissyx> it regenerated some uImage?
<lissyx> ho ho
<lissyx> I see a LED lightning on the eth port
<lissyx> and kernel 4.19.20
<lissyx> and network eth0
<ndufresne> good !
<lissyx> so maybe I screwed up when uninstalling -next and forcing non -next dtb/kernel ?
<lissyx> ndufresne, installed -next on one of the remaining online lepotato, it seems /boot/uImage is good
<ndufresne> hard to know what happened
<lissyx> yeah
<lissyx> important is we get something working back
<lissyx> ndufresne, remotely updated one of the others, it worked :)
<ndufresne> great
ldevulder has quit [Ping timeout: 246 seconds]
return0e_ has quit [Ping timeout: 252 seconds]
return0e has joined #linux-amlogic
ldevulder has joined #linux-amlogic
jakogut has quit [Quit: jakogut]
jakogut has joined #linux-amlogic
vagrantc has quit [Ping timeout: 258 seconds]
vagrantc has joined #linux-amlogic
vagrantc_ has joined #linux-amlogic
vagrantc has quit [Ping timeout: 240 seconds]
vagrantc_ is now known as vagrantc