Re: [PATCH] Generate correct initrd.addrsize file for System z (#647827)

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

 



OK, ACK then

On Tue, 2010-11-30 at 04:42 -1000, David Cantrell wrote:
> On 11/29/2010 11:46 PM, Martin Gracik wrote:
> > Well, I can't say I know precisely what s390 needs, but I don't see
> > anything wrong with the patch.
> >
> > I just have one question, the generic.ins file can be overriden or
> > changed to have some other values? Or why isn't the 0x00010408 address
> > as a constant in geninitrdsz.c if we only grep and pass it?
> 
> They are mostly constant.  Based on previous releases, we have to change 
> these values in generic.ins from time to time.  Ideally we won't have to 
> modify geninitrdsz.c anymore, but we might have to change generic.ins 
> one or more times.  generic.ins has to exist in order to boot the 
> system, so since we need the value somewhere, I just kept it where it's 
> always been located.
> 
> This isn't a very elegant system and I would prefer that we generate 
> generic.ins entirely at image building time.  This patch needs to go in 
> for 5.6 though and master can hopefully get a better solution since I 
> will have more time.
> 
> Thanks,
> 
> >
> > On Mon, 2010-11-29 at 16:59 -1000, David Cantrell wrote:
> >> The previous fix just updated the generic.ins files, but that was not
> >> enough.  We also needed to modify geninitrdsz.c to compute the size of
> >> the initrd.img file and add that to the initrd.addrsize file.  Get the
> >> load address from the generic.ins file.
> >> ---
> >>   bootdisk/s390/generic.ins  |    2 +-
> >>   bootdisk/s390x/generic.ins |    2 +-
> >>   scripts/mk-images.s390     |    6 +++---
> >>   utils/geninitrdsz.c        |   42 +++++++++++++++++++++++++++++++-----------
> >>   4 files changed, 36 insertions(+), 16 deletions(-)
> >>
> >> diff --git a/bootdisk/s390/generic.ins b/bootdisk/s390/generic.ins
> >> index 2f513db..b991dfd 100644
> >> --- a/bootdisk/s390/generic.ins
> >> +++ b/bootdisk/s390/generic.ins
> >> @@ -2,4 +2,4 @@
> >>   images/kernel.img 0x00000000
> >>   images/initrd.img 0x02000000
> >>   images/generic.prm 0x00010480
> >> -images/initrd.size 0x00010408
> >> +images/initrd.addrsize 0x00010408
> >> diff --git a/bootdisk/s390x/generic.ins b/bootdisk/s390x/generic.ins
> >> index 2f513db..b991dfd 100644
> >> --- a/bootdisk/s390x/generic.ins
> >> +++ b/bootdisk/s390x/generic.ins
> >> @@ -2,4 +2,4 @@
> >>   images/kernel.img 0x00000000
> >>   images/initrd.img 0x02000000
> >>   images/generic.prm 0x00010480
> >> -images/initrd.size 0x00010408
> >> +images/initrd.addrsize 0x00010408
> >> diff --git a/scripts/mk-images.s390 b/scripts/mk-images.s390
> >> index 9dff2de..afb616e 100644
> >> --- a/scripts/mk-images.s390
> >> +++ b/scripts/mk-images.s390
> >> @@ -8,8 +8,8 @@ makeBootImages() {
> >>   	    --initrdsize 20000 \
> >>   	    --loaderbin loader \
> >>   	    --modules "$INITRDMODS $S390MODS"
> >> -	sz=$(ls -l $TOPDESTPATH/images/initrd.img | awk '{print $5}')
> >> -	$GENINITRDSZ $sz $TOPDESTPATH/images/initrd.size
> >> +	addr=$(grep "/initrd.img" $BOOTDISKDIR/generic.ins | cut -d ' ' -f 2)
> >> +	$GENINITRDSZ $addr $TOPDESTPATH/images/initrd.img $TOPDESTPATH/images/initrd.addrsize
> >>   	cp -vf $KERNELROOT/boot/${KERNELNAME}-${version} $TOPDESTPATH/images/kernel.img
> >>
> >>   	cp -v $BOOTDISKDIR/generic.prm $TOPDESTPATH/images/generic.prm
> >> @@ -26,7 +26,7 @@ makeBootImages() {
> >>   [images-$KERNELARCH]
> >>   kernel = images/kernel.img
> >>   initrd = images/initrd.img
> >> -initrd.size = images/initrd.size
> >> +initrd.addrsize = images/initrd.addrsize
> >>   generic.prm = images/generic.prm
> >>   generic.ins = generic.ins
> >>   cdboot.img = images/cdboot.img
> >> diff --git a/utils/geninitrdsz.c b/utils/geninitrdsz.c
> >> index 01d1cf1..ed7caab 100644
> >> --- a/utils/geninitrdsz.c
> >> +++ b/utils/geninitrdsz.c
> >> @@ -1,7 +1,7 @@
> >>   /*
> >> - * Generate initrd.size file for zSeries platforms.
> >> + * Generate initrd.addrsize file for zSeries platforms.
> >>    * Takes an integer argument and writes out the binary representation of
> >> - * that value to the initrd.size file.
> >> + * that value to the initrd.addrsize file.
> >>    * https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=197773
> >>    */
> >>
> >> @@ -17,27 +17,47 @@
> >>   #include<string.h>
> >>
> >>   int main(int argc,char **argv) {
> >> +    char *prog = basename(argv[0]);
> >> +    struct stat initrd_sbuf;
> >>       unsigned int zero = 0;
> >> -    int fd;
> >> -    unsigned int size;
> >> +    unsigned int addr, size;
> >> +    int fd, rc;
> >> +    char *tmp;
> >>       mode_t mode = S_IRUSR|S_IWUSR|S_IRGRP|S_IROTH;
> >>
> >> -    if (argc != 3) {
> >> -        printf("Usage: %s [integer size] [output file]\n", basename(argv[0]));
> >> -        printf("Example: %s 12288475 initrd.size\n", basename(argv[0]));
> >> +    if (argc != 4) {
> >> +        printf("Usage: %s [address] [initrd file] [output file]\n", prog);
> >> +        printf("Example: %s 0x2000000 initrd.img initrd.addrsize\n", prog);
> >>           return 0;
> >>       }
> >>
> >> -    size = htonl(atoi(argv[1]));
> >> -    fd = open(argv[2], O_CREAT | O_RDWR, mode);
> >> +    rc = stat(argv[2],&initrd_sbuf);
> >> +    if (rc) {
> >> +        perror("Error getting initrd stats ");
> >> +        return rc;
> >> +    }
> >> +
> >> +    addr = htonl(strtoul(argv[1],&tmp, 0));
> >> +    size = htonl(initrd_sbuf.st_size);
> >> +    fd = open(argv[3], O_CREAT | O_RDWR, mode);
> >> +
> >> +    if (write(fd,&zero, sizeof(int)) == -1) {
> >> +        perror("writing first zero");
> >> +        return errno;
> >> +    }
> >> +
> >> +    if (write(fd,&addr, sizeof(int)) == -1) {
> >> +        perror("writing addr");
> >> +        return errno;
> >> +    }
> >>
> >>       if (write(fd,&zero, sizeof(int)) == -1) {
> >> -        perror("writing initrd.size (zero)");
> >> +        perror("writing second zero");
> >>           return errno;
> >>       }
> >>
> >>       if (write(fd,&size, sizeof(int)) == -1) {
> >> -        perror("writing initrd.size (size)");
> >> +        perror("writing size");
> >>           return errno;
> >>       }
> >>
> >
> 
> 

-- 
Martin Gracik <mgracik@xxxxxxxxxx>

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/anaconda-devel-list


[Index of Archives]     [Kickstart]     [Fedora Users]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]
  Powered by Linux