Determine hardware version from commandline

This is the function that works on the BPi M1

Bpiname(){
  sudo mount /dev/mmcblk0p1 /mnt
  grep '^BPINAME' /mnt/.config |grep -o '[^=]*$'
  sudo umount /mnt
}

Outputting: MIKEY Banana Pi BPI v1.0

So after all directories are properly copied to the HDD, just change the file cmdline.txt on /dev/mmcblk0p1, and reboot?

if it is cmdline.txt on your setup…yes…my boards have only uenv.txt…your kernel has builtin-sata-support?

I tried checking for the SATA support, my /proc/config.gz has:

CONFIG_SATA_PMP=y
CONFIG_SW_SATA_AHCI_PLATFORM=y

So to me it seems the SATA support is builtin – right?

(My uEnv.txt only has one line: ethaddr=aa:bb:cc:dd:ee:ff…)

in 5.x/4.x the main-option should be

CONFIG_SATA_AHCI=y
1 Like

I have 3.4.112-sun7i and that option is not present, but all options that have SATA are builtin. If it doesn’t boot on SATA, I guess I could edit the kernel commandline in GRUB and still boot from /dev/mmcblk0

you can leave your sd-card for testing as it is…remember changing fstab on hdd-rootfs to mount right partition (not from sdcard again) :wink:

and then you can change back by editing uboot-config (i don’t think you have grub)

Haha, of course, no GRUB (I never see it booting as it’s normally headless). Thanks for the reminder about fstab on the HDD. So by “editing uboot-config” you mean (in my case) editing cmdline.txt, right?

Is there any chance of booting off a LUKS encrypted partition? I guess that would involve rebuilding the uInitrd – if at all possible.

As i said my config is all in uenv.txt (bpi-r2/r64),i have no cmdline.txt. But if there is your /dev/mmcblkxpy root then try change it there. I guess your uboot is configured to use different files for config.

1 Like

Hi pepa65,

if you running on an armbian-os there will be the file /etc/armbian-release generated with additional informations also about the board used. The two vairables BOARD and BOARD_NAME will be exported, so your shell can use it.

~ ~ ~ ~ ~

pi@bananapi:/etc$ cat /etc/armbian-release

PLEASE DO NOT EDIT THIS FILE

BOARD=bananapi

BOARD_NAME="Banana Pi"

BOARDFAMILY=sun7i BUILD_REPOSITORY_URL=https://github.com/armbian/build BUILD_REPOSITORY_COMMIT=7223cca4 VERSION=5.90 LINUXFAMILY=sunxi BRANCH=next ARCH=arm IMAGE_TYPE=stable BOARD_TYPE=conf INITRD_ARCH=arm KERNEL_IMAGE_TYPE=zImage pi@bananapi:/etc$

pi@bananapi:/etc$ echo $BOARD_NAME

Banana Pi

pi@bananapi:/etc$

~ ~ ~ ~ ~

pi@bananapim2zero:~$ cat /etc/armbian-release

PLEASE DO NOT EDIT THIS FILE

BOARD=bananapim2zero

BOARD_NAME="Banana Pi M2 Zero"

BOARDFAMILY=sun8i VERSION=5.41 LINUXFAMILY=sun8i BRANCH=default ARCH=arm IMAGE_TYPE=user-built BOARD_TYPE=conf INITRD_ARCH=arm KERNEL_IMAGE_TYPE=zImage pi@bananapim2zero:~$ pi@bananapim2zero:~$ echo $BOARD_NAME

Banana Pi M2 Zero

pi@bananapim2zero:~$

~ ~ ~ ~ ~

Regards WolliK

1 Like

echo "$(tr -d '\0' 2>/dev/null </proc/device-tree/model)"