mirror of
https://github.com/openwrt/packages.git
synced 2025-12-21 19:14:30 +04:00
Add patch fixing compilation error for implicit declaration of 'basename' and also add a patch to use toolchain version of nm and objcopy tool. Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
63 lines
1.8 KiB
Diff
63 lines
1.8 KiB
Diff
--- a/src/setup/setup.c
|
|
+++ b/src/setup/setup.c
|
|
@@ -24,6 +24,7 @@
|
|
#include <getopt.h>
|
|
#include <errno.h>
|
|
#include <stdlib.h>
|
|
+#include <libgen.h>
|
|
#include <assert.h>
|
|
#include <sys/statfs.h>
|
|
#include <sys/stat.h>
|
|
@@ -83,6 +84,9 @@ static int verify_esp(const char *p, uin
|
|
blkid_probe b = NULL;
|
|
int r;
|
|
const char *v;
|
|
+ char buf[1024];
|
|
+
|
|
+ memset(buf, 0, sizeof(buf));
|
|
|
|
if (statfs(p, &sfs) < 0) {
|
|
fprintf(stderr, "Failed to check file system type of %s: %m\n", p);
|
|
@@ -122,24 +126,38 @@ static int verify_esp(const char *p, uin
|
|
return -ENODEV;
|
|
}
|
|
|
|
- r = asprintf(&t, "/dev/block/%u:%u", major(st.st_dev), minor(st.st_dev));
|
|
+ r = asprintf(&t, "/sys/dev/block/%u:%u", major(st.st_dev), minor(st.st_dev));
|
|
if (r < 0) {
|
|
fprintf(stderr, "Out of memory.\n");
|
|
return -ENOMEM;
|
|
}
|
|
|
|
+ r = readlink(t, buf, sizeof(buf) - 1);
|
|
+ if (r < 0) {
|
|
+ fprintf(stderr, "Failed to identify device node for block device %u:%u\n", major(st.st_dev), minor(st.st_dev));
|
|
+ return -ENOMEM;
|
|
+ }
|
|
+
|
|
+ r = asprintf(&t, "/dev/%s", basename(buf));
|
|
+ if (r < 0) {
|
|
+ fprintf(stderr, "Out of memory.\n");
|
|
+ return -ENOMEM;
|
|
+ }
|
|
+
|
|
errno = 0;
|
|
b = blkid_new_probe_from_filename(t);
|
|
- free(t);
|
|
if (!b) {
|
|
if (errno != 0) {
|
|
- fprintf(stderr, "Failed to open file system %s: %m\n", p);
|
|
+ fprintf(stderr, "Failed to open file system %s on %s: %m\n", p, t);
|
|
+ free(t);
|
|
return -errno;
|
|
}
|
|
|
|
+ free(t);
|
|
fprintf(stderr, "Out of memory.\n");
|
|
return -ENOMEM;
|
|
}
|
|
+ free(t);
|
|
|
|
blkid_probe_enable_superblocks(b, 1);
|
|
blkid_probe_set_superblocks_flags(b, BLKID_SUBLKS_TYPE);
|