Mauro Carvalho Chehab | ee68f34 | 2020-02-17 17:11:53 +0100 | [diff] [blame] | 1 | .. SPDX-License-Identifier: GPL-2.0 |
| 2 | |
| 3 | ======================== |
| 4 | BFS Filesystem for Linux |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5 | ======================== |
| 6 | |
| 7 | The BFS filesystem is used by SCO UnixWare OS for the /stand slice, which |
| 8 | usually contains the kernel image and a few other files required for the |
| 9 | boot process. |
| 10 | |
| 11 | In order to access /stand partition under Linux you obviously need to |
| 12 | know the partition number and the kernel must support UnixWare disk slices |
| 13 | (CONFIG_UNIXWARE_DISKLABEL config option). However BFS support does not |
| 14 | depend on having UnixWare disklabel support because one can also mount |
Mauro Carvalho Chehab | ee68f34 | 2020-02-17 17:11:53 +0100 | [diff] [blame] | 15 | BFS filesystem via loopback:: |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 16 | |
Mauro Carvalho Chehab | ee68f34 | 2020-02-17 17:11:53 +0100 | [diff] [blame] | 17 | # losetup /dev/loop0 stand.img |
| 18 | # mount -t bfs /dev/loop0 /mnt/stand |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 19 | |
Mauro Carvalho Chehab | ee68f34 | 2020-02-17 17:11:53 +0100 | [diff] [blame] | 20 | where stand.img is a file containing the image of BFS filesystem. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 21 | When you have finished using it and umounted you need to also deallocate |
Mauro Carvalho Chehab | ee68f34 | 2020-02-17 17:11:53 +0100 | [diff] [blame] | 22 | /dev/loop0 device by:: |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 23 | |
Mauro Carvalho Chehab | ee68f34 | 2020-02-17 17:11:53 +0100 | [diff] [blame] | 24 | # losetup -d /dev/loop0 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 25 | |
Mauro Carvalho Chehab | ee68f34 | 2020-02-17 17:11:53 +0100 | [diff] [blame] | 26 | You can simplify mounting by just typing:: |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 27 | |
Mauro Carvalho Chehab | ee68f34 | 2020-02-17 17:11:53 +0100 | [diff] [blame] | 28 | # mount -t bfs -o loop stand.img /mnt/stand |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 29 | |
Mauro Carvalho Chehab | ee68f34 | 2020-02-17 17:11:53 +0100 | [diff] [blame] | 30 | this will allocate the first available loopback device (and load loop.o |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 31 | kernel module if necessary) automatically. If the loopback driver is not |
Johannes Berg | a81792f | 2008-07-08 19:00:25 +0200 | [diff] [blame] | 32 | loaded automatically, make sure that you have compiled the module and |
| 33 | that modprobe is functioning. Beware that umount will not deallocate |
| 34 | /dev/loopN device if /etc/mtab file on your system is a symbolic link to |
| 35 | /proc/mounts. You will need to do it manually using "-d" switch of |
| 36 | losetup(8). Read losetup(8) manpage for more info. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 37 | |
| 38 | To create the BFS image under UnixWare you need to find out first which |
Mauro Carvalho Chehab | ee68f34 | 2020-02-17 17:11:53 +0100 | [diff] [blame] | 39 | slice contains it. The command prtvtoc(1M) is your friend:: |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 40 | |
Mauro Carvalho Chehab | ee68f34 | 2020-02-17 17:11:53 +0100 | [diff] [blame] | 41 | # prtvtoc /dev/rdsk/c0b0t0d0s0 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 42 | |
| 43 | (assuming your root disk is on target=0, lun=0, bus=0, controller=0). Then you |
| 44 | look for the slice with tag "STAND", which is usually slice 10. With this |
Mauro Carvalho Chehab | ee68f34 | 2020-02-17 17:11:53 +0100 | [diff] [blame] | 45 | information you can use dd(1) to create the BFS image:: |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 46 | |
Mauro Carvalho Chehab | ee68f34 | 2020-02-17 17:11:53 +0100 | [diff] [blame] | 47 | # umount /stand |
| 48 | # dd if=/dev/rdsk/c0b0t0d0sa of=stand.img bs=512 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 49 | |
| 50 | Just in case, you can verify that you have done the right thing by checking |
Mauro Carvalho Chehab | ee68f34 | 2020-02-17 17:11:53 +0100 | [diff] [blame] | 51 | the magic number:: |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 52 | |
Mauro Carvalho Chehab | ee68f34 | 2020-02-17 17:11:53 +0100 | [diff] [blame] | 53 | # od -Ad -tx4 stand.img | more |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 54 | |
| 55 | The first 4 bytes should be 0x1badface. |
| 56 | |
| 57 | If you have any patches, questions or suggestions regarding this BFS |
| 58 | implementation please contact the author: |
| 59 | |
Andrew Morton | cea5822 | 2017-05-12 15:46:44 -0700 | [diff] [blame] | 60 | Tigran Aivazian <aivazian.tigran@gmail.com> |