wok diff linux/stuff/linux-freeinitrd.u @ rev 17037

linux: fix linux64 initramfs load
author Pascal Bellard <pascal.bellard@slitaz.org>
date Mon Aug 18 23:02:00 2014 +0200 (2014-08-18)
parents 8580e54b5284
children ffc20f9bd49f
line diff
     1.1 --- a/linux/stuff/linux-freeinitrd.u	Wed Dec 18 10:44:14 2013 +0000
     1.2 +++ b/linux/stuff/linux-freeinitrd.u	Mon Aug 18 23:02:00 2014 +0200
     1.3 @@ -5,7 +5,7 @@
     1.4   	set_memory_rw(begin, (end - begin) >> PAGE_SHIFT);
     1.5   
     1.6  -	printk(KERN_INFO "Freeing %s: %luk freed\n", what, (end - begin) >> 10);
     1.7 -+	if (what) printk(KERN_INFO "Freeing %s: %luk freed\n", what, (end - begin) >> 10);
     1.8 ++	if (what && *what) printk(KERN_INFO "Freeing %s: %luk freed\n", what, (end - begin) >> 10);
     1.9   
    1.10   	for (; addr < end; addr += PAGE_SIZE) {
    1.11   		ClearPageReserved(virt_to_page(addr));
    1.12 @@ -22,22 +22,22 @@
    1.13  +
    1.14  +static void free_rootfs_mem(unsigned long start, unsigned long end)
    1.15  +{
    1.16 -+	free_init_pages(NULL, start, end);
    1.17 ++	free_init_pages("", start, end);
    1.18  +}
    1.19  +
    1.20  +static void _free_initrd(unsigned long initrd_start, unsigned long initrd_end, 
    1.21  +			 void (*free_initrd_mem)(unsigned long, unsigned long));
    1.22  +
    1.23  +static struct {
    1.24 -+	int offset, last, inptr, freed;
    1.25 ++	unsigned long offset, last, inptr, freed;
    1.26  +	char *max;
    1.27  +} fill;
    1.28  +
    1.29  +static void release_inbuf(unsigned n)
    1.30  +{
    1.31  +	if (n >= INITRD_PAGE) {
    1.32 -+		unsigned rem = n % INITRD_PAGE;
    1.33 -+		unsigned end = initrd_start + n - rem;
    1.34 ++		unsigned long rem = n % INITRD_PAGE;
    1.35 ++		unsigned long end = initrd_start + n - rem;
    1.36  +		_free_initrd(initrd_start, end, free_rootfs_mem);
    1.37  +		fill.freed += n - rem;
    1.38  +		if (fill.freed >= INITRD_DOT) {
    1.39 @@ -49,9 +49,9 @@
    1.40  +	}
    1.41  +}
    1.42  +
    1.43 -+static int fill_buffer(void *buffer, unsigned size)
    1.44 ++static unsigned long fill_buffer(void *buffer, unsigned size)
    1.45  +{
    1.46 -+	int max =  fill.max - (char *) initrd_start - fill.offset;
    1.47 ++	unsigned long max =  fill.max - (char *) initrd_start - fill.offset;
    1.48  +	if (max > size) max = size;
    1.49  +	if (max > INITRD_PAGE) max = INITRD_PAGE;
    1.50  +	memcpy(buffer, (void *)(initrd_start + fill.offset), max);