-
Notifications
You must be signed in to change notification settings - Fork 12
fix booting from kernel for non-ubifs rootfs #41
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
base: 2015.10
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -289,16 +289,13 @@ | |
#define BOOT_ENV_LEGACY \ | ||
"fdtaddr=0x0D000000\0"\ | ||
"fdtfile="PISTACHIO_BOARD_NAME".dtb\0"\ | ||
"legacy_bootfile=uImage\0"\ | ||
"legacy_nandroot=root=ubi0:rootfs rootfstype=ubifs\0" | ||
"legacy_bootfile=uImage\0" | ||
|
||
#define NAND_BOOTCOMMAND_LEGACY \ | ||
"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... && "\ | ||
"ubifsload $loadaddr $bootdir$legacy_bootfile && "\ | ||
"ubifsload $fdtaddr $bootdir$fdtfile && "\ | ||
"bootm $loadaddr - $fdtaddr || " | ||
"bootm $loadaddr - $fdtaddr || reset;" | ||
|
||
#else | ||
|
||
|
@@ -307,18 +304,25 @@ | |
|
||
#endif | ||
|
||
/* | ||
* 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. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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. |
||
*/ | ||
#define NAND_BOOTCOMMAND \ | ||
"setenv nandroot ubi.mtd=firmware$boot_partition $nandroot;"\ | ||
"setenv bootargs $console $earlycon $nandroot $bootextra $mtdparts panic=2;"\ | ||
"echo Attempting to boot from firmware$boot_partition;"\ | ||
"setenv ubimtd ubi.mtd=firmware$boot_partition;"\ | ||
"ubi part firmware$boot_partition || reset;"\ | ||
"if ubi check kernel; then "\ | ||
"echo Loading kernel from volume...;"\ | ||
"setenv bootargs $console $earlycon $ubimtd $bootextra $mtdparts panic=2;"\ | ||
"ubi read $loadaddr kernel || reset;"\ | ||
"else "\ | ||
"echo Loading kernel from rootfs...;"\ | ||
"setenv bootargs $console $earlycon $ubimtd $nandroot $bootextra $mtdparts panic=2; && "\ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Having a semicolon changes the logic:
I don't think you want the && at all? There was a problem hiding this comment. Choose a reason for hiding this commentThe 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" "\ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Preferably would move the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The way i read is this: There was a problem hiding this comment. Choose a reason for hiding this commentThe 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:
This means if we drop step 2 the device would still reset when step 1 fails. |
||
"fi;" | ||
|
||
#define ALT_BOOTCOMMAND \ | ||
|
@@ -355,7 +359,7 @@ | |
"netroot=root=/dev/nfs rootfstype=nfs ip=dhcp\0"\ | ||
"usbroot=root=/dev/sda1\0"\ | ||
"mmcroot=root=/dev/mmcblk0p1\0"\ | ||
"nandroot=\0"\ | ||
"nandroot=root=ubi0:rootfs rootfstype=ubifs\0"\ | ||
"usbdev=0\0"\ | ||
"mmcdev=0\0"\ | ||
"usbboot="INIT_BOOTCOMMAND USB_BOOTCOMMAND FINAL_BOOTCOMMAND"\0"\ | ||
|
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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?