Welcome! Log In Create A New Profile

Advanced

Migration to Debian from Arch - Armv5 Kirkwood boards

Posted by bodhi 
Migration to Debian from Arch - Armv5 Kirkwood boards
February 24, 2022 07:41PM
I've learned recently that Arch Linux ARM has EOL the Kirkwood supports:

https://archlinuxarm.org/forum/viewtopic.php?f=3&t=15721

Migration instruction for those who are currently running Arch on Kirkwood boxes are in the 2 links below.

Migrate from latest Arch installation (written by mlitke):

https://forum.doozan.com/read.php?2,131689,131807#msg-131807

Migrate from older Arch installation (with older Arch u-boots):

https://forum.doozan.com/read.php?3,23727,23727#msg-23727


=======================

Let me know if you can use the instruction and whether I can make it easier.

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)



Edited 1 time(s). Last edit at 02/28/2022 06:40PM by bodhi.
ArchToDebian
Re: Migration to Debian from Arch - Armv5 Kirkwood boards
February 27, 2022 11:48AM
Hi Bodhi,

It would be great if you could dumb it down for us. I have tried at least half a dozen times over the last few years to migrate to Debian but it never seems to work and I always revert back to Arch.


Thanks
Re: Migration to Debian from Arch - Armv5 Kirkwood boards
February 27, 2022 03:47PM
ArchToDebian,

> It would be great if you could dumb it down for
> us. I have tried at least half a dozen times over
> the last few years to migrate to Debian but it
> never seems to work and I always revert back to
> Arch.
>

OK. I need to see the Arch serial bootlog, do you have serial console connected? there are different Arch u-boot versions, and Arch rootfs over the year. It is best that you or someone can help getting these information before I rewrite the instruction.

Basically, boot up, interrupt serial console at countdown, list the u-boot version and the envs.

ver
printenv
and then
boot
Let it boot all the way into Arch. Log in, and then

cat /proc/mtd
cat /etc/fw_env.config
ls -lart /boot

And post the entire serial console boot log here.

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
Re: Migration to Debian from Arch - Armv5 Kirkwood boards
February 28, 2022 02:23PM
bodhi,

First off, thanks for all the work and time you have put into this!

I have been running Arch Linux ARM for years and was sad to see it EOL for these devices, but really glad to see the Debian support continue. I have a little bit of an alternative to your instructions/approach to migrate from Arch. I have tested the steps below on both a Dockstar and a GoFlex Home with success booting Debian on both. For the most part the instructions are the same as yours, with just a couple changes to the U-boot variables that allows for booting both Arch or Debian without having to change U-Boot variables when switching between the two.

The devices I tested were both running the most recent Arch Linux ARM U-Boot. The first thing the serial console reports on boot is:
U-Boot 2016.09.01-1 (Oct 10 2016 - 23:10:58 -0600) Arch Linux ARM
Seagate FreeAgent DockStar
U-Boot 2016.09.01-1 (Oct 10 2016 - 23:11:39 -0600) Arch Linux ARM
Seagate GoFlex Home

---
Here are the procedures I followed (again, these are based on your instructions):

1. Boot into an existing Arch install

2. Ensure the Arch install has been updated with the latest uboot, installing the the uboot package is one way to update to the most recent (uboot-dockstar, uboot-goflexhome, uboot-goflexnet, etc), if you don't already have it, you can get it from the Arch package archive here, the uboot packages in are the arm/alarm/ subdirectory

NOTE: Installing the uboot package will set all U-Boot variables back to defaults.

3. Add a startboot_deb U-Boot variable with the Debian boot procedure:
fw_setenv startboot_deb 'usb start; ide reset; for devtype in usb ide; do  setenv devnum 0; while ${devtype} dev ${devnum}; do  echo ${devtype} found on device ${devnum}; setenv bootpart ${devnum}:1; echo Checking for: ${bootdir}/uEnv.txt ...; if test -e ${devtype} ${bootpart} ${bootdir}/uEnv.txt; then  load ${devtype} ${bootpart} ${loadaddr} ${bootdir}/uEnv.txt; env import -t ${loadaddr} ${filesize}; echo Loaded environment from ${bootdir}/uEnv.txt; echo Checking if uenvcmd is set ...; if test -n ${uenvcmd}; then  echo Running uenvcmd ...; run uenvcmd; fi; fi; if run loadimage; then if env exists root; then echo root has been defined by user; else part uuid ${devtype} ${bootpart} uuid; setenv root PARTUUID=${uuid}; fi;  run mainargs; if run loadfdt; then  if run loadrd; then  bootm ${loadaddr} ${rdaddr}:${filesize} ${fdtaddr}; else  bootm ${loadaddr} - ${fdtaddr}; fi; else  if run loadrd; then echo Booting uImage with initrd;  bootm ${loadaddr} ${rdaddr}:${filesize}; else  bootm ${loadaddr}; fi; fi; else  echo No kernel found; fi; setexpr devnum ${devnum} + 1; done; done;'

4. Update the bootcmd U-Boot variable to include the Debian boot procedure:
fw_setenv bootcmd 'run startboot;run startboot_deb;run bootubi'

5. Power down the device

6. Follow the instructions to create a drive with a Debian (bullseye) rootfs

bodhi's note: While creating Debian rootfs, do not do Step 4. We are booting with the latest Arch u-boot (FDT enabled), the DTB will be loaded separately.


7. Update /boot/uEnv.txt to be:
bootdir=/boot
bootfilem=uImage
fdtdir=/boot/dts
fdtfile=kirkwood-dockstar.dtb
rdfile=uInitrd
root=LABEL=rootfs
loadimage=load ${devtype} ${bootpart} ${loadaddr} ${bootdir}/${bootfilem}

8. Swap the Arch boot drive for the Debian boot drive

9. Boot Debian
---

The default Arch Linux ARM value for the bootcmd U-Boot variable is:
run startboot;run bootubi
so all the above procedure does is try the Debian boot procedure (startboot_deb) if the Arch boot procedure (startboot) fails.

At this point your device should be able to boot both Arch or Debian. As I mentioned above I have tested this procedure with both a Dockstar and a GoFlex Home, but I don't see any reason why it shouldn't work with other devices.

NOTE: If you install the Arch uboot package after running the above procedures, you will have to run the procedures again, since installing the Arch Linux ARM uboot package updates the U-Boot variables to their defaults.

NOTE: If you are going to update the boot arguments (for example to run systemd), the Arch Linux ARM additional boot argument U-Boot variable is optargs, not custom_params. So, for example to run systemd, add the following line to /boot/uEnv.txt:
optargs=init=/bin/systemd

- mlitke

=========================
bodhi's edit: added note to Step 6.



Edited 2 time(s). Last edit at 03/12/2022 10:33PM by bodhi.
Re: Migration to Debian from Arch - Armv5 Kirkwood boards
February 28, 2022 04:16PM
Hi mlitke,

Excellent! I'll add your instruction to the first post.

I'll list all 3 different procedures to make sure people with older Arch installation will know what to expect.

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
Re: Migration to Debian from Arch - Armv5 Kirkwood boards
February 28, 2022 04:40PM
bodhi,

Do you know what default the kernel args are for Debian (cat /proc/cmdline)?

It appears the Arch Linux ARM ones are working okay, but I am curious if there are any differences. The kernel args when booting Debian from the Arch Linux ARM U-Boot with the updates I outlined in the above procedure are:
console=ttyS0,115200 mtdparts=orion_nand:1M(u-boot),-(rootfs) root=LABEL=rootfs rw rootwait

Thanks,
- mlitke
Re: Migration to Debian from Arch - Armv5 Kirkwood boards
February 28, 2022 04:58PM
I found them in your u-boot post. :)

Looks like they are:
console=ttyS0,115200 root=LABEL=rootfs rootdelay=10 mtdparts=orion_nand:1M(u-boot),4M(uImage),32M(rootfs),-(data)

So:
- the order is a little different (and shouldn't matter)
- rootdelay=10 is used instead of rootwait (which in most cases will result in the same behavior)
- root is mounted read/write (I would have to look up what the default is to see if this is different, but it should be fine either way)
- mtdparts is pretty different, will that cause any issues?

Thanks,
- mlitke
Re: Migration to Debian from Arch - Armv5 Kirkwood boards
February 28, 2022 06:35PM
mlitke,

Bootargs are mostly the same (The order is not important). But rootdelay is prefered.

Except for mtdparts, we only care about mtd0. So keep Arch mtdparts, because that's the definition for Arch rescue system in mtd1, if somebody has installed Arch rescue system, it should work fine.

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
ArchToDebian
Re: Migration to Debian from Arch - Armv5 Kirkwood boards
March 11, 2022 02:18PM
Hi Bodhi,

I tried mlitke's procedure and I can't seem to boot into Debian. Here is my netconsole output

U-Boot 2016.09.01-1 (Oct 10 2016 - 23:13:37 -0600) Arch Linux ARM
Pogoplug V4
gcc (GCC) 6.2.1 20160830
GNU ld (GNU Binutils) 2.27
Hit any key to stop autoboot:  0 
Pogoplugv4> 
Pogoplugv4> 
Pogoplugv4> boot
boot
starting USB...
USB0:   USB EHCI 1.00
scanning bus 0 for devices... 1 USB Device(s) found
       scanning usb for storage devices... 0 Storage Device(s) found

Reset IDE: Bus 0: OK Bus 1: not available  
  Device 0: Model: ST9250315AS  Firm: 0003DEM1 Ser#: 5VC1GS51
            Type: Hard Disk
            Supports 48-bit addressing
            Capacity: 238475.1 MB = 232.8 GB (488397168 x 512)
Card did not respond to voltage select!

USB device 0: unknown device

Device 0: Model: ST9250315AS  Firm: 0003DEM1 Ser#: 5VC1GS51
            Type: Hard Disk
            Supports 48-bit addressing
            Capacity: 238475.1 MB = 232.8 GB (488397168 x 512)
... is now current device
ide found on device 0
Checking for: /boot/uEnv.txt ...
188 bytes read in 57 ms (2.9 KiB/s)
Loaded environment from /boot/uEnv.txt
Checking if uenvcmd is set ...
3831876 bytes read in 892 ms (4.1 MiB/s)
root has been defined by user
loading /boot/dts/kirkwood-pogoplug_v4.dtb ...
10284 bytes read in 141 ms (70.3 KiB/s)
7245696 bytes read in 1699 ms (4.1 MiB/s)
Bad Linux ARM zImage magic!

Device 1: not available

Reset IDE: Bus 0: OK Bus 1: not available  
  Device 0: Model: ST9250315AS  Firm: 0003DEM1 Ser#: 5VC1GS51
            Type: Hard Disk
            Supports 48-bit addressing
            Capacity: 238475.1 MB = 232.8 GB (488397168 x 512)

USB device 0: unknown device

Device 0: Model: ST9250315AS  Firm: 0003DEM1 Ser#: 5VC1GS51
            Type: Hard Disk
            Supports 48-bit addressing
            Capacity: 238475.1 MB = 232.8 GB (488397168 x 512)
... is now current device
ide found on device 0
Checking for: /boot/uEnv.txt ...
188 bytes read in 57 ms (2.9 KiB/s)
Loaded environment from /boot/uEnv.txt
Checking if uenvcmd is set ...
3831876 bytes read in 893 ms (4.1 MiB/s)
root has been defined by user
loading /boot/dts/kirkwood-pogoplug_v4.dtb ...
10284 bytes read in 141 ms (70.3 KiB/s)
7245696 bytes read in 1698 ms (4.1 MiB/s)
## Booting kernel from Legacy Image at 00810000 ...
   Image Name:   Linux-4.12.1-kirkwood-tld-1
   Image Type:   ARM Linux Kernel Image (uncompressed)
   Data Size:    3831812 Bytes = 3.7 MiB
   Load Address: 00008000
   Entry Point:  00008000
   Verifying Checksum ... OK
## Loading init Ramdisk from Legacy Image at 01100000 ...
   Image Name:   initramfs-4.12.1-kirkwood-tld-1
   Image Type:   ARM Linux RAMDisk Image (gzip compressed)
   Data Size:    7245632 Bytes = 6.9 MiB
   Load Address: 00000000
   Entry Point:  00000000
   Verifying Checksum ... OK
## Flattened Device Tree blob at 00800000
   Booting using the fdt blob at 0x800000

Here are my printenv settings

printenv
bootcmd=run startboot;run startboot_deb;run bootubi
bootdir=/boot
bootfilem=uImage
bootfilez=zImage
bootubi=echo Trying to boot from NAND ...;if run mountubi; then ubifsload ${loadaddr} /boot/zImage;ubifsload ${fdtaddr} /boot/dtbs/kirkwood-pogoplugv4.dtb; ubifsumount; setenv bootargs console=${console} ubi.mtd=1 root=ubi0:rootfs ro rootfstype=ubifs  rootwait ${mtdparts};bootz ${loadaddr} - ${fdtaddr};fi
console=ttyS0,115200
ethact=egiga0
ethaddr=00:25:31:05:08:77
fdtaddr=0x800000
fdtdir=/boot/dtbs
fdtfile=kirkwood-pogoplug-series-4.dtb
ipaddr=10.10.10.3
loadaddr=0x810000
loadfdt=echo loading ${fdtdir}/${fdtfile} ...; load ${devtype} ${bootpart} ${fdtaddr} ${fdtdir}/${fdtfile}
loadimage=load ${devtype} ${bootpart} ${loadaddr} ${bootdir}/${bootfilez} || load ${devtype} ${bootpart} ${loadaddr} ${bootdir}/${bootfilem}
loadrd=load ${devtype} ${bootpart} ${rdaddr} ${bootdir}/${rdfile}
mainargs=setenv bootargs console=${console} ${mtdparts} root=${root} rw rootwait ${optargs} ${ncargs}
mountubi=ubi part rootfs; ubifsmount ubi0:rootfs
mtdids=nand0=orion_nand
mtdparts=mtdparts=orion_nand:1M(u-boot),-(rootfs)
ncargs=ignore_loglevel netconsole=6665@10.10.10.3/eth0,6666@10.10.10.4/
ncip=10.10.10.5
ncipk=10.10.10.4
netconsole=on
preboot=if env exists netconsole && test ${netconsole} = on; then if ping ${ncip}; then  setenv stdin nc; setenv stdout nc;  setenv stderr nc; version; if env exists ncargsusr; then echo ncargs has been defined by user; setenv ncargs ${ncargsusr}; else setenv ncargs ignore_loglevel netconsole=6665@${ipaddr}/eth0,6666@${ncipk}/; fi; fi; else echo Netconsole has been turned off.; echo To turn it on, set netconsole variable to on.; setenv stdin; setenv stdout; setenv stderr; setenv ncargs; fi
rdaddr=0x1100000
rdfile=initramfs-linux.img
startboot=usb start; ide reset; for devtype in mmc usb ide; do  setenv devnum 0; while ${devtype} dev ${devnum}; do  echo ${devtype} found on device ${devnum}; setenv bootpart ${devnum}:1; echo Checking for: ${bootdir}/uEnv.txt ...; if test -e ${devtype} ${bootpart} ${bootdir}/uEnv.txt; then  load ${devtype} ${bootpart} ${loadaddr} ${bootdir}/uEnv.txt; env import -t ${loadaddr} ${filesize}; echo Loaded environment from ${bootdir}/uEnv.txt; echo Checking if uenvcmd is set ...; if test -n ${uenvcmd}; then  echo Running uenvcmd ...; run uenvcmd; fi; fi; if run loadimage; then if env exists root; then echo root has been defined by user; else part uuid ${devtype} ${bootpart} uuid; setenv root PARTUUID=${uuid}; fi;  run mainargs; if run loadfdt; then  if run loadrd; then  bootz ${loadaddr} ${rdaddr}:${filesize} ${fdtaddr}; else  bootz ${loadaddr} - ${fdtaddr}; fi; else  if run loadrd; then echo Booting uImage with initrd;  bootm ${loadaddr} ${rdaddr}:${filesize}; else  bootm ${loadaddr}; fi; fi; else  echo No kernel found; fi; setexpr devnum ${devnum} + 1; done; done;
startboot_deb=usb start; ide reset; for devtype in usb ide; do  setenv devnum 0; while ${devtype} dev ${devnum}; do  echo ${devtype} found on device ${devnum}; setenv bootpart ${devnum}:1; echo Checking for: ${bootdir}/uEnv.txt ...; if test -e ${devtype} ${bootpart} ${bootdir}/uEnv.txt; then  load ${devtype} ${bootpart} ${loadaddr} ${bootdir}/uEnv.txt; env import -t ${loadaddr} ${filesize}; echo Loaded environment from ${bootdir}/uEnv.txt; echo Checking if uenvcmd is set ...; if test -n ${uenvcmd}; then  echo Running uenvcmd ...; run uenvcmd; fi; fi; if run loadimage; then if env exists root; then echo root has been defined by user; else part uuid ${devtype} ${bootpart} uuid; setenv root PARTUUID=${uuid}; fi;  run mainargs; if run loadfdt; then  if run loadrd; then  bootm ${loadaddr} ${rdaddr}:${filesize} ${fdtaddr}; else  bootm ${loadaddr} - ${fdtaddr}; fi; else  if run loadrd; then echo Booting uImage with initrd;  bootm ${loadaddr} ${rdaddr}:${filesize}; else  bootm ${loadaddr}; fi; fi; else  echo No kernel found; fi; setexpr devnum ${devnum} + 1; done; done;
stderr=nc
stdin=nc
stdout=nc

Environment size: 4027/131068 bytes

And finally my uEnv.txt

bootdir=/boot
bootfilem=uImage
fdtdir=/boot/dts
fdtfile=kirkwood-pogoplug_v4.dtb
rdfile=uInitrd
root=LABEL=rootfs
loadimage=load ${devtype} ${bootpart} ${loadaddr} ${bootdir}/${bootfilem}

Oh, I'm also using Debian-4.12.1-kirkwood-tld-1-rootfs-bodhi.tar.bz2. I tried with bullseye as well and have the same results

Thanks!
Re: Migration to Debian from Arch - Armv5 Kirkwood boards
March 11, 2022 03:13PM
ArchToDebian,

Add this to uEnv.txt

rdaddr=0x2100000
And boot again.

================

Note that after this,

## Booting kernel from Legacy Image at 00810000 ...
   Image Name:   Linux-4.12.1-kirkwood-tld-1
   Image Type:   ARM Linux Kernel Image (uncompressed)
   Data Size:    3831812 Bytes = 3.7 MiB
   Load Address: 00008000
   Entry Point:  00008000
   Verifying Checksum ... OK
## Loading init Ramdisk from Legacy Image at 01100000 ...
   Image Name:   initramfs-4.12.1-kirkwood-tld-1
   Image Type:   ARM Linux RAMDisk Image (gzip compressed)
   Data Size:    7245632 Bytes = 6.9 MiB
   Load Address: 00000000
   Entry Point:  00000000
   Verifying Checksum ... OK
## Flattened Device Tree blob at 00800000
   Booting using the fdt blob at 0x800000

Arch uboot netconsole does not output any kernel activity during booting. My uboot has another line of output to show the kernel is starting.

So what you need to do is: wait until the LED turns solid green, and then

1. Look for the new IP address in the router, or use some scanning apps such as Linux nmap or IOS Fing to find this box.

2.You can also try pinging the hostname:

ping debian.local

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
ArchtoDebian
Re: Migration to Debian from Arch - Armv5 Kirkwood boards
March 12, 2022 05:44PM
Added the line to uEnv.txt and tried again. Nothing happened.

The light on the pogoplug does turn to orange and back to green again but I cannot connect to the device, nor can I ping it or anything.

Any ideas?
Re: Migration to Debian from Arch - Armv5 Kirkwood boards
March 12, 2022 07:05PM
ArchtoDebian,

On closer look, I am pretty sure that the problem is with your rootfs.

You have created the rootfs with Step 4 done (it should not be done). You are running a modern u-boot.

Quote

4. Create uImage with embedded DTB for booting with older u-boots (2012 or earlier). Skip this step if you have installed the latest U-Boot for Kirkwood (or are installing this u-boot at the same time).

Please replace kirkwood-goflexnet.dtb below with the correct DTB name for your box (see the folder /media/sdb1/boot/dts for the exact spelling of your Kirkwood box name).

Generate the uImage with DTB embedded inside:
cd /media/sdb1/boot
cp -a zImage-4.12.1-kirkwood-tld-1 zImage.fdt
cat dts/kirkwood-goflexnet.dtb >> zImage.fdt
mv uImage uImage.orig
mkimage -A arm -O linux -T kernel -C none -a 0x00008000 -e 0x00008000 -n Linux-4.12.1-kirkwood-tld-1 -d zImage.fdt uImage
sync

Mount it on another Linux box. Assuming it is mounted at /media/sdb1

ls -lart /media/sdb1/boot

So if in /boot folder you see zImage.fdt and uImage.orig, reverse that Step 4 as follow:

cd /media/sdb1/boot
cp -a uImage uImage.pogo_v4_dtb
cp -a uImage.orig uImage
sync

Also check then rootfs label, make sure that it is rootfs

e2label /dev/sdb1

Umount the rootfs, take it back to the pogo V4 and boot with it.

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)



Edited 1 time(s). Last edit at 03/12/2022 07:15PM by bodhi.
ArchtoDebian
Re: Migration to Debian from Arch - Armv5 Kirkwood boards
March 13, 2022 12:51AM
Yes, Step 4 was the problem. I logged into the Debian system!

Thank you. I finally have managed to achieve the goal that I started years ago :)
Re: Migration to Debian from Arch - Armv5 Kirkwood boards
March 13, 2022 04:08PM
Congrats :)

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
Re: Migration to Debian from Arch - Armv5 Kirkwood boards
March 24, 2022 09:08AM
Hi,

First: thank you for making this change easy. I too had been eyeing the change to Debian for years and inertia (let's call it what it is: laziness) meant it just never happened. Until now.

The 2 issues I've experienced might be nice to have in this one place for others making the change:

1)USB3 is borked on the newest kernel (as noted elsewhere, with workaround, thank you). Which means going with 5.15.5 from 01-Dec-2021. Ok, no worries there.

2)ssh-agent is operating in a way that I'm unfamiliar with. I'm hoping someone on here can steer me in the right direction.

If I do a ps aux | grep ssh-agent, it shows up running. Great. I've setup pam.d/sudo to allow it to auth sudo via publickey (same one used for logon - which is awesome when it works). But it doesn't work. Unless I first `eval $(ssh-agent)` and then ssh-add. When doing that, I am asked to authenticate that one time. After which pam.d does work in a way in which I was familiar.

I discovered this after investigating "Could not open a connection to your authentication agent." FWIW.

My question is: do I need to inject that `eval $(ssh-agent)` somewhere? If so, where? How? I want to be able to use ssh-agent without having to manually do those 2 steps every time I first logon.

Thank you!
Jiggins



Edited 1 time(s). Last edit at 03/24/2022 09:09AM by jiggins.
Re: Migration to Debian from Arch - Armv5 Kirkwood boards
March 24, 2022 03:21PM
jiggins,


> My question is: do I need to inject that `eval
> $(ssh-agent)` somewhere? If so, where? How? I
> want to be able to use ssh-agent without having to
> manually do those 2 steps every time I first
> logon.

The easiest way to run that is to add it to /etc/rc.local. Try add that line to after the
ssh-keygen -A
Note that the ssh-keygen -A is run only once at first boot. You already booted the rootfs once, so it will not regerate the key.

There are better place in the rootfs to do this. However, /etc/rc.local is the last script run by Debian during booting. Adding action to this does not require regeneration of kernel files, so it is convenient.

And if an action is specific to a user, that runs only when logon, then add it to this file.

/home/user/.profile

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)



Edited 2 time(s). Last edit at 03/24/2022 03:24PM by bodhi.
Re: Migration to Debian from Arch - Armv5 Kirkwood boards
March 24, 2022 05:14PM
No joy with the mod of /etc/rc.local nor ~/.profile.

I did run across the link below, but it seems a bit much to install systemd solely for the sake of getting ssh-agent to work?

Howto auto-start ssh-agent on Debian Bullseye

Hopefully somebody has an idea???
Re: Migration to Debian from Arch - Armv5 Kirkwood boards
March 25, 2022 08:40PM
Re: Migration to Debian from Arch - Armv5 Kirkwood boards
April 27, 2022 10:45AM
Any hint on what went wrong below? I followed mlitke's post, changed the dtb to pogoplug_e02 and used ext4.

(rescue)[root@alarm boot]# mount | grep sda
/dev/sda1 on /mnt type ext4 (rw,relatime,data=ordered)
(rescue)[root@alarm boot]# cat uEnv.txt 
bootdir=/boot
bootfilem=uImage
fdtdir=/boot/dts
fdtfile=kirkwood-pogo_e02.dtb
rdfile=uInitrd
root=LABEL=rootfs
loadimage=load ${devtype} ${bootpart} ${loadaddr} ${bootdir}/${bootfilem}
(rescue)[root@alarm boot]# e2label /dev/sda1
rootfs
(rescue)[root@alarm boot]# fw_printenv 
bootdir=/boot
bootfilem=uImage
bootfilez=zImage
bootubi=echo Trying to boot from NAND ...;if run mountubi; then ubifsload ${loadaddr} /boot/zImage;ubifsload ${fdtaddr} /boot/dtbs/${fdtfile};ubifsumount; setenv bootargs console=${console} ubi.mtd=1 root=ubi0:rootfs ro rootfstype=ubifs  rootwait ${mtdparts};bootz ${loadaddr} - ${fdtaddr};fi
console=ttyS0,115200
ethact=egiga0
fdtaddr=0x800000
fdtdir=/boot/dtbs
fdtfile=kirkwood-pogo_e02.dtb
ipaddr=10.10.10.3
loadaddr=0x810000
loadfdt=echo loading ${fdtdir}/${fdtfile} ...; load ${devtype} ${bootpart} ${fdtaddr} ${fdtdir}/${fdtfile}
loadimage=load ${devtype} ${bootpart} ${loadaddr} ${bootdir}/${bootfilez} || load ${devtype} ${bootpart} ${loadaddr} ${bootdir}/${bootfilem}
loadrd=load ${devtype} ${bootpart} ${rdaddr} ${bootdir}/${rdfile}
mainargs=setenv bootargs console=${console} ${mtdparts} root=${root} rw rootwait ${optargs} ${ncargs}
mountubi=ubi part rootfs; ubifsmount ubi0:rootfs
mtdids=nand0=orion_nand
mtdparts=mtdparts=orion_nand:1M(u-boot),-(rootfs)
ncip=10.10.10.5
ncipk=10.10.10.4
netconsole=on
preboot=if env exists netconsole && test ${netconsole} = on; then if ping ${ncip}; then  setenv stdin nc; setenv stdout nc;  setenv stderr nc; version; if env exists ncargsusr; then echo ncargs has been defined by user; setenv ncargs ${ncargsusr}; else setenv ncargs ignore_loglevel netconsole=6665@${ipaddr}/eth0,6666@${ncipk}/; fi; fi; else echo Netconsole has been turned off.; echo To turn it on, set netconsole variable to on.; setenv stdin; setenv stdout; setenv stderr; setenv ncargs; fi
rdaddr=0x1100000
rdfile=initramfs-linux.img
startboot=usb start; for devtype in usb ; do  setenv devnum 0; while ${devtype} dev ${devnum}; do  echo ${devtype} found on device ${devnum}; setenv bootpart ${devnum}:1; echo Checking for: ${bootdir}/uEnv.txt ...; if test -e ${devtype} ${bootpart} ${bootdir}/uEnv.txt; then  load ${devtype} ${bootpart} ${loadaddr} ${bootdir}/uEnv.txt; env import -t ${loadaddr} ${filesize}; echo Loaded environment from ${bootdir}/uEnv.txt; echo Checking if uenvcmd is set ...; if test -n ${uenvcmd}; then  echo Running uenvcmd ...; run uenvcmd; fi; fi; if run loadimage; then if env exists root; then echo root has been defined by user; else part uuid ${devtype} ${bootpart} uuid; setenv root PARTUUID=${uuid}; fi;  run mainargs; if run loadfdt; then  if run loadrd; then  bootz ${loadaddr} ${rdaddr}:${filesize} ${fdtaddr}; else  bootz ${loadaddr} - ${fdtaddr}; fi; else  if run loadrd; then echo Booting uImage with initrd;  bootm ${loadaddr} ${rdaddr}:${filesize}; else  bootm ${loadaddr}; fi; fi; else  echo No kernel found; fi; setexpr devnum ${devnum} + 1; done; done;
ethaddr=xx:xx:xx:xx:xx:xx
startboot_deb=usb start; ide reset; for devtype in usb ide; do  setenv devnum 0; while ${devtype} dev ${devnum}; do  echo ${devtype} found on device ${devnum}; setenv bootpart ${devnum}:1; echo Checking for: ${bootdir}/uEnv.txt ...; if test -e ${devtype} ${bootpart} ${bootdir}/uEnv.txt; then  load ${devtype} ${bootpart} ${loadaddr} ${bootdir}/uEnv.txt; env import -t ${loadaddr} ${filesize}; echo Loaded environment from ${bootdir}/uEnv.txt; echo Checking if uenvcmd is set ...; if test -n ${uenvcmd}; then  echo Running uenvcmd ...; run uenvcmd; fi; fi; if run loadimage; then if env exists root; then echo root has been defined by user; else part uuid ${devtype} ${bootpart} uuid; setenv root PARTUUID=${uuid}; fi;  run mainargs; if run loadfdt; then  if run loadrd; then  bootm ${loadaddr} ${rdaddr}:${filesize} ${fdtaddr}; else  bootm ${loadaddr} - ${fdtaddr}; fi; else  if run loadrd; then echo Booting uImage with initrd;  bootm ${loadaddr} ${rdaddr}:${filesize}; else  bootm ${loadaddr}; fi; fi; else  echo No kernel found; fi; setexpr devnum ${devnum} + 1; done; done;
bootcmd=run startboot;run startboot_deb;run bootubi
(rescue)[root@alarm boot]#


U-Boot 2016.09.01-1 (Oct 10 2016 - 23:12:58 -0600) Arch Linux ARM
Pogo E02
gcc (GCC) 6.2.1 20160830
GNU ld (GNU Binutils) 2.27
Hit any key to stop autoboot:  0 
starting USB...
USB0:   USB EHCI 1.00
scanning bus 0 for devices... 3 USB Device(s) found
       scanning usb for storage devices... 1 Storage Device(s) found

USB device 0: 
    Device 0: Vendor: SanDisk  Rev: 0.2  Prod: Cruzer Mini     
            Type: Removable Hard Disk
            Capacity: 977.4 MB = 0.9 GB (2001888 x 512)
... is now current device
usb found on device 0
Checking for: /boot/uEnv.txt ...
Unsupported feature found (64bit, possibly metadata_csum), not mounting
Failed to mount ext2 filesystem...
** Unrecognized filesystem type **
Unsupported feature found (64bit, possibly metadata_csum), not mounting
Failed to mount ext2 filesystem...
** Unrecognized filesystem type **
Unsupported feature found (64bit, possibly metadata_csum), not mounting
Failed to mount ext2 filesystem...
** Unrecognized filesystem type **
No kernel found

USB device 1: unknown device
Unknown command 'ide' - try 'help'

USB device 0: 
    Device 0: Vendor: SanDisk  Rev: 0.2  Prod: Cruzer Mini     
            Type: Removable Hard Disk
            Capacity: 977.4 MB = 0.9 GB (2001888 x 512)
... is now current device
usb found on device 0
Checking for: /boot/uEnv.txt ...
Unsupported feature found (64bit, possibly metadata_csum), not mounting
Failed to mount ext2 filesystem...
** Unrecognized filesystem type **
Unsupported feature found (64bit, possibly metadata_csum), not mounting
Failed to mount ext2 filesystem...
** Unrecognized filesystem type **
Unsupported feature found (64bit, possibly metadata_csum), not mounting
Failed to mount ext2 filesystem...
** Unrecognized filesystem type **
No kernel found

USB device 1: unknown device
Unknown command 'ide' - try 'help'
Trying to boot from NAND ...
ubi0: attaching mtd1
ubi0: scanning is finished
ubi0: attached mtd1 (name "mtd=1", size 127 MiB)
ubi0: PEB size: 131072 bytes (128 KiB), LEB size: 129024 bytes
ubi0: min./max. I/O unit sizes: 2048/2048, sub-page size 512
ubi0: VID header offset: 512 (aligned 512), data offset: 2048
ubi0: good PEBs: 1016, bad PEBs: 0, corrupted PEBs: 0
ubi0: user volume: 1, internal volumes: 1, max. volumes count: 128
ubi0: max/mean erase counter: 4/2, WL threshold: 4096, image sequence number: 586836495
ubi0: available PEBs: 0, total reserved PEBs: 1016, PEBs reserved for bad PEB handling: 20
Loading file '/boot/zImage' to addr 0x00810000...
Done
Loading file '/boot/dtbs/kirkwood-pogo_e02.dtb' to addr 0x00800000...
Done
Unmounting UBIFS volume rootfs!
Kernel image @ 0x810000 [ 0x000000 - 0x3f05c8 ]
## Flattened Device Tree blob at 00800000
   Booting using the fdt blob at 0x800000

My ALARM still boots.
U-Boot 2016.09.01-1 (Oct 10 2016 - 23:12:58 -0600) Arch Linux ARM
Pogo E02
gcc (GCC) 6.2.1 20160830
GNU ld (GNU Binutils) 2.27
Hit any key to stop autoboot:  3                                                                                                                     0 
starting USB...
USB0:   USB EHCI 1.00
scanning bus 0 for devices... 3 USB Device(s) found
       scanning usb for storage devices... 1 Storage Device(s) found

USB device 0: 
    Device 0: Vendor: FUJITSU  Rev:  Prod: MHV2060AH       
            Type: Hard Disk
            Capacity: 57231.5 MB = 55.8 GB (117210240 x 512)
... is now current device
usb found on device 0
Checking for: /boot/uEnv.txt ...
6232576 bytes read in 449 ms (13.2 MiB/s)
loading /boot/dtbs/kirkwood-pogo_e02.dtb ...
10108 bytes read in 841 ms (11.7 KiB/s)
7763674 bytes read in 694 ms (10.7 MiB/s)
Kernel image @ 0x810000 [ 0x000000 - 0x5f1a00 ]
## Flattened Device Tree blob at 00800000
   Booting using the fdt blob at 0x800000



Edited 2 time(s). Last edit at 04/27/2022 11:09AM by pm4888.
Re: Migration to Debian from Arch - Armv5 Kirkwood boards
April 27, 2022 11:06AM
Did you try formatting to ext3? If I remember correctly, I tried ext4 and it did not work for me.

I also just found this in bodhi's install thread:
Quote

If you are running the latest U-Boot for Kirkwood then you can use Ext4. But be aware that Ext4 file system format needs to be "finalized" before it can be used for booting.

Did you finalize the file system (I am not quite sure what that means)?

- mlitke



Edited 1 time(s). Last edit at 04/27/2022 11:09AM by mlitke.
Re: Migration to Debian from Arch - Armv5 Kirkwood boards
April 27, 2022 11:40AM
ext3 it is. This really catches me by surprise. Now that I check my alarm again it's also ext3. Perhaps alarm uboot doesnt support ext4 I wonder.

I didn't give "finalized" much thought and use "sync" before reboot, because of ext4 and the journal/cache.

Do you also replace alarm uboot with debian uboot, and alarm rescue with openwrt?
debian uboot supports ext4 as a listed feature

the uboot files at least the one for pogo e02 are blocked by bitly
https://forum.doozan.com/read.php?3,12381



Edited 3 time(s). Last edit at 04/27/2022 11:49AM by pm4888.
Re: Migration to Debian from Arch - Armv5 Kirkwood boards
April 27, 2022 01:07PM
I always run sync too, but I don't think that "finalizes" the file system. The bit of research I did after last posting leads me to believe the finalizing is forcing the ext4 file system to finish creating the inode table. I think the default when creating a new ext4 file system is to create part of the inode table, and then after the system boots, it will finish creating the table as a background task (when the file system is first mounted).

I left the alarm uboot installed, since I wanted to be able to boot both (the last version of) alarm and debian. I never installed a rescue, since I updated all my devices to have serial console access. You certainly can install both the debian uboot and rescue, but if you do that, I believe you can just follow the regular debian install instructions, since you are no longer migrating from alarm.

- mlitke



Edited 1 time(s). Last edit at 04/27/2022 01:17PM by mlitke.
Re: Migration to Debian from Arch - Armv5 Kirkwood boards
April 27, 2022 01:17PM
From the mkfs.ext4 man page:


lazy_itable_init[= <0 to disable, 1 to enable>]
                          If enabled and the uninit_bg feature is enabled, the
                          inode table will not be fully initialized by mke2fs.
                          This speeds up file  system  initialization  notice-
                          ably,  but it requires the kernel to finish initial-
                          izing the file system in  the  background  when  the
                          file  system  is first mounted.  If the option value
                          is omitted, it defaults to 1 to  enable  lazy  inode
                          table zeroing.

Re: Migration to Debian from Arch - Armv5 Kirkwood boards
April 27, 2022 03:01PM
I still have alarm rescue in the flash so I'll keep the alarm uboot for now.

Normally with debootstrap to prepare a disk and a boot loader it's good to go to setup a system. However I dont know how to approach these devices especially when kernel needs to be customized and dts files are involved. E.g. what it takes to prepare a debian11 system?

I think it's an alarm uboot limitation when it comes to ext4.
Re: Migration to Debian from Arch - Armv5 Kirkwood boards
April 27, 2022 03:02PM
pm4888,

My new u-boot supports Ext4. So you can use Ext4 rootfs. But you do need to finalize the rootfs formatting right away.

> I didn't give "finalized" much thought and use
> "sync" before reboot, because of ext4 and the
> journal/cache.

Sync does not do anything to an Ext4 file system during lazy_init.

> the uboot files at least the one for pogo e02 are
> blocked by bitly
> https://forum.doozan.com/read.php?3,12381

Thanks! Bitly is acting weird lately. Looks like I need to update the installatin post to include the direct Dropbox link.

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)



Edited 1 time(s). Last edit at 04/27/2022 03:32PM by bodhi.
Re: Migration to Debian from Arch - Armv5 Kirkwood boards
April 27, 2022 03:09PM
> Normally with debootstrap to prepare a disk and a
> boot loader it's good to go to setup a system.
> However I dont know how to approach these devices
> especially when kernel needs to be customized and
> dts files are involved. E.g. what it takes to
> prepare a debian11 system?

With the Pogo E02 you can use the Debian debootstrap rootfs. You just need to tweak the settings a bit. Basically, install as if it is a Sheevaplug, and then replace the DTB. But be careful not to update u-boot.

Just make a debootstrap rootfs and plug into this box, mount it. Come back and I ask a few questions, and show you how to do it.

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
Re: Migration to Debian from Arch - Armv5 Kirkwood boards
April 27, 2022 04:03PM
like this? what's next?

root@debian:/# apt install debootstrap
root@debian:/# mkdir /bullseye
root@debian:/# /usr/sbin/debootstrap stable /bullseye/ http://deb.debian.org/debian/
Re: Migration to Debian from Arch - Armv5 Kirkwood boards
April 27, 2022 06:38PM
pm4888,

You could just create the rootfs Debian-5.13.6-kirkwood-tld-1-rootfs-bodhi.tar.bz2 and use it.

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
Re: Migration to Debian from Arch - Armv5 Kirkwood boards
April 27, 2022 07:37PM
bodhi Wrote:
-------------------------------------------------------
> pm4888,
>
> You could just create the rootfs
> Debian-5.13.6-kirkwood-tld-1-rootfs-bodhi.tar.bz2
> and use it.


bodhi,

To clarify I was able to get debian running on Pogoplug E02 with alarm uboot and your debian rootfs by following mlitke's post. The problem I ran into was I think that alarm uboot doesn't support ext4 and ext3 works just fine.

The question I now have is how to build a debian environment(the kernel, the dts file, systemd and so on), essentially how you prepared the rootfs. This doesn't have to be done from within a debian system but here I am:

root@debian:/# apt install debootstrap
root@debian:/# mkdir /bullseye
root@debian:/# /usr/sbin/debootstrap stable /bullseye/ http://deb.debian.org/debian/
root@debian:~# chroot /bullseye/
root@debian:/# cat /etc/apt/sources.list
deb http://deb.debian.org/debian stable main
root@debian:/# dpkg -l|egrep 'systemd|linux'
ii  libselinux1:armel        3.1-3                        armel        SELinux runtime shared libraries
ii  libsystemd0:armel        247.3-7                      armel        systemd utility library
ii  systemd                  247.3-7                      armel        system and service manager
ii  systemd-sysv             247.3-7                      armel        system and service manager - SysV links
ii  util-linux               2.36.1-8+deb11u1             armel        miscellaneous system utilities

And I am considering to replace alarm uboot with your newer uboot(just need the files)
(I compare alarm startboot and debian startboot_deb settings the difference is essentially bootz vs bootm.
I don't have alarm on usb anymore and bootubi looks straightforward to me and should work with your uboot.)
Re: Migration to Debian from Arch - Armv5 Kirkwood boards
April 27, 2022 08:26PM
pm4888,

What you did was creating a Debian debootstrap rootfs. But you also need to install a kernel to run it.

There are several more steps to be done before you can use this debootstrap rootfs. That was the reason I created a basic rootfs and provided it for general consumption.

===========

There are 3 differerent paths to get this box running.

1. Download my basic rootfs and run it as is, with my released u-boot. You'll need to install userland packages such as Samba,... and whatever else you need.

2. Use Debian netinstall to install Sheevaplug box on this box. That will give you a basic debootstrap rootfs with Marvell kernel. And then do a few more tweaks to run the Pogo E02 DTB, to make it complete.

3. Creating a Debian debootstrap rootfs (like you did), and then install a mainline kernel, or my latest custom kernel linux-5.16.5-kirkwood-tld-1-bodhi.tar.bz2. This approach is the most time consuming, since Debian debootstrap will give you an even more minimal rootfs than my basic rootfs.

So what I said above was

Quote

With the Pogo E02 you can use the Debian debootstrap rootfs. You just need to tweak the settings a bit. Basically, install as if it is a Sheevaplug, and then replace the DTB. But be careful not to update u-boot.

Just make a debootstrap rootfs and plug into this box, mount it. Come back and I ask a few questions, and show you how to do it.

meaning don't do it from scratch if you can avoid it.

If you insist on using a rootfs created by debootstrap, then use option 2 above. Because a Marvell Kirkwood Debian rootfs is the same for all Kirkwood boxes. Once you have it, you can chroot into it and tweak it using my Pogo E02 DTB to run it properly. There is no Pogo E02 support in mainline so you need a downstream DTB such the one I provided.

And later, you can also use the DTS inlcuded in my kernel tarball to compile your own DTB.

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
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: