Welcome! Log In Create A New Profile

Advanced

Installing Debian from stock U-Boot/firmware

Posted by haridsv 
Re: Can I install Debian without permanently enabling ssh?
August 30, 2017 11:55PM
bodhi Wrote:
-------------------------------------------------------
> since you have cre
> ated the rootfs on USB, fw_printenv/setenv binary
> is already in the rootfs, which can be executed di
> rectly while in stock OS, or after booting into De
> bian.

For some strange reason, when I first logged in as root, fw_printenv didn't work, so I assumed it was not installed. I just checked and it was there in /usr/bin so not sure what happened. May be I made a typo at that time.

BTW, how about renaming the title of this thread to something more relevant like "Installing Debian on a Flash drive starting from stock U-Boot/firmware" so that it is easier to find for others?
Re: Can I install Debian without permanently enabling ssh?
August 31, 2017 03:30AM
haridsv,

> BTW, how about renaming the title of this thread t
> o something more relevant like "Installing Debian
> on a Flash drive starting from stock U-Boot/firmwa
> re" so that it is easier to find for others?

Good idea! please change it to "Installing Debian from stock U-Boot/firmware", if you can. Or I will.

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
Re: Can I install Debian without permanently enabling ssh?
August 31, 2017 04:05AM
bodhi Wrote:
-------------------------------------------------------
> Good idea! please change it to "Installing Debian
> from stock U-Boot/firmware", if you can. Or I will

I changed the subject for the OP, but I guess it doesn't change it for the replies. However, I verified that the new title shows up in the forum list, so that should be good enough.
Re: Installing Debian from stock U-Boot/firmware
September 03, 2017 11:36AM
To enable netconsole, can I just follow these instructions?
Re: Installing Debian from stock U-Boot/firmware
September 03, 2017 02:39PM
haridsv,

There are 2 parts of netconsole

U-Boot. This is to access U-Boot console, just like using serial console.
http://forum.doozan.com/read.php?3,14

Debian.This enable you to see the dmesg output during boot. But no input.
http://forum.doozan.com/read.php?2,9522

-----

The new u-boot envs already set up netconsole for U-Boot, if you did step 10:

Quote

10. Set up netconsole. It's important to set up neconsole if you don't already have serial console connected. If you've flashed the default environments in step 8 then activate netconsole with the following envs:

fw_setenv preboot_nc 'setenv nc_ready 0; for pingstat in 1 2 3 4 5; do; sleep 1; if run if_netconsole; then setenv nc_ready 1; fi; done; if test $nc_ready -eq 1; then run start_netconsole; fi'
fw_setenv preboot 'run preboot_nc'
fw_setenv ipaddr '192.168.0.xxx'
fw_setenv serverip '192.168.0.yyy'

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
Re: Installing Debian from stock U-Boot/firmware
September 05, 2017 04:56AM
Here is my transcript:
admin@pogoplug:~$ sudo fw_setenv serverip 192.168.1.150
admin@pogoplug:~$ sudo fw_setenv ipaddr 192.168.1.151
admin@pogoplug:~$ sudo fw_setenv if_netconsole 'ping $serverip'
admin@pogoplug:~$ sudo fw_setenv start_netconsole 'setenv ncip $serverip; setenv bootdelay 10; setenv stdin nc; setenv stdout nc; setenv stderr nc; version;'
admin@pogoplug:~$ sudo fw_setenv preboot 'run if_netconsole start_netconsole'

admin@pogoplug:~$ grep netconsole /etc/initramfs-tools/modules
netconsole netconsole=6666@192.168.1.151/eth0,6666@192.168.1.150/

admin@pogoplug:~$ sudo update-initramfs -u
update-initramfs: Generating /boot/initrd.img-4.12.1-kirkwood-tld-1
I: The initramfs will attempt to resume from /dev/sda2
I: (UUID=dfc91059-3ed1-4fe5-9ba5-7adafbc2c65f)
I: Set the RESUME variable to override this.

admin@pogoplug:~$ sudo mkimage -A arm -O linux -T ramdisk -C gzip -a 0x00000000 -e 0x00000000 -n initramfs-4.12.1  -d /boot/initrd.img-4.12.1-kirkwood-tld-1 /boot/uInitrd
update-initramfs: Generating /boot/initrd.img-4.12.1-kirkwood-tld-1
Image Name:   initramfs-4.12.1
Created:      Tue Sep  5 15:15:34 2017
Image Type:   ARM Linux RAMDisk Image (gzip compressed)
Data Size:    7710767 Bytes = 7530.05 kB = 7.35 MB
Load Address: 00000000
Entry Point:  00000000

admin@pogoplug:~$ ls -lrt /boot
total 44596
drwxr-xr-x 2 root root    4096 Jul 16 03:44 dts
-rw-r--r-- 1 root root  153501 Jul 16 08:51 config-4.12.1-kirkwood-tld-1
-rwxr-xr-x 1 root root 3821528 Jul 16 10:12 zImage-4.12.1-kirkwood-tld-1
-rw------- 1 root root 3821528 Jul 16 13:13 vmlinuz-4.12.1-kirkwood-tld-1
-rw------- 1 root root 2504031 Jul 16 13:13 System.map-4.12.1-kirkwood-tld-1
-rw-r--r-- 1 root root 8435004 Jul 16 13:36 linux-headers-4.12.1-kirkwood-tld-1_1.0_armel.deb
-rw-r--r-- 1 root root 3821592 Jul 20 13:41 uImage
-rwxr-xr-x 1 root root 3833423 Aug 29 13:27 zImage.fdt
-rw-r--r-- 1 root root 3833487 Aug 29 21:59 uImage.fdt
-rw-r--r-- 1 root root 7710767 Sep  5 15:03 initrd.img-4.12.1-kirkwood-tld-1
-rw-r--r-- 1 root root 7710831 Sep  5 15:15 uInitrd

Here are a couple of deviations that would like to make sure are OK:
- I had to add "tld-1" to the initrd path, so specified "/boot/initrd.img-4.12.1-kirkwood-tld-1" instead of the suggested "/boot/initrd.img-4.12.1-kirkwood".
- The output of mkimage has the image name as "initramfs-4.12.1" with no "-kirkwood" suffix.
Re: Installing Debian from stock U-Boot/firmware
September 05, 2017 11:19AM
haridsv,

Quote

Here are a couple of deviations that would like to make sure are OK:
- I had to add "tld-1" to the initrd path, so specified "/boot/initrd.img-4.12.1-kirkwood-tld-1" instead of the suggested "/boot/initrd.img-4.12.1-kirkwood".
- The output of mkimage has the image name as "initramfs-4.12.1" with no "-kirkwood" suffix.

kirkwood-tld-1 should be in the suffix. I had some typos in the kernel instruction, but I've corrected it. If you still see something is not right, please let me know where!

Quote

admin@pogoplug:~$ sudo fw_setenv if_netconsole 'ping $serverip'
admin@pogoplug:~$ sudo fw_setenv start_netconsole 'setenv ncip $serverip; setenv bootdelay 10; setenv stdin nc; setenv stdout nc; setenv stderr nc; version;'
admin@pogoplug:~$ sudo fw_setenv preboot 'run if_netconsole start_netconsole'

You don't have to set this up, these are already in the default envs. See:
fw_printenv preboot_nc

Book keeping only: since you are booting with DTB using the new u-boot, the uImage is original. If this is indeed the original uImage
-rw-r--r-- 1 root root 3821592 Jul 20 13:41 uImage
then remove these files, to make it clear (to yourself later):
-rwxr-xr-x 1 root root 3833423 Aug 29 13:27 zImage.fdt
-rw-r--r-- 1 root root 3833487 Aug 29 21:59 uImage.fdt

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
Re: Installing Debian from stock U-Boot/firmware
September 05, 2017 11:49PM
bodhi Wrote:
-------------------------------------------------------
> kirkwood-tld-1 should be in the suffix. I h
> ad some typos in the kernel instruction, but I've
> corrected it. If you still see something is not ri
> ght, please let me know where!

Look at the step 4 of this post, it doesn't have "-tld-1" in the initrd path.

Also, initramfs name has no suffix but I am suspecting that this is just for identification and can be anything, but it looks like the output of mkimage has the exact same name printed as "Image Name":

admin@pogoplug:~$ sudo mkimage ... -n initramfs-4.12.1  ...
...
Image Name:   initramfs-4.12.1
...
admin@pogoplug:~$ sudo mkimage ... -n initramfs-4.12.1-kirkwood-tld-1  ...
...
Image Name:   initramfs-4.12.1-kirkwood-tld-1
...

Considering the above information, your step 4 doesn't seem consistent, which is the other thing I was referring to as deviation. Here is how your output looks:

Quote

4. Generate new uInitrd (reminder: replace the 3.2.28 below with your current kernel version):

mkimage -A arm -O linux -T ramdisk -C gzip -a 0x00000000 -e 0x00000000 -n initramfs-3.2.28 -d /boot/initrd.img-3.2.28-kirkwood /boot/uInitrd
Expected output:
Image Name: initramfs-3.2.28-kirkwood
Created: Wed Sep 5 14:11:38 2012
Image Type: ARM Linux RAMDisk Image (gzip compressed)
Data Size: 6686266 Bytes = 6529.56 kB = 6.38 MB
Load Address: 0x00000000
Entry Point: 0x00000000

Is this again because of some version differences?

> You don't have to set this up, these are already i
> n the default envs.

I have already run these commands, so there is no way to check whether they existed before, but I removed those steps from my personal notes.

> Book keeping only: since you are booting with DTB
> using the new u-boot, the uImage is original. If t
> his is indeed the original uImage
> ...
> then remove these files, to make it clear (to your
> self later):
> ...

What is DTB? BTW, search seems to be partially broken on the forum. Yesterday while searching for something, I didn't find a thread that I knew had that keyword. Today I tried searching for DTB and got no hits, though at least this thread should have showed up.

Nm... found that it means "Device Tree Blob", from this post. Oh, I come across so many new concepts and terms when I go down to this level :)

To answer your question, only these files seem to have been updated since I installed, so the rest should have been the original:
- zImage.fdt
- uImage.fdt
- initrd.img-4.12.1-kirkwood-tld-1
- uInitrd

It looks like update-initramfs generates "initrd.img-4.12.1-kirkwood-tld-1" and mkimage generates "uInitrd". What are all the input files that I need to keep around for their future run to work?
Re: Installing Debian from stock U-Boot/firmware
September 06, 2017 12:10AM
haridsv,

> Look at the step 4 of http://forum.doozan.com/read.php?2,9522, it doesn't have
> "-tld-1" in the initrd path.

I see! it is OK then, because before that, the assumption was:

Quote

Assuming the kernel version is 3.2.28-kirkwood

> Also, initramfs name has no suffix but I am suspec
> ting that this is just for identification and can
> be anything,

> Is this again because of some version differences?

That's true. It's for identification purpose only. The image name could be anything you want it to be.

> Nm... found that it means "Device Tree Blob",
> Oh, I come across so many ne
> w concepts and terms when I go down to this level
> :)

Right :) U-Boot circa 2012 does not have FDT (Flatten Device Tree) capability. The U-Boot images that I've been releasing since 2013 have this capability (that was one of the main reasons why I started doing this, other than having large GPT partition >2TB, and Ext4 file system). All modern kernel versions since Linux 3.16 provide FDT.


>What are all the input files that I need
> to keep around for their future run to work?

These are the whole set of relevant kernel files that should be kept in /boot. config-4.12.1-kirkwood-tld-1 is for convenience only. Other files are needed in case they are used in generating u-boot images, looking up symboles, installing modules...
-rw-r--r-- 1 root root  153501 Jul 16 08:51 config-4.12.1-kirkwood-tld-1
-rwxr-xr-x 1 root root 3821528 Jul 16 10:12 zImage-4.12.1-kirkwood-tld-1
-rw------- 1 root root 3821528 Jul 16 13:13 vmlinuz-4.12.1-kirkwood-tld-1
-rw------- 1 root root 2504031 Jul 16 13:13 System.map-4.12.1-kirkwood-tld-1
-rw-r--r-- 1 root root 8435004 Jul 16 13:36 linux-headers-4.12.1-kirkwood-tld-1_1.0_armel.deb
-rw-r--r-- 1 root root 7710767 Sep  5 15:03 initrd.img-4.12.1-kirkwood-tld-1

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
Re: Installing Debian from stock U-Boot/firmware
September 06, 2017 09:29AM
Thank you!

Would you be help me setup a rescue system that boots the original firmware if the USB drive is not found? Should I just follow the instruction from here?
Re: Installing Debian from stock U-Boot/firmware
September 06, 2017 05:28PM
haridsv,

> Would you be help me setup a rescue system that bo
> ots the original firmware if the USB drive is not
> found? Should I just follow the instruction from [
> url=http://forum.doozan.com/read.php?4,3896]here[/
> url]?

That's Jeff's V2, a good and simple rescue system. Yes, follow that instruction. But before installing that, you need to save your current u-boot envs to a text file. And dump your NAND mtds to keep a back up, if you have not done so,

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
Re: Installing Debian from stock U-Boot/firmware
September 07, 2017 08:07AM
bodhi Wrote:
-------------------------------------------------------
> That's Jeff's V2, a good and simple rescue system.
> Yes, follow that instruction. But before installin
> g that, you need to save your current u-boot envs
> to a text file. And dump your NAND mtds to keep a
> back up, if you have not done so,

I had a quick look at the shell script and I am not too comfortable in running it as is, as it seems to be doing a lot more than what I thought would be needed. Isn't the uboot that I already have capable of booting from mtd2 so that I can get into the factory version of the OS?
Re: Installing Debian from stock U-Boot/firmware
September 07, 2017 04:38PM
haridsv,

> Isn't the uboot that I already have capa
> ble of booting from mtd2 so that I can get into th
> e factory version of the OS?

It is possible, but out of the box the new u-boot wont boot stock OS. You'll need some more non-trivial set up.

Try netconsole and make sure it is working first. And then think about what you want to do next as far as rescue is concerned.

-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: