initrd.c 899 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. // SPDX-License-Identifier: GPL-2.0
  2. /*
  3. * Copyright (C) 2000 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com)
  4. */
  5. #include <linux/init.h>
  6. #include <linux/memblock.h>
  7. #include <linux/initrd.h>
  8. #include <asm/types.h>
  9. #include <init.h>
  10. #include <os.h>
  11. #include "um_arch.h"
  12. /* Changed by uml_initrd_setup, which is a setup */
  13. static char *initrd __initdata = NULL;
  14. int __init read_initrd(void)
  15. {
  16. unsigned long long size;
  17. void *area;
  18. if (!initrd)
  19. return 0;
  20. area = uml_load_file(initrd, &size);
  21. if (!area)
  22. return 0;
  23. initrd_start = (unsigned long) area;
  24. initrd_end = initrd_start + size;
  25. return 0;
  26. }
  27. static int __init uml_initrd_setup(char *line, int *add)
  28. {
  29. initrd = line;
  30. return 0;
  31. }
  32. __uml_setup("initrd=", uml_initrd_setup,
  33. "initrd=<initrd image>\n"
  34. " This is used to boot UML from an initrd image. The argument is the\n"
  35. " name of the file containing the image.\n\n"
  36. );