Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix booting from kernel for non-ubifs rootfs #41

Open
wants to merge 1 commit into
base: 2015.10
Choose a base branch
from

Conversation

abhimanyuv1
Copy link

Openwrt have squashfs rootfs but legacy and other variant uses ubifs
rootfs. To make all compatible dont pass root= for kernel booting
from kernel ubi volume. For others, pass root= to correctly identify
rootfs filesystem.

Tested with legacy openwrt and new openwrt image.

Signed-off-by: Abhimanyu Vishwakarma [email protected]

Openwrt have squashfs rootfs but legacy and other variant uses ubifs
rootfs. To make all compatible dont pass root= for kernel booting
from kernel ubi volume. For others, pass root= to correctly identify
rootfs filesystem.

Signed-off-by: Abhimanyu Vishwakarma <[email protected]>
Ham22
Ham22 previously requested changes Mar 20, 2017
Copy link
Member

@Ham22 Ham22 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll give it a test but could you confirm all the different scenarios that you have tested?

"ubi read $loadaddr kernel || reset;"\
"else "\
"echo Loading kernel from rootfs...;"\
"setenv bootargs $console $earlycon $ubimtd $nandroot $bootextra $mtdparts panic=2; && "\
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Having a semicolon changes the logic:

pistachio # true || echo foo
pistachio # true; || echo foo
foo

I don't think you want the && at all?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if i dont pass && somehow bootargs was not getting pass correctly to kernel, we could remove ; though. any idea?

"ubifsmount ubi:rootfs && "\
"ubifsload $loadaddr $bootdir$fitfile || "NAND_BOOTCOMMAND_LEGACY"reset;"\
"ubifsload $loadaddr $bootdir$fitfile || "NAND_BOOTCOMMAND_LEGACY" "\
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Preferably would move the || out of NAND_BOOTCOMMAND_LEGACY to here rather than moving the reset inside?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The way i read is this:
Try ubifsload
if fail try nandboot
in nandboot
try booting (if success it will not return)
else if failed to boot reset
If ubifsload succeed proceed with booting or if case of failure reset.
So booting is something which is not expected to return if success. only in case it fails we want to reset. This is reason reset look more to be part with actually command for which we want to test the condition?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The original idea was quite simple but we had to add legacy boot complications. Currently we attempted to follow this when loading kernel from the filesystem:

  1. try to load fit image from ubifs
  2. if fail try to load uImage from ubifs
  3. if fail reset

This means if we drop step 2 the device would still reset when step 1 fails.

* Openwrt have squashfs rootfs but legacy and other variant uses ubifs
* rootfs. To make all compatible dont pass root= for kernel booting
* from kernel ubi volume. For others, pass root= to correctly identify
* rootfs filesystem.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doesn't explain why this works, nor does the commit message. I would expect the commit message to go into detail of the different boot scenarios this supports.

"setenv legacy_nandroot ubi.mtd=firmware$boot_partition $legacy_nandroot;"\
"setenv bootargs $console $earlycon $legacy_nandroot $bootextra $mtdparts panic=2;"\
"echo Loading legacy kernel from rootfs... && "\
"echo Loading legacy kernel (uImage) from rootfs... && "\
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Technically it's still a variable so you can't specify uImage

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

actually legacy bootfile is already uImage so it is always TRUE?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants