Is there a more official method of detecting if a pyra is a 2 or 4gb model from linux, other than just looking at /proc/meminfo MemTotal ?
Looking at /proc/device-tree/model only seems to give the board revision.
Am 26.06.2019 um 16:28 schrieb aTc atc@k-n-p.org:
Is there a more official method of detecting if a pyra is a 2 or 4gb model from linux, other than just looking at /proc/meminfo MemTotal ?
Yes, that is the official way. It is robust and independent of specific hardware. Like on x86 systems where you can insert new memory modules and the new memory is magically found.
But which problem do you want to solve by this detection from user-space? The only area where it seems to make sense is for system information which reports available and used memory size or for Installers.
There is also a nice command line tool "free" which even hides that /proc/meminfo exists and would be more general and robust against changes to /proc entries.
Looking at /proc/device-tree/model only seems to give the board revision.
It may also be reasonable to look at /proc/device-tree/compatible. But this also does not tell 2GB or 4GB differences. And (currently) does not even tell the board revision.
The task of U-Boot and the kernel is to abstract from specific hardware.
So if you are looking into /proc/device-tree/model to distinguish devices, there is probably something wrong elsewhere.
Yes, there are cases where it must be done that way. LetuxOS for example uses it to find out how to correctly setup the xorg.conf for different devices because Xorg seems not yet to be able to find out everything using the omapdrm kernel API. For example LCD screen size in mm is not yet available elsewhere. At least for older Debian versions and kernels. AFAIK developers are working on that and somewhen it will work and LetuxOS can get rid of checking /proc/device-tree/model.
In summary, it should be avoided to check for a specific device model. Rather, the kernel should be asked for the presence of certain features. E.g. to distinguish between the LTE-EU and LTE-US variants the modem should be turned on and asked for "AT I".
On 6/26/19 4:49 PM, H. Nikolaus Schaller wrote:
Am 26.06.2019 um 16:28 schrieb aTc atc@k-n-p.org:
Is there a more official method of detecting if a pyra is a 2 or 4gb model from linux, other than just looking at /proc/meminfo MemTotal ?
Yes, that is the official way. It is robust and independent of specific hardware. Like on x86 systems where you can insert new memory modules and the new memory is magically found.
But which problem do you want to solve by this detection from user-space? The only area where it seems to make sense is for system information which reports available and used memory size or for Installers.
I was working on the emmc installer script, and want to automatically select the right bootloader.
Although I think the plan was to eventually have a single uboot version that handles both ?
Hi,
Am 26.06.2019 um 16:55 schrieb aTc atc@k-n-p.org:
On 6/26/19 4:49 PM, H. Nikolaus Schaller wrote:
Am 26.06.2019 um 16:28 schrieb aTc atc@k-n-p.org:
Is there a more official method of detecting if a pyra is a 2 or 4gb model from linux, other than just looking at /proc/meminfo MemTotal ?
Yes, that is the official way. It is robust and independent of specific hardware. Like on x86 systems where you can insert new memory modules and the new memory is magically found. But which problem do you want to solve by this detection from user-space? The only area where it seems to make sense is for system information which reports available and used memory size or for Installers.
I was working on the emmc installer script, and want to automatically select the right bootloader.
Ah, ok. I see. Yes, that is one of the very specific areas where it is required (Installer).
Although I think the plan was to eventually have a single uboot version that handles both ?
Well, it is even only the SPL which differs and does different setup of the EMIF. U-Boot is the same for both.
Hm. There is some additional complexity. You will only see more than 2GB MemTotal if an LPAE kernel is running. If you use the correct SPL for 4GB and run a non-LPAE kernel it will simply ignore the additional RAM.
Ok, this case would indeed be more precisely described by the Pyra model.
But what stops us from copying the SPL from the installation SD card to the boot partition of eMMC? If it can boot from SD it should be the right one...
Just some idea.
Am 26.06.2019 um 17:08 schrieb H. Nikolaus Schaller hns@goldelico.com:
Hi,
Am 26.06.2019 um 16:55 schrieb aTc atc@k-n-p.org:
On 6/26/19 4:49 PM, H. Nikolaus Schaller wrote:
Am 26.06.2019 um 16:28 schrieb aTc atc@k-n-p.org:
Is there a more official method of detecting if a pyra is a 2 or 4gb model from linux, other than just looking at /proc/meminfo MemTotal ?
Yes, that is the official way. It is robust and independent of specific hardware. Like on x86 systems where you can insert new memory modules and the new memory is magically found. But which problem do you want to solve by this detection from user-space? The only area where it seems to make sense is for system information which reports available and used memory size or for Installers.
I was working on the emmc installer script, and want to automatically select the right bootloader.
Ah, ok. I see. Yes, that is one of the very specific areas where it is required (Installer).
Although I think the plan was to eventually have a single uboot version that handles both ?
Well, it is even only the SPL which differs and does different setup of the EMIF. U-Boot is the same for both.
Hm. There is some additional complexity. You will only see more than 2GB MemTotal if an LPAE kernel is running. If you use the correct SPL for 4GB and run a non-LPAE kernel it will simply ignore the additional RAM.
Ok, this case would indeed be more precisely described by the Pyra model.
But what stops us from copying the SPL from the installation SD card to the boot partition of eMMC? If it can boot from SD it should be the right one...
On a second thought it is even possible to clone the full boot partition from Installer SD to eMMC. This will include device trees and kernel images. Only the kernel modules must be copied to the rootfs partition.
So a scheme for eMMC installation could be: 1. create partitions in eMMC 2. mount e.g. as /media/rootfs and /media/boot 3. copy /boot to /media/boot 4. install (expand) user OS into the /media/rootfs partition 5. copy /lib/modules to /media/rootfs
BTW: I have used my makesd script for installing a system to eMMC - I just had to find out and specify the different device name. So there is nothing special between eMMC and SD card formatting.