Welcome! Log In Create A New Profile

Advanced

Pogoplug V4: Boot Kernel from NAND

Posted by schnee 
Pogoplug V4: Boot Kernel from NAND
May 30, 2022 06:51PM
I made a setup to boot my Pogoplug V4 kernel from NAND. The reason was that i wanted to attache a SATA multiplier, but when it is attached the Pogoplug cannot boot from it. It has to use either USB or SD card for the boot, which i don't like. This setup allowed me to boot from SATA with the multiplier attached.

WARNING

!!!! This is a destructive change! It will overwrite the content of the onboard FLASH! !!!

It is recommended to have serial access to the plug, otherwise it is hard to debug if it is not booting.


  • 1 Boot to u-boot /w serial connection
  • 2 modify u-boot variable
      mtdparts
    Original value:
      mtdparts=mtdparts=orion_nand:1M(u-boot),4M(uImage),32M(rootfs),-(data)
    New value:
      setenv mtdparts ‘mtdparts=orion_nand:1M(u-boot),-(data)’
    Save the change
      saveenv
    Reboot
      reset  
  • 3 Login to the terminal after boot
    Erase and format the mtd1 partition
      flash_eraseall -j /dev/mtd1
    Setup the filesystem
    cd /boot ; mkdir flashkernel ; mount -t jffs2 /dev/mtdblock1 /boot/flashkernel/
  • 4 Copy the kernel and dtb files to the new directory
     cp uImage ./flashkernel/ ; cp uInitrd ./flashkernel/ ; mkdir /boot/flashkernel/dts ; cp dts/kirkwood-pogoplug_v4.dtb ./flashkernel/dts 
  • 5 test the setup
    Reboot to u-boot
    Issue the following commands:
chpart data
fsload $load_uimage_addr uImage
fsload $load_initrd_addr uInitrd
fsload $load_dtb_addr dts/kirkwood-pogoplug_v4.dtb
run set_bootargs
bootm $load_uimage_addr $load_initrd_addr $load_dtb_addr
  • 5 If everything goes fine you can update your uboot boot script.

Here is my u-boot setup:
arcNumber=3960
bootargs=console=ttyS0,115200 root=LABEL=rootfs rootdelay=10 mtdparts=orion_nand:1M(u-boot),-(data)
bootcmd=run bootcmd_uenv; run scan_disk; run set_bootargs; if test "$bootdev" = "nand"; then run bootcmd_flash_exec; else run bootcmd_exec; fi
bootcmd_exec=run load_uimage; if run load_initrd; then if run load_dtb; then bootm $load_uimage_addr $load_initrd_addr $load_dtb_addr; else bootm $load_uimage_addr $load_initrd_addr; fi; else if run load_dtb; then bootm $load_uimage_addr - $load_dtb_addr; else bootm $load_uimage_addr; fi; fi
bootcmd_flash_exec=chpart data; run load_nand_uimage; if run load_nand_initrd; then if run_nand_dtb; then bootm 0x800000 0x1100000 0x1c00000; else bootm 0x800000 0x1100000; fi; else if run load_nand_dtb; then bootm 0x800000 - 0x1c00000; fi
bootcmd_uenv=run uenv_load; if test $uenv_loaded -eq 1; then run uenv_import; fi
bootdelay=10
bootdev=nand
device=0:1
devices=usb ide mmc
disks=0 1 2 3
dtb_file=/dts/kirkwood-pogoplug_v4.dtb
ethact=egiga0
ethaddr=00:25:31:XX:XX:XX
fileaddr=800000
filesize=1
if_netconsole=ping $serverip
init_ide=ide reset
init_mmc=mmc rescan
init_usb=usb start
ipaddr=192.168.0.231
led_error=orange blinking
led_exit=green off
led_init=green blinking
load_dtb=echo loading DTB $dtb_file...; load $bootdev $device $load_dtb_addr /boot$dtb_file
load_dtb_addr=0x1c00000
load_initrd=echo loading uInitrd ...; load $bootdev $device $load_initrd_addr /boot/uInitrd
load_initrd_addr=0x1100000
load_nand_dtb=echo loading DTB $dtb_file from nand...; fsload $load_dtb_addr $dtb_file
load_nand_initrd=echo loading uInitrd from nand...; fsload 0x1100000 uInitrd
load_nand_uimage=echo loading uImage from nand...; fsload 0x800000 uImage
load_uimage=echo loading uImage ...; load $bootdev $device $load_uimage_addr /boot/uImage
load_uimage_addr=0x800000
machid=f78
mainlineLinux=yes
mtdids=nand0=orion_nand
mtdparts=mtdparts=orion_nand:1M(u-boot),-(data)
partition=nand0,1
preboot_nc=run if_netconsole start_netconsole
scan_disk=echo running scan_disk ...; scan_done=0; setenv scan_usb "usb start";  setenv scan_ide "ide reset";  setenv scan_mmc "mmc rescan"; for dev in $devices; do if test $scan_done -eq 0; then echo Scan device $dev; run scan_$dev; for disknum in $disks; do if test $scan_done -eq 0; then echo device $dev $disknum:1; if load $dev $disknum:1 $load_uimage_addr /boot/uImage 1; then scan_done=1; echo Found bootable drive on $dev $disknum; setenv device $disknum:1; setenv bootdev $dev; fi; fi; done; fi; done
scan_ide=ide reset
scan_mmc=mmc rescan
scan_usb=usb start
serverip=192.168.0.220
set_bootargs=setenv bootargs console=ttyS0,115200 root=LABEL=rootfs rootdelay=10 $mtdparts $custom_params
start_netconsole=setenv ncip $serverip; setenv bootdelay 10; setenv stdin nc; setenv stdout nc; setenv stderr nc; version;
stderr=serial
stdin=serial
stdout=serial
uenv_addr=0x810000
uenv_import=echo importing envs ...; env import -t $uenv_addr $filesize
uenv_init_devices=setenv init_usb "usb start";  setenv init_ide "ide reset";  setenv init_mmc "mmc rescan"; for devtype in $devices; do run init_$devtype; done;
uenv_load=run uenv_init_devices; setenv uenv_loaded 0; for devtype in $devices;  do for disknum in 0; do run uenv_read_disk; done; done;
uenv_loaded=0
uenv_read=echo loading envs from $devtype $disknum ...; if load $devtype $disknum:1 $uenv_addr /boot/uEnv.txt; then setenv uenv_loaded 1; fi
uenv_read_disk=if test $devtype -eq mmc; then if $devtype part; then run uenv_read;  fi; else if $devtype part $disknum; then run uenv_read; fi;  fi
usb_ready_retry=15

You can add a line to /etc/fstab to mount the flash drive on boot

/dev/mtdblock1  /boot/flashkernel jffs2	defaults 0 1


Good luck!

Schnee



Edited 2 time(s). Last edit at 06/11/2022 01:18PM by schnee.
Re: Pogoplug V4: Boot Kernel from NAND
May 31, 2022 12:49AM
Very nice Schnee!

-bodhi
===========================
Forum Wiki
bodhi's corner
Re: Pogoplug V4: Boot Kernel from NAND
June 16, 2022 06:06PM
Added to the Wiki thread.

Quote

Booting Debian on Pogoplug
...

Booting Pogoplug V4 with Kernel from NAND

-bodhi
===========================
Forum Wiki
bodhi's corner
Author:

Your Email:


Subject:


Spam prevention:
Please, enter the code that you see below in the input field. This is for blocking bots that try to post this form automatically. If the code is hard to read, then just try to guess it right. If you enter the wrong code, a new image is created and you get another chance to enter it right.
Message: