Changeset 677f620 in mainline


Ignore:
Timestamp:
2008-08-05T21:52:14Z (16 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
30b3ddb
Parents:
0928526
Message:

Split mktmpfs.py to a TMPFS specific part and a HORD specific part. The latter
is moved to mkhord.py and can be reused for FAT16 images as well. mktmpfs.py and
mkfat.sh define the same interface now. Modify makefiles to use the modified
interface (e.g. do not pass alignment to either mktmpfs.py or mkfat.sh). FAT16
initrd image can be now loaded as initrd on amd64 and gets recognized as a
ramdisk image.

Files:
1 added
7 edited

Legend:

Unmodified
Added
Removed
  • boot/arch/amd64/Makefile.inc

    r0928526 r677f620  
    4949        $(USPACEDIR)/app/tester/tester \
    5050        $(USPACEDIR)/app/klog/klog \
    51         $(USPACEDIR)/app/cli/cli
    52 ifneq ($(RDFMT),tmpfs)
    53         RD_TASKS += $(USPACEDIR)/srv/fs/tmpfs/tmpfs
    54 endif
    55 ifneq ($(RDFMT),fat)
    56         RD_TASKS += $(USPACEDIR)/srv/fs/fat/fat
    57 endif
     51        $(USPACEDIR)/app/cli/cli \
     52        $(USPACEDIR)/srv/fs/tmpfs/tmpfs \
     53        $(USPACEDIR)/srv/fs/fat/fat
    5854
    5955build: $(BASE)/image.iso
     
    7672        done
    7773ifeq ($(RDFMT),tmpfs)
    78         $(BASE)/tools/mktmpfs.py 4096 $(USPACEDIR)/dist/ arch/$(ARCH)/iso/boot/initrd.img
     74        $(BASE)/tools/mktmpfs.py $(USPACEDIR)/dist/ arch/$(ARCH)/iso/boot/initrd.fs.img
    7975endif
    8076ifeq ($(RDFMT),fat)
    81         $(BASE)/tools/mkfat.sh $(USPACEDIR)/dist/ arch/$(ARCH)/iso/boot/initrd.img
     77        $(BASE)/tools/mkfat.sh $(USPACEDIR)/dist/ arch/$(ARCH)/iso/boot/initrd.fs.img
    8278endif
     79        $(BASE)/tools/mkhord.py 4096 arch/$(ARCH)/iso/boot/initrd.fs.img arch/$(ARCH)/iso/boot/initrd.img
     80        rm arch/$(ARCH)/iso/boot/initrd.fs.img
    8381        mkisofs -J -r -b boot/grub/stage2_eltorito -no-emul-boot -boot-load-size 4 -boot-info-table -o $(BASE)/image.iso arch/$(ARCH)/iso/
    8482
  • boot/arch/arm32/loader/Makefile

    r0928526 r677f620  
    123123                cp $$task $(USPACEDIR)/dist/sbin/ ; \
    124124        done
    125         ../../../../tools/mktmpfs.py 4096 $(USPACEDIR)/dist/ initrd.img
     125        ../../../../tools/mktmpfs.py $(USPACEDIR)/dist/ initrd.fs.img
     126        ../../../../tools/mkhord.py 4096 initrd.fs.img initrd.img
     127        rm initrd.fs.img
    126128        ../../../tools/pack.py $(OBJCOPY) $(BFD_NAME) $(BFD_ARCH) 4096 "unsigned int" $(COMPONENTS) ./initrd.img
    127129
  • boot/arch/ia32/Makefile.inc

    r0928526 r677f620  
    6060                cp $$task $(USPACEDIR)/dist/sbin/ ; \
    6161        done
    62         $(BASE)/tools/mktmpfs.py 4096 $(USPACEDIR)/dist/ arch/$(ARCH)/iso/boot/initrd.img
     62        $(BASE)/tools/mktmpfs.py $(USPACEDIR)/dist/ arch/$(ARCH)/iso/boot/initrd.fs.img
     63        $(BASE)/tools/mkhord.py 4096 arch/$(ARCH)/iso/boot/initrd.fs.img arch/$(ARCH)/iso/boot/initrd.img
     64        rm arch/$(ARCH)/iso/boot/initrd.fs.img
    6365        mkisofs -J -r -b boot/grub/stage2_eltorito -no-emul-boot -boot-load-size 4 -boot-info-table -o $(BASE)/image.iso arch/$(ARCH)/iso/
    6466
  • boot/arch/mips32/loader/Makefile

    r0928526 r677f620  
    124124                cp $$task $(USPACEDIR)/dist/sbin/ ; \
    125125        done
    126         ../../../../tools/mktmpfs.py 16384 $(USPACEDIR)/dist/ initrd.img
     126        ../../../../tools/mktmpfs.py $(USPACEDIR)/dist/ initrd.fs.img
     127        ../../../../tools/mkhord.py 16384 initrd.fs.img initrd.img
     128        rm initrd.fs.img
    127129        ../../../tools/pack.py $(OBJCOPY) $(BFD_NAME) $(BFD_ARCH) 16384 "unsigned int" $(COMPONENTS) ./initrd.img
    128130
  • boot/arch/ppc32/loader/Makefile

    r0928526 r677f620  
    118118                cp $$task $(USPACEDIR)/dist/sbin/ ; \
    119119        done
    120         ../../../../tools/mktmpfs.py 4096 $(USPACEDIR)/dist/ initrd.img
     120        ../../../../tools/mktmpfs.py $(USPACEDIR)/dist/ initrd.fs.img
     121        ../../../../tools/mkhord.py 4096 initrd.fs.img initrd.img
     122        rm initrd.fs.img
    121123        ../../../tools/pack.py $(OBJCOPY) $(BFD_NAME) $(BFD_ARCH) 4096 "unsigned int" $(COMPONENTS) ./initrd.img
    122124
  • boot/arch/sparc64/loader/Makefile

    r0928526 r677f620  
    121121                cp $$task $(USPACEDIR)/dist/sbin/ ; \
    122122        done
    123         ../../../../tools/mktmpfs.py 16384 $(USPACEDIR)/dist/ initrd.img
     123        ../../../../tools/mktmpfs.py $(USPACEDIR)/dist/ initrd.fs.img
     124        ../../../../tools/mkhord.py 16384 initrd.fs.img initrd.img
     125        rm initrd.fs.img
    124126        ../../../tools/pack.py $(OBJCOPY) $(BFD_NAME) $(BFD_ARCH) 1 "unsigned long" $(COMPONENTS) ./initrd.img
    125127
  • tools/mktmpfs.py

    r0928526 r677f620  
    3434import os
    3535import struct
    36 
    37 def align_up(size, alignment):
    38         "Align upwards to a given alignment"
    39         return (((size) + ((alignment) - 1)) & ~((alignment) - 1))
    4036
    4137def usage(prname):
     
    7773
    7874def main():
    79         if (len(sys.argv) < 4):
     75        if (len(sys.argv) < 3):
    8076                usage(sys.argv[0])
    8177                return
    8278       
    83         if (not sys.argv[1].isdigit()):
    84                 print "<ALIGNMENT> must be a number"
    85                 return
    86        
    87         align = int(sys.argv[1], 0)
    88         path = os.path.abspath(sys.argv[2])
     79        path = os.path.abspath(sys.argv[1])
    8980        if (not os.path.isdir(path)):
    9081                print "<PATH> must be a directory"
    9182                return
    9283       
    93         header_size = align_up(18, align)
    94         outf = file(sys.argv[3], "w")
    95         outf.write(struct.pack("<" + ("%d" % header_size) + "x"))
     84        outf = file(sys.argv[2], "w")
    9685       
    9786        outf.write(struct.pack("<5s", "TMPFS"))
    98         payload_size = 5
    99        
    100         payload_size += recursion(path, outf)
     87        recursion(path, outf)
     88        outf.write(struct.pack("<BL", 0, 0))
     89
     90        outf.close()
    10191               
    102         outf.write(struct.pack("<BL", 0, 0))
    103         payload_size += 5
    104        
    105         aligned_size = align_up(payload_size, align)
    106        
    107         if (aligned_size - payload_size > 0):
    108                 outf.write(struct.pack("<" + ("%d" % (aligned_size - payload_size)) + "x"))
    109                
    110         outf.seek(0)
    111         outf.write(struct.pack("<4sBBLQ", "HORD", 1, 1, header_size, aligned_size))
    112         outf.close()
    113 
    11492if __name__ == '__main__':
    11593        main()
Note: See TracChangeset for help on using the changeset viewer.