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

Re: [Xen-devel] [PATCH] pv-grub: Support bzip2, xz and lzo compressed kernels



On Fri, Jan 04, 2013 at 12:43:43PM +0000, Ian Campbell wrote:
> On Fri, 2013-01-04 at 12:15 +0000, Samuel Thibault wrote:
> > Ian Campbell, le Fri 04 Jan 2013 11:56:33 +0000, a écrit :
> > > +BZIP2_STAMPFILE=$(CROSS_ROOT)/$(GNU_TARGET_ARCH)-xen-elf/lib/libbz2.a
> > > +.PHONY: cross-bzip2
> > > +cross-bzip2: $(BZIP2_STAMPFILE)
> > > +$(BZIP2_STAMPFILE): bzip2-$(XEN_TARGET_ARCH) $(NEWLIB_STAMPFILE)
> > > + ( cd $< && \
> > > +   $(MAKE) DESTDIR= libbz2.a && \
> > > +   $(INSTALL_DATA) libbz2.a 
> > > $(CROSS_PREFIX)/$(GNU_TARGET_ARCH)-xen-elf/lib/ && \
> > > +   $(INSTALL_DATA) bzlib.h 
> > > $(CROSS_PREFIX)/$(GNU_TARGET_ARCH)-xen-elf/include/ \
> > > + )
> > 
> > This is missing the cross-compilation flags, isn't it?
> 
> Oops, yes, I cut them out with the unneeded configure by mistake!
> 
> 8<----------------------------------------
> 
> From d7116c4f19c54613f28a3bd44c84fef1b3340a1e Mon Sep 17 00:00:00 2001
> From: Ian Campbell <ian.campbell@xxxxxxxxxx>
> Date: Fri, 4 Jan 2013 11:37:31 +0000
> Subject: [PATCH] pv-grub: Support bzip2, xz and lzo compressed kernels
> 
> xz compressed kernels seem to be what we are starting to see in the
> wild, but we may as well support everything that libxc does in
> pv-grub.
> 
> Also update the zlib library to the latest version
> 
> Signed-off-by: Ian Campbell <ian.campbell@xxxxxxxxxx>

Ian, this doesn't seem to have been committed. This looks good, and
Ben has tested booting lzo, xz and bz2 compressed kernels using
PV-GRUB with this patch applied.

Reviewed-by: Matt Wilson <msw@xxxxxxxxxx>
Tested-by: Ben Cressey <bcressey@xxxxxxxxxx>

> Cc: waldi@xxxxxxxxxx
> ---
> v2: Pass cross-compile flags to bzip2 build.
> 
> This is only build tested as I don't have a convenient pv-grub setup
> at the moment.
> 
> As well as committing the committer should fetch the following URLs
> to xenbits.xen.org:/var/xenbits-www/html/xen-extfiles
> - http://www.zlib.net/zlib-1.2.7.tar.gz
> - http://www.bzip.org/1.0.6/bzip2-1.0.6.tar.gz
>   md5sum 00b516f4704d4a7cb50a1d97e6e8e15b
> - http://tukaani.org/xz/xz-5.0.4.tar.bz2
>   http://tukaani.org/xz/xz-5.0.4.tar.bz2.sig
> - http://www.oberhumer.com/opensource/lzo/download/lzo-2.06.tar.gz
> ---
>  .gitignore              |    3 ++
>  .hgignore               |    3 ++
>  extras/mini-os/Makefile |    3 ++
>  stubdom/Makefile        |   84 
> +++++++++++++++++++++++++++++++++++++++++++++--
>  stubdom/bzip2.patch     |   11 ++++++
>  stubdom/grub/kexec.c    |    6 +++
>  6 files changed, 107 insertions(+), 3 deletions(-)
>  create mode 100644 stubdom/bzip2.patch
> 
> diff --git a/.gitignore b/.gitignore
> index f71cff8..a95183a 100644
> --- a/.gitignore
> +++ b/.gitignore
> @@ -107,6 +107,9 @@ stubdom/newlib-1.*
>  stubdom/newlib-x86*
>  stubdom/pciutils-*
>  stubdom/zlib-*
> +stubdom/bzip2-*
> +stubdom/xz-*
> +stubdom/lzo-*
>  stubdom/grub-*
>  stubdom/ocaml-*
>  stubdom/lwip/
> diff --git a/.hgignore b/.hgignore
> index 344792a..044a88a 100644
> --- a/.hgignore
> +++ b/.hgignore
> @@ -102,6 +102,9 @@
>  ^stubdom/newlib-.*$
>  ^stubdom/pciutils-.*$
>  ^stubdom/zlib-.*$
> +^stubdom/bzip2-.*$
> +^stubdom/xz-.*$
> +^stubdom/lzo-.*$
>  ^stubdom/grub-.*$
>  ^stubdom/ocaml-.*$
>  ^stubdom/lwip/
> diff --git a/extras/mini-os/Makefile b/extras/mini-os/Makefile
> index 2302a23..717b209 100644
> --- a/extras/mini-os/Makefile
> +++ b/extras/mini-os/Makefile
> @@ -159,6 +159,9 @@ APP_LDLIBS += 
> -L$(XEN_ROOT)/stubdom/libxc-$(XEN_TARGET_ARCH) -whole-archive -lxe
>  endif
>  APP_LDLIBS += -lpci
>  APP_LDLIBS += -lz
> +APP_LDLIBS += -lbz2
> +APP_LDLIBS += -llzma
> +APP_LDLIBS += -llzo2
>  APP_LDLIBS += -lm
>  LDLIBS += -lc
>  endif
> diff --git a/stubdom/Makefile b/stubdom/Makefile
> index 50ba360..c85dea2 100644
> --- a/stubdom/Makefile
> +++ b/stubdom/Makefile
> @@ -9,7 +9,19 @@ include $(XEN_ROOT)/Config.mk
>  
>  #ZLIB_URL?=http://www.zlib.net
>  ZLIB_URL=$(XEN_EXTFILES_URL)
> -ZLIB_VERSION=1.2.3
> +ZLIB_VERSION=1.2.7
> +
> +#BZIP2_URL?=http://www.bzip.org/$(BZIP2_VERSION)
> +BZIP2_URL=$(XEN_EXTFILES_URL)
> +BZIP2_VERSION=1.0.6
> +
> +#XZ_URL?=http://tukaani.org/xz
> +XZ_URL=$(XEN_EXTFILES_URL)
> +XZ_VERSION=5.0.4
> +
> +#LZO_URL?=http://www.oberhumer.com/opensource/lzo/download
> +LZO_URL=$(XEN_EXTFILES_URL)
> +LZO_VERSION=2.06
>  
>  #LIBPCI_URL?=http://www.kernel.org/pub/software/utils/pciutils
>  LIBPCI_URL?=$(XEN_EXTFILES_URL)
> @@ -134,6 +146,69 @@ $(ZLIB_STAMPFILE): zlib-$(XEN_TARGET_ARCH) 
> $(NEWLIB_STAMPFILE)
>         $(MAKE) DESTDIR= libz.a && \
>         $(MAKE) DESTDIR= install )
>  
> +############
> +# Cross-bzip2
> +############
> +
> +bzip2-$(BZIP2_VERSION).tar.gz:
> +     $(WGET) $(BZIP2_URL)/$@
> +
> +bzip2-$(XEN_TARGET_ARCH): bzip2-$(BZIP2_VERSION).tar.gz
> +     tar xzf $<
> +     mv bzip2-$(BZIP2_VERSION) $@
> +     patch -d $@ -p1 < bzip2.patch
> +
> +BZIP2_STAMPFILE=$(CROSS_ROOT)/$(GNU_TARGET_ARCH)-xen-elf/lib/libbz2.a
> +.PHONY: cross-bzip2
> +cross-bzip2: $(BZIP2_STAMPFILE)
> +$(BZIP2_STAMPFILE): bzip2-$(XEN_TARGET_ARCH) $(NEWLIB_STAMPFILE)
> +     ( cd $< && \
> +       $(MAKE) CROSS_CFLAGS="$(TARGET_CPPFLAGS) $(TARGET_CFLAGS) 
> -DBZ_NO_STDIO" CC=$(CC) DESTDIR= libbz2.a && \
> +       $(INSTALL_DATA) libbz2.a 
> $(CROSS_PREFIX)/$(GNU_TARGET_ARCH)-xen-elf/lib/ && \
> +       $(INSTALL_DATA) bzlib.h 
> $(CROSS_PREFIX)/$(GNU_TARGET_ARCH)-xen-elf/include/ \
> +     )
> +
> +##############
> +# Cross-xz
> +##############
> +
> +xz-$(XZ_VERSION).tar.bz2:
> +     $(WGET) $(XZ_URL)/$@
> +
> +xz-$(XEN_TARGET_ARCH): xz-$(XZ_VERSION).tar.bz2
> +     tar xjf $<
> +     mv xz-$(XZ_VERSION) $@
> +
> +XZ_STAMPFILE=$(CROSS_ROOT)/$(GNU_TARGET_ARCH)-xen-elf/lib/liblzma.a
> +.PHONY: cross-xz
> +cross-xz: $(XZ_STAMPFILE)
> +$(XZ_STAMPFILE): xz-$(XEN_TARGET_ARCH) $(NEWLIB_STAMPFILE)
> +     ( cd $< && \
> +       CFLAGS="$(TARGET_CPPFLAGS) $(TARGET_CFLAGS)" CC=$(CC) ./configure 
> --prefix=$(CROSS_PREFIX)/$(GNU_TARGET_ARCH)-xen-elf && \
> +       cd src/liblzma && \
> +       $(MAKE) DESTDIR= liblzma.la && \
> +       $(MAKE) DESTDIR= install )
> +
> +##############
> +# Cross-lzo
> +##############
> +
> +lzo-$(LZO_VERSION).tar.gz:
> +     $(WGET) $(LZO_URL)/$@
> +
> +lzo-$(XEN_TARGET_ARCH): lzo-$(LZO_VERSION).tar.gz
> +     tar xzf $<
> +     mv lzo-$(LZO_VERSION) $@
> +
> +LZO_STAMPFILE=$(CROSS_ROOT)/$(GNU_TARGET_ARCH)-xen-elf/lib/liblzo2.a
> +.PHONY: cross-lzo
> +cross-lzo: $(LZO_STAMPFILE)
> +$(LZO_STAMPFILE): lzo-$(XEN_TARGET_ARCH) $(NEWLIB_STAMPFILE)
> +     ( cd $< && \
> +       CFLAGS="$(TARGET_CPPFLAGS) $(TARGET_CFLAGS)" CC=$(CC) ./configure 
> --prefix=$(CROSS_PREFIX)/$(GNU_TARGET_ARCH)-xen-elf && \
> +       $(MAKE) DESTDIR= src/liblzo2.la && \
> +       $(MAKE) DESTDIR= install-libLTLIBRARIES install-pkgincludeHEADERS )
> +
>  ##############
>  # Cross-libpci
>  ##############
> @@ -281,10 +356,13 @@ $(TARGETS_MINIOS): mini-os-%:
>  
>  .PHONY: libxc
>  libxc: libxc-$(XEN_TARGET_ARCH)/libxenctrl.a 
> libxc-$(XEN_TARGET_ARCH)/libxenguest.a
> -libxc-$(XEN_TARGET_ARCH)/libxenctrl.a: cross-zlib
> +libxc-$(XEN_TARGET_ARCH)/libxenctrl.a: TARGET_CFLAGS += -DHAVE_BZLIB
> +libxc-$(XEN_TARGET_ARCH)/libxenctrl.a: TARGET_CFLAGS += -DHAVE_LZMA
> +libxc-$(XEN_TARGET_ARCH)/libxenctrl.a: TARGET_CFLAGS += -DHAVE_LZO1X
> +libxc-$(XEN_TARGET_ARCH)/libxenctrl.a: cross-zlib cross-bzip2 cross-xz 
> cross-lzo
>       CPPFLAGS="$(TARGET_CPPFLAGS)" CFLAGS="$(TARGET_CFLAGS)" $(MAKE) 
> DESTDIR= -C libxc-$(XEN_TARGET_ARCH)
>  
> - libxc-$(XEN_TARGET_ARCH)/libxenguest.a: 
> libxc-$(XEN_TARGET_ARCH)/libxenctrl.a
> +libxc-$(XEN_TARGET_ARCH)/libxenguest.a: libxc-$(XEN_TARGET_ARCH)/libxenctrl.a
>  
>  #######
>  # ioemu
> diff --git a/stubdom/bzip2.patch b/stubdom/bzip2.patch
> new file mode 100644
> index 0000000..2eb0416
> --- /dev/null
> +++ b/stubdom/bzip2.patch
> @@ -0,0 +1,11 @@
> +--- bzip2-x86_64.orig/Makefile       2013-01-04 10:56:57.000000000 +0000
> ++++ bzip2-x86_64/Makefile    2013-01-04 10:57:06.000000000 +0000
> +@@ -21,7 +21,7 @@
> + LDFLAGS=
> + 
> + BIGFILES=-D_FILE_OFFSET_BITS=64
> +-CFLAGS=-Wall -Winline -O2 -g $(BIGFILES)
> ++CFLAGS=$(CROSS_CFLAGS) -Wall -Winline -O2 -g $(BIGFILES)
> + 
> + # Where you want it installed when you do 'make install'
> + PREFIX=/usr/local
> diff --git a/stubdom/grub/kexec.c b/stubdom/grub/kexec.c
> index b21c91a..9d10d32 100644
> --- a/stubdom/grub/kexec.c
> +++ b/stubdom/grub/kexec.c
> @@ -54,6 +54,12 @@ static unsigned long allocated;
>  int pin_table(xc_interface *xc_handle, unsigned int type, unsigned long mfn,
>                domid_t dom);
>  
> +/* Required by libbz2 */
> +void bz_internal_error(int errcode)
> +{
> +    printk("BZIP2: Internal Error %d", __FUNCTION__);
> +}
> +
>  /* We need mfn to appear as target_pfn, so exchange with the MFN there */
>  static void do_exchange(struct xc_dom_image *dom, xen_pfn_t target_pfn, 
> xen_pfn_t source_mfn)
>  {

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.