[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH 0/2] btrfs-support for grub-2

From: Surbhi Palande
Subject: [PATCH 0/2] btrfs-support for grub-2
Date: Mon, 5 Jul 2010 16:47:11 +0300

From: surbhi <address@hidden>

Hi All,

I am attaching two patches along with this email for enabling btrfs support in
grub2. Please note that the licensing for this patch needs to be sorted out as
grub-2 is at GPL-v3 and btrfs support in the linux kernel is at GPL-v2.

I have referred to the btrfs code in the kernel, btrfs-tools, sys-linux and
legacy grub. I have used some code from sys-linux's btrfs support (written by
Alek Du). As agreed in #btrfs irc, I am sending this email to Chris Mason to
find out whether the code in the patch can be passed under GPLv3.

The patch provides btrfs support for the following:
1) single device.
2) subvolumes.

I have tested this patch using grub-fstest (using subcommands-ls, hex and
crc). *I have not yet tested it by booting through the btrfs partition*

This is the first version of the patch and I have listed a few changes that
could be made:

1) change the storage identifiers to the grub compliant ones.
2) linkcount for symbolic links needs better handling

I have a decompression support for btrfs-grub2 in an almost ready state. I
will send that patch after these patches are sorted out.

Please do let me know your comments. I will be glad to incorporate the changes
inorder to get btrfs support into grub-2.

Thanks for your time!

Warm Regards,

Following is a brief procedure with some eg. of how one can test these patches 
in qemu:

1) used an image created with "dd" as a hdb for qemu:
kvm -hda ubuntu.img -hdb btrfs.img -m 512 -net nic,macaddr='DE:AD:BE:EF::'
-net tap
This is detected as /dev/sdb in qemu.
2) Booted through qemu and then did: fdisk -l /dev/sdb, created a partition
table in /dev/sdb
4) Used mkfs.btrfs -A <byte_num> to create a filesystem at a byte reflected by
the "start" field  of the output of fdisk -ul
and then mounted this btrfs img/partition using mount -o offset=<byte-num>.
Populated the fs.
5) compiled grub-2 with this patch
6) tested using this command:
   a) grub-fstest /dev/sdb ls '(loop0,1)/' etc.

Subvolumes can be created as follows:
1) mount -t btrfs /dev/sdb /mnt/btrfs
2) btrfsctl -S subvol1 /mnt
3) mount -t btrfs -o subvol=subvol1 /dev/sdb /mnt/btrfs_subvol
4) create some files, dir, links on /mnt/btrfs_subvol

Now you can check the contents of the subvolume by using
./grub_fstest /dev/sdb ls '(loop0,1)/subvol1/'

surbhi (2):
  config support for btrfs
  btrfs support for grub-2

 conf/common.rmk           |   40 +-
 conf/i386-pc.rmk          |    4 +-
 conf/sparc64-ieee1275.rmk |    5 +-
 fs/btrfs.c                | 1434 +++++++++++++++++++++++++++++++++++++++++++++
 fs/btrfs.h                |  385 ++++++++++++
 5 files changed, 1843 insertions(+), 25 deletions(-)
 create mode 100644 fs/btrfs.c
 create mode 100644 fs/btrfs.h

reply via email to

[Prev in Thread] Current Thread [Next in Thread]