Summary: | newfs_msdos(8): [patch] can't boot BeagleBone Black when newfs_msdos is trimming to a multiple of sectors per track | ||||||||
---|---|---|---|---|---|---|---|---|---|
Product: | Base System | Reporter: | guyyur | ||||||
Component: | bin | Assignee: | Warner Losh <imp> | ||||||
Status: | Closed FIXED | ||||||||
Severity: | Affects Only Me | CC: | andrey, emaste, imp, jhibbits, kevans | ||||||
Priority: | Normal | ||||||||
Version: | CURRENT | ||||||||
Hardware: | Any | ||||||||
OS: | Any | ||||||||
Attachments: |
|
Description
guyyur
2013-10-23 11:20:00 UTC
Thanks this patch work for me, my error messages without this https://lists.freebsd.org/pipermail/freebsd-arm/2015-June/011568.html I think this is an excellent change. The lies and deceit believed as gospel truth have lead to situations where there's no way to have the right geometry for all users. Having a way to say "I know that the geometry reported is bogus, please do it this other way" is critical. Unless there's a good objection, I plan to commit this soon. (In reply to Warner Losh from comment #2) Hello, whether there are any plans to commit this soon? Updated patches for head (code moved to mkfs_msdos.c) 1. NetBSD cvs rev 1.40 to remove chs check. https://github.com/guyyur/freebsd-src_patches/blob/master/newfs_msdos_remove_chs_align.patch 2. Only check bpbHugeSectors without bpb.bpbHiddenSecs for bpb.bpbSectors/bpb.bpbHugeSectors usage. (Not needed for BeagleBone Black booting, just matches Windows format command behavior) https://github.com/guyyur/freebsd-src_patches/blob/master/newfs_msdos_huge_sec_limit_check.patch The BeagleBone Black also supports loading the MLO from offset 128k instead of the FAT partition so it should bypass the filesystem check. I tested MLO at 128k with u-boot 2016.05, FAT sector count was not trimmed so I don't know if the filesystem check was bypassed. dd if=MLO of=/path/to/device bs=128k seek=1 conv=sync,notrunc dd if=u-boot.img of=/path/to/device bs=384k seek=1 conv=sync,notrunc This also allows using GPT instead of MBR. gpart create -s GPT SDCARD gpart add -t ms-basic-data -b 8192 -s SIZE SDCARD gpart add -t freebsd-ufs SDCARD A commit references this bug: Author: imp Date: Tue Aug 30 18:01:20 UTC 2016 New revision: 305074 URL: https://svnweb.freebsd.org/changeset/base/305074 Log: Remove CHS alignment. It's not needed and causes problems for the BBB boot partition. NetBSD removed it in 1.10 in their repo some time ago. Submitted by: Guy Yur PR: 183234 Changes: head/sbin/newfs_msdos/mkfs_msdos.c A commit references this bug: Author: imp Date: Tue Aug 30 18:01:26 UTC 2016 New revision: 305075 URL: https://svnweb.freebsd.org/changeset/base/305075 Log: The code only converts from bpbHugeSectors to bpbSectors if the sum of the hidden and huge sectors is less than or equal MAXU16. When formatting in Windows bpbSectors is still used for 63488 sectors and 2048 hidden (sum > MAXU16). The hidden sectors count is the number of sectors before the FAT16 Boot Record so it shouldn't affect the sector count. Attached patch (huge_sec_conversion.patch) to only check for bpb.bpbHugeSectors <= MAXU16 when converting to bpbSectors. Submitted by: Guy Yur PR: 183234 Changes: head/sbin/newfs_msdos/mkfs_msdos.c Thanks it work for me FreeBSD 12.0-CURRENT #0 r305366 hw.platform: am335x # gpart show => 33 3751903 mmcsd0 MBR (1.8G) 33 991 - free - (496K) 1024 4096 1 !12 [active] (2.0M) 5120 3745792 2 freebsd (1.8G) 3750912 1024 - free - (512K) batch change: For bugs that match the following - Status Is In progress AND - Untouched since 2018-01-01. AND - Affects Base System OR Documentation DO: Reset to open status. Note: I did a quick pass but if you are getting this email it might be worthwhile to double check to see if this bug ought to be closed. This bug can be closed. Comments 5 & 6 contain the commit references that fix this bug. Let me check whether MFC is needed, and will close after. (In reply to Ed Maste from comment #10) Likely should be MFC'd. It fell off my radar. A commit references this bug: Author: kevans Date: Tue Jan 15 15:47:02 UTC 2019 New revision: 343044 URL: https://svnweb.freebsd.org/changeset/base/343044 Log: MFC r305074-r305075, r327275, r327570: newfs_msdos updates r305074: Remove CHS alignment. It's not needed and causes problems for the BBB boot partition. NetBSD removed it in 1.10 in their repo some time ago. r305075: The code only converts from bpbHugeSectors to bpbSectors if the sum of the hidden and huge sectors is less than or equal MAXU16. When formatting in Windows bpbSectors is still used for 63488 sectors and 2048 hidden (sum > MAXU16). The hidden sectors count is the number of sectors before the FAT16 Boot Record so it shouldn't affect the sector count. Attached patch (huge_sec_conversion.patch) to only check for bpb.bpbHugeSectors <= MAXU16 when converting to bpbSectors. r327275: Close fd and fd1 before returning now that we're done with them. r327570: Only call close if fd and fd1 are not -1. PR: 183234 Changes: _U stable/11/ stable/11/sbin/newfs_msdos/mkfs_msdos.c Closing now that it's been MFC'd |